예제 #1
0
파일: FFmpeg.cs 프로젝트: jmzhuang/Axiom
        /// <summary>
        /// OnePassArgs
        /// </summary>
        // 1-Pass, CRF, & Auto
        public static String OnePassArgs(MainWindow mainwindow)
        {
            // -------------------------
            //  Single Pass
            // -------------------------
            if ((string)mainwindow.cboPass.SelectedItem == "1 Pass" ||
                (string)mainwindow.cboPass.SelectedItem == "CRF" ||
                (string)mainwindow.cboPass.SelectedItem == "auto" ||
                (string)mainwindow.cboFormat.SelectedItem == "ogv"    //ogv (special rule)
                )
            {
                // -------------------------
                //  Arguments List
                // -------------------------
                List <string> FFmpegArgsSinglePassList = new List <string>()
                {
                    "\r\n\r\n" + "\"" + MainWindow.InputPath(mainwindow) + "\"",

                    "\r\n\r\n" + Video.VideoCodec(mainwindow),
                    "\r\n" + Video.Speed(mainwindow),
                    Video.VideoQuality(mainwindow),
                    "\r\n" + Video.FPS(mainwindow),
                    "\r\n" + Video.VideoFilter(mainwindow),
                    "\r\n" + Video.Images(mainwindow),
                    "\r\n" + Video.Optimize(mainwindow),
                    "\r\n" + Streams.VideoStreamMaps(mainwindow),

                    "\r\n\r\n" + Video.SubtitleCodec(mainwindow),
                    "\r\n" + Streams.SubtitleMaps(mainwindow),

                    "\r\n\r\n" + Audio.AudioCodec(mainwindow),
                    "\r\n" + Audio.AudioQuality(mainwindow),
                    Audio.SampleRate(mainwindow),
                    Audio.BitDepth(mainwindow),
                    Audio.Channel(mainwindow),
                    "\r\n" + Audio.AudioFilter(mainwindow),
                    "\r\n" + Streams.AudioStreamMaps(mainwindow),

                    "\r\n\r\n" + Format.Cut(mainwindow),

                    "\r\n\r\n" + Streams.FormatMaps(mainwindow),

                    "\r\n\r\n" + MainWindow.ThreadDetect(mainwindow),

                    "\r\n\r\n" + "\"" + MainWindow.OutputPath(mainwindow) + "\""
                };

                // Join List with Spaces
                // Remove: Empty, Null, Standalone LineBreak
                Video.passSingle = string.Join(" ",
                                               FFmpegArgsSinglePassList
                                               .Where(s => !string.IsNullOrEmpty(s))
                                               .Where(s => !s.Equals("\r\n\r\n"))
                                               .Where(s => !s.Equals("\r\n"))
                                               );
            }


            // Return Value
            return(Video.passSingle);
        }
예제 #2
0
파일: FFmpeg.cs 프로젝트: jmzhuang/Axiom
        /// <summary>
        /// Batch2PassArgs
        /// </summary>

        public static String TwoPassArgs(MainWindow mainwindow)
        {
            // -------------------------
            //  2-Pass Auto Quality
            // -------------------------
            // Enabled
            //
            if ((string)mainwindow.cboPass.SelectedItem == "2 Pass" &&
                (string)mainwindow.cboMediaType.SelectedItem == "Video" && //video only
                (string)mainwindow.cboVideoCodec.SelectedItem != "Copy" && //exclude copy
                (string)mainwindow.cboFormat.SelectedItem != "ogv"    //exclude ogv (special rule)
                )
            {
                // -------------------------
                // Pass 1
                // -------------------------
                List <string> FFmpegArgsPass1List = new List <string>()
                {
                    "\r\n\r\n" + "\"" + MainWindow.InputPath(mainwindow) + "\"",

                    "\r\n\r\n" + Video.VideoCodec(mainwindow),
                    "\r\n" + Video.Speed(mainwindow),
                    Video.VideoQuality(mainwindow),
                    "\r\n" + Video.FPS(mainwindow),
                    "\r\n" + Video.VideoFilter(mainwindow),
                    "\r\n" + Video.Images(mainwindow),
                    "\r\n" + Video.Optimize(mainwindow),
                    "\r\n" + Video.Pass1Modifier(mainwindow), // -pass 1, -x265-params pass=2

                    "\r\n\r\n" + "-sn -an",                   // Disable Audio & Subtitles for Pass 1 to speed up encoding

                    "\r\n\r\n" + Format.Cut(mainwindow),
                    "\r\n\r\n" + Format.ForceFormat(mainwindow),
                    "\r\n\r\n" + MainWindow.ThreadDetect(mainwindow),

                    //"\r\n\r\n" + "\"" + MainWindow.OutputPath(mainwindow) + "\""
                    "\r\n\r\n" + "NUL"
                };

                // Join List with Spaces
                // Remove: Empty, Null, Standalone LineBreak
                Video.pass1Args = string.Join(" ", FFmpegArgsPass1List
                                              .Where(s => !string.IsNullOrEmpty(s))
                                              .Where(s => !s.Equals("\r\n\r\n"))
                                              .Where(s => !s.Equals("\r\n"))
                                              );


                // -------------------------
                // Pass 2
                // -------------------------
                List <string> FFmpegArgsPass2List = new List <string>()
                {
                    // Video Methods have already defined Global Strings in Pass 1
                    // Use Strings instead of Methods
                    //
                    "\r\n\r\n" + "&&",
                    "\r\n\r\n" + MainWindow.FFmpegPath(mainwindow),
                    "-y",
                    "-i",

                    "\r\n\r\n" + "\"" + MainWindow.InputPath(mainwindow) + "\"",

                    "\r\n\r\n" + Video.vCodec,
                    "\r\n" + Video.speed,
                    Video.vQuality,
                    "\r\n" + Video.fps,
                    "\r\n" + Video.vFilter,
                    "\r\n" + Video.image,
                    "\r\n" + Video.optimize,
                    "\r\n" + Streams.VideoStreamMaps(mainwindow),
                    "\r\n" + Video.Pass2Modifier(mainwindow),     // -pass 2, -x265-params pass=2

                    "\r\n\r\n" + Video.SubtitleCodec(mainwindow),
                    "\r\n" + Streams.SubtitleMaps(mainwindow),

                    "\r\n\r\n" + Audio.AudioCodec(mainwindow),
                    "\r\n" + Audio.AudioQuality(mainwindow),
                    Audio.SampleRate(mainwindow),
                    Audio.BitDepth(mainwindow),
                    Audio.Channel(mainwindow),
                    "\r\n" + Audio.AudioFilter(mainwindow),
                    "\r\n" + Streams.AudioStreamMaps(mainwindow),

                    "\r\n\r\n" + Format.trim,

                    "\r\n\r\n" + Streams.FormatMaps(mainwindow),

                    "\r\n\r\n" + MainWindow.threads,

                    "\r\n\r\n" + "\"" + MainWindow.OutputPath(mainwindow) + "\""
                };

                // Join List with Spaces
                // Remove: Empty, Null, Standalone LineBreak
                Video.pass2Args = string.Join(" ", FFmpegArgsPass2List
                                              .Where(s => !string.IsNullOrEmpty(s))
                                              .Where(s => !s.Equals("\r\n\r\n"))
                                              .Where(s => !s.Equals("\r\n"))
                                              );

                // Combine Pass 1 & Pass 2 Args
                //
                Video.v2PassArgs = Video.pass1Args + " " + Video.pass2Args;
            }


            // Return Value
            return(Video.v2PassArgs);
        }