Exemple #1
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);
        }
        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);
        }