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();
    }
}