Пример #1
0
        public static void RunFFmpegToAAC(AudioConfig audioConfig)
        {
            string bat = getAudiobat(audioConfig);


            ProcessCmd.RunBat(bat, Path.GetTempPath());
        }
Пример #2
0
        public static void RunFFmpegToFlac(AudioConfig audioconfig)
        {
            ProcessStartInfo processinfo = new ProcessStartInfo();
            string           bat         = getAudioFlacBat(audioconfig.Input, audioconfig.Output, audioconfig);

            ProcessCmd.RunBat(bat, Path.GetTempPath());
        }
Пример #3
0
        public static string NvEncSelf(FileConfig fileConfig)
        {
            VedioConfig      vedioConfig = fileConfig.VedioConfig;
            ProcessStartInfo processinfo = new ProcessStartInfo();
            string           outfile     = FileUtility.GetNoSameNameFile(fileConfig.OutputFile + ".h265");
            string           ffmpegline  = Path.Combine(Application.StartupPath, FFmpegCommand.FFmpegExecute).Maohao();
            string           cqp         = $" --cqp {vedioConfig.crf}";

            if (vedioConfig.UserArgs.Contains("--cqp") || vedioConfig.UserArgs.Contains("--cbr") || vedioConfig.UserArgs.Contains("--vbr"))
            {
                cqp = "";
            }
            string codec = vedioConfig.Encoder == Encoder.NvEnc_H265 ? "-c hevc" : "-c h264";
            var    bat   = $"{nvencexe.Maohao()} {cqp} {codec} --output-depth {vedioConfig.depth} {vedioConfig.UserArgs} -i {fileConfig.VedioFileFullName.Maohao()} -o {outfile.Maohao()}";

            if (vedioConfig.BitType == EncoderBitrateType.crf || vedioConfig.BitType == EncoderBitrateType.qp)
            {
                ProcessCmd.RunBat(bat, Config.Temp);
            }
            else if (vedioConfig.BitType == EncoderBitrateType.twopass)
            {
                throw new NotSupportedException();
            }

            return(outfile);
        }
Пример #4
0
        public static void RunFFmpegToOpus(AudioConfig audioConfig)
        {
            string tmp = Path.GetTempPath();

            string bat = getAudioOpus(audioConfig);

            ProcessCmd.RunBat(bat, tmp);
        }
Пример #5
0
        public static string ConvertAudioTOpus(FileConfig fileConfig)
        {
            AudioConfig audioConfig = fileConfig.AudioConfig;
            string      tmp         = Config.Temp;
            string      audiofile   = FileUtility.RandomName(tmp) + ".opus";
            string      bat         = $"{Eac3toExecute.Maohao()} {fileConfig.VedioFileFullName.Maohao()}  {audioConfig.Tracker}: stdout.wav | {OpusEnc.Maohao()} --ignorelength -  {audiofile.Maohao()}";

            ProcessCmd.RunBat(bat, Config.Temp);
            return(audiofile);
        }
Пример #6
0
        public static string ConvertMusic(FileConfig fileConfig)
        {
            AudioConfig audioConfig = fileConfig.AudioConfig;
            string      tmp         = Config.Temp;
            string      audiofile   = FileUtility.RandomName(tmp) + ".m4a";
            string      bat         = $"{Eac3toExecute.Maohao()} {fileConfig.VedioFileFullName.Maohao()} {audioConfig.Tracker}: {audiofile.Maohao()}  -quality={audioConfig.Quality} {audioConfig.CommandLineArgs}";

            ProcessCmd.RunBat(bat, Config.Temp);
            return(audiofile);
        }
Пример #7
0
        public static string RunFFmpegToAAC(AudioConfig audioConfig)
        {
            string audiofile = FileUtility.RandomName(Path.GetTempPath()) + ".aac";

            string bat = getAudiobat(audioConfig);


            ProcessCmd.RunBat(bat, Path.GetTempPath());

            return(audiofile);
        }
Пример #8
0
        public static string RunFFmpegToOpus(AudioConfig audioConfig)
        {
            string tmp       = Path.GetTempPath();
            string audiofile = FileUtility.RandomName(tmp) + ".opus";

            string bat = getAudioOpus(audioConfig);

            ProcessCmd.RunBat(bat, tmp);

            return(audiofile);
        }
Пример #9
0
        public static string ConvertAudioToFlac(FileConfig fileConfig)
        {
            AudioConfig audioConfig = fileConfig.AudioConfig;
            string      tmp         = Config.Temp;
            string      audiofile   = FileUtility.RandomName(tmp) + ".flac";
            var         eac3to      = Path.Combine(Environment.CurrentDirectory, Eac3toExecute);
            var         opusenc     = Path.Combine(Environment.CurrentDirectory, OpusEnc);
            string      bat         = $"{eac3to.Maohao()} {fileConfig.VedioFileFullName.Maohao()} {audioConfig.Tracker}: {audiofile.Maohao()} ";

            ProcessCmd.RunBat(bat, Config.Temp);
            return(audiofile);
        }
Пример #10
0
        public static string ffmpegPipeX265(FileConfig fileConfig)
        {
            VedioConfig      vedioConfig   = fileConfig.VedioConfig;
            ProcessStartInfo processinfo   = new ProcessStartInfo();
            string           finalX265Path = "";

            if (vedioConfig.depth == 8)
            {
                finalX265Path = x265Excute8lite;
            }
            else if (vedioConfig.depth == 10)
            {
                finalX265Path = x265Excute10lite;
            }
            if (!File.Exists(finalX265Path))
            {
                throw new EncoderException("找不到指定程序:" + finalX265Path);
            }
            processinfo.FileName = Environment.GetEnvironmentVariable("ComSpec");
            string x264Line;
            string outputpath = "";

            Getx265Line(fileConfig, 1, out x264Line, out outputpath);
            string ffmpegline = TextManager.Mh + FFmpegCommand.FFmpegExecute + TextManager.Mh + FFmpegCommand.GetFfmpegArgs(fileConfig);
            var    bat        = ffmpegline + finalX265Path + " " + x264Line + " -";
            //processinfo.UseShellExecute = false;    //输出信息重定向
            //processinfo.CreateNoWindow = true;
            //processinfo.RedirectStandardInput = true;
            //processinfo.RedirectStandardOutput = true;
            //processinfo.RedirectStandardError = false;
            //processinfo.WindowStyle = ProcessWindowStyle.Hidden;
            Process avsx264mod = new Process();

            if (vedioConfig.BitType == EncoderBitrateType.crf)
            {
                ProcessCmd.RunBat(bat, Config.Temp);
            }
            else if (vedioConfig.BitType == EncoderBitrateType.twopass)
            {
                Getx265Line(fileConfig, 1, out x264Line, out outputpath);
                var bat1 = ffmpegline + finalX265Path + " " + x264Line + " -";
                ProcessCmd.RunBat(bat1, Config.Temp);

                Getx265Line(fileConfig, 2, out x264Line, out outputpath);
                var bat2 = ffmpegline + finalX265Path + " " + x264Line + " -";
                ProcessCmd.RunBat(bat2, Config.Temp);
            }

            avsx264mod.Dispose();
            return(outputpath);
        }
Пример #11
0
        public static string ffmpegPipeX265(FileConfig fileConfig)
        {
            VedioConfig      vedioConfig   = fileConfig.VedioConfig;
            ProcessStartInfo processinfo   = new ProcessStartInfo();
            string           finalX265Path = "";

            finalX265Path = GetX265LiteFullName(vedioConfig);
            if (Config.IsWindows)
            {
                finalX265Path = Path.Combine(Application.StartupPath, finalX265Path);
            }

            string x264Line;
            string outputpath = "";

            Getx265Line(fileConfig, 1, out x264Line, out outputpath);
            string ffmpegline = Path.Combine(Application.StartupPath, FFmpegCommand.FFmpegExecute).Maohao() + FFmpegCommand.GetFfmpegArgs(fileConfig);
            var    bat        = ffmpegline + finalX265Path.Maohao() + " " + x264Line;
            //bat += "\r\npause";
            //processinfo.UseShellExecute = false;    //输出信息重定向
            //processinfo.CreateNoWindow = true;
            //processinfo.RedirectStandardInput = true;
            //processinfo.RedirectStandardOutput = true;
            //processinfo.RedirectStandardError = false;
            //processinfo.WindowStyle = ProcessWindowStyle.Hidden;
            Process avsx264mod = new Process();

            if (vedioConfig.BitType == EncoderBitrateType.crf)
            {
                ProcessCmd.RunBat(bat, Config.Temp);
            }
            else if (vedioConfig.BitType == EncoderBitrateType.twopass)
            {
                Getx265Line(fileConfig, 1, out x264Line, out outputpath);
                var bat1 = ffmpegline + finalX265Path + " " + x264Line + " -";
                ProcessCmd.RunBat(bat1, Config.Temp);

                Getx265Line(fileConfig, 2, out x264Line, out outputpath);
                var bat2 = ffmpegline + finalX265Path + " " + x264Line + " -";
                ProcessCmd.RunBat(bat2, Config.Temp);
            }

            avsx264mod.Dispose();
            return(outputpath);
        }
Пример #12
0
        public static string RunFFmpegToOpus(FileConfig fileConfig)
        {
            AudioConfig      audioConfig = fileConfig.AudioConfig;
            ProcessStartInfo processinfo = new ProcessStartInfo();
            string           tmp         = Config.Temp;
            string           audiofile   = FileUtility.RandomName(tmp) + ".opus";

            string bat = string.Empty;

            if (fileConfig.InputType == InputType.AvisynthScriptFile)
            {
                return(null);
            }
            else
            {
                bat = getAudioOpus(fileConfig.AudioInputFile, audiofile, audioConfig);
            }
            ProcessCmd.RunBat(bat, Config.Temp);

            return(audiofile);
        }
Пример #13
0
        public static string RunFFmpegToAAC(FileConfig fileConfig)
        {
            AudioConfig audioConfig = fileConfig.AudioConfig;
            string      tmp         = Config.Temp;
            string      audiofile   = FileUtility.RandomName(tmp) + ".aac";

            string bat = string.Empty;

            if (fileConfig.InputType == InputType.AvisynthScriptFile)
            {
                return(null);
            }
            else
            {
                bat = getAudiobat(fileConfig.AudioInputFile, audiofile, audioConfig);
            }

            ProcessCmd.RunBat(bat, Config.Temp);

            return(audiofile);
        }
Пример #14
0
        public static string ConvertAudioTOpus(FileConfig fileConfig)
        {
            AudioConfig audioConfig = fileConfig.AudioConfig;
            string      tmp         = Config.Temp;
            string      audiofile   = FileUtility.RandomName(tmp) + ".opus";
            int         bitrat      = 0;

            if (audioConfig.Quality < 1)
            {
                bitrat = (int)(audioConfig.Quality * 400);
            }
            else
            {
                bitrat = (int)audioConfig.Quality;
            }
            var    eac3to  = Path.Combine(Environment.CurrentDirectory, Eac3toExecute);
            var    opusenc = Path.Combine(Environment.CurrentDirectory, OpusEnc);
            string bat     = $"{eac3to.Maohao()} {fileConfig.VedioFileFullName.Maohao()}  {audioConfig.Tracker}: {audioConfig.CommandLineArgs} stdout.wav | {opusenc.Maohao()} --ignorelength --bitrate {bitrat} --vbr -  {audiofile.Maohao()}";

            ProcessCmd.RunBat(bat, Config.Temp);
            return(audiofile);
        }