mirror of
https://onedev.site.tesses.net/tytd2025
synced 2026-02-09 01:55:46 +00:00
First commit
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
class TYTD.TranscodeAudio : IVideoDownload {
|
||||
private id;
|
||||
private ncv;
|
||||
private tytd;
|
||||
private ext;
|
||||
|
||||
public TranscodeAudio(id,ext)
|
||||
{
|
||||
this.id = id;
|
||||
this.ext = ext;
|
||||
this.ncv = new TYTD.AOVideoDownload(id);
|
||||
}
|
||||
|
||||
public setTYTD(tytd)
|
||||
{
|
||||
this.tytd = tytd;
|
||||
return this.ncv.TYTD = tytd;
|
||||
}
|
||||
|
||||
public setProgress(p)
|
||||
{
|
||||
return this.ncv.Progress = p;
|
||||
}
|
||||
|
||||
public getVideo()
|
||||
{
|
||||
return this.ncv.Video;
|
||||
}
|
||||
|
||||
public Start()
|
||||
{
|
||||
var id = this.id;
|
||||
this.ncv.Start();
|
||||
|
||||
var p = new Process();
|
||||
p.FileName = Env.GetRealExecutablePath("ffmpeg").ToString();
|
||||
|
||||
var dir = this.tytd.DatabaseDirectory / "Streams"/this.id.Substring(0,4)/this.id.Substring(4);
|
||||
var ao = dir / "ao.bin";
|
||||
var out = dir / $"conv{this.ext}";
|
||||
if(FS.Local.FileExists(out)) return;
|
||||
var args=["-y","-i",ao.ToString()];
|
||||
|
||||
|
||||
args.Add("-preset");
|
||||
args.Add("ultrafast");
|
||||
args.Add(out.ToString());
|
||||
|
||||
|
||||
p.Arguments = args;
|
||||
if(p.Start())
|
||||
p.Join();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user