Esempio n. 1
0
        /// <summary>
        ///     Video EQ (Method)
        /// <summary>
        public static void Video_EQ_Filter(MainWindow mainwindow)
        {
            if (mainwindow.slFiltersVideo_EQ_Brightness.Value != 0 ||
                mainwindow.slFiltersVideo_EQ_Contrast.Value != 0 ||
                mainwindow.slFiltersVideo_EQ_Saturation.Value != 0 ||
                mainwindow.slFiltersVideo_EQ_Gamma.Value != 0)
            {
                // EQ List
                List <string> vEQ_Filter_List = new List <string>()
                {
                    // EQ Brightness
                    VideoFilters.Video_EQ_Brightness_Filter(mainwindow),
                    // Contrast
                    VideoFilters.Video_EQ_Contrast_Filter(mainwindow),
                    // Struation
                    VideoFilters.Video_EQ_Saturation_Filter(mainwindow),
                    // Gamma
                    VideoFilters.Video_EQ_Gamma_Filter(mainwindow),
                };

                // Join
                string filters = string.Join("\r\n:", vEQ_Filter_List
                                             .Where(s => !string.IsNullOrEmpty(s)));

                // Combine
                vFiltersList.Add("eq=\r\n" + filters);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Video EQ (Method)
        /// <summary>
        public static void Video_EQ_Filter()
        {
            if (VM.FilterVideoView.FilterVideo_EQ_Brightness_Value != 0 ||
                VM.FilterVideoView.FilterVideo_EQ_Contrast_Value != 0 ||
                VM.FilterVideoView.FilterVideo_EQ_Saturation_Value != 0 ||
                VM.FilterVideoView.FilterVideo_EQ_Gamma_Value != 0)
            {
                // EQ List
                List <string> vEQ_Filter_List = new List <string>()
                {
                    // EQ Brightness
                    VideoFilters.Video_EQ_Brightness_Filter(),
                    // Contrast
                              VideoFilters.Video_EQ_Contrast_Filter(),
                    // Struation
                              VideoFilters.Video_EQ_Saturation_Filter(),
                    // Gamma
                              VideoFilters.Video_EQ_Gamma_Filter(),
                };

                // Join
                string filters = string.Join("\r\n:", vEQ_Filter_List
                                             .Where(s => !string.IsNullOrEmpty(s)));

                // Combine
                vFiltersList.Add("eq=\r\n" + filters);
            }
        }
Esempio n. 3
0
        public static string ffplay; // ffplay.exe

        /// <summary>
        ///     Preview FFplay
        /// </summary>
        public static void Preview(MainWindow mainwindow)
        {
            // -------------------------
            // Clear Variables before Run
            // -------------------------
            ffplay = string.Empty;
            MainWindow.ClearGlobalVariables();

            // Ignore if Batch
            if (VM.MainView.Batch_IsChecked == false)
            {
                // -------------------------
                // Set FFprobe Path
                // -------------------------
                MainWindow.FFplayPath();

                // -------------------------
                //  Arguments List
                // -------------------------
                List <string> FFplayArgsList = new List <string>()
                {
                    //ffplay,

                    "-i " + "\"" + MainWindow.InputPath(/*main_vm,*/ "pass 1") + "\"",

                    Subtitle.SubtitlesExternal(VM.SubtitleView.Subtitle_Codec_SelectedItem,
                                               VM.SubtitleView.Subtitle_Stream_SelectedItem
                                               ),

                    //Video.VideoCodec(),
                    //Video.Speed(mainwindow),
                    //Video.VideoQuality(mainwindow),
                    Video.FPS(//VM.FormatView.Format_MediaType_SelectedItem,
                        VM.VideoView.Video_Codec_SelectedItem,
                        //VM.VideoView.Video_Quality_SelectedItem,
                        VM.VideoView.Video_FPS_SelectedItem,
                        VM.VideoView.Video_FPS_Text
                        ),

                    VideoFilters.VideoFilter(),

                    Video.Images(VM.FormatView.Format_MediaType_SelectedItem,
                                 VM.VideoView.Video_Codec_SelectedItem //,
                                                                       //VM.VideoView.Video_Quality_SelectedItem
                                 ),
                    //Video.Optimize(mainwindow),
                    //Streams.VideoStreamMaps(mainwindow),

                    //Video.SubtitleCodec(mainwindow),
                    //"Streams.SubtitleMaps(mainwindow),

                    //Audio.AudioCodec(mainwindow),
                    //Audio.AudioQuality(mainwindow),
                    Audio.SampleRate(//VM.FormatView.Format_MediaType_SelectedItem,
                        VM.AudioView.Audio_Codec_SelectedItem,
                        //VM.AudioView.Audio_Stream_SelectedItem,
                        //VM.AudioView.Audio_Quality_SelectedItem,
                        //VM.AudioView.Audio_Channel_SelectedItem,
                        VM.AudioView.Audio_SampleRate_Items,
                        VM.AudioView.Audio_SampleRate_SelectedItem
                        ),

                    Audio.BitDepth(//VM.FormatView.Format_MediaType_SelectedItem,
                        VM.AudioView.Audio_Codec_SelectedItem,
                        //VM.AudioView.Audio_Stream_SelectedItem,
                        //VM.AudioView.Audio_Quality_SelectedItem,
                        VM.AudioView.Audio_BitDepth_Items,
                        VM.AudioView.Audio_BitDepth_SelectedItem
                        ),

                    Audio.Channel(//VM.FormatView.Format_MediaType_SelectedItem,
                        VM.AudioView.Audio_Codec_SelectedItem,
                        //VM.AudioView.Audio_Stream_SelectedItem,
                        //VM.AudioView.Audio_Quality_SelectedItem,
                        VM.AudioView.Audio_Channel_SelectedItem
                        ),

                    AudioFilters.AudioFilter(),
                    //Streams.AudioStreamMaps(mainwindow),

                    //Format.Cut(mainwindow),

                    //Streams.FormatMaps(mainwindow),

                    //Format.ForceFormat(mainwindow),

                    //MainWindow.ThreadDetect(mainwindow),

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


                // Join List with Spaces
                // Remove: Empty, Null, Standalone LineBreak
                string ffplayArgs = MainWindow.ReplaceLineBreaksWithSpaces(
                    string.Join(" ", FFplayArgsList)
                    );


                //MessageBox.Show(ffplayArgs); //debug


                // Start FFplay
                System.Diagnostics.Process.Start(
                    ffplay,
                    //"/c " //always close cmd
                    //FFmpeg.KeepWindow(mainwindow)
                    ffplayArgs
                    );
            }

            // Batch Warning
            else
            {
                MessageBox.Show("Cannot Preview Batch.",
                                "Notice",
                                MessageBoxButton.OK,
                                MessageBoxImage.Information);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Video Filter Combine (Method)
        /// <summary>
        public static String VideoFilter()
        {
            // Video BitRate None Check
            // Video Codec None Check
            // Codec Copy Check
            // Media Type Check
            if (VM.VideoView.Video_Quality_SelectedItem != "None" &&
                VM.VideoView.Video_Codec_SelectedItem != "None" &&
                VM.VideoView.Video_Codec_SelectedItem != "Copy" &&
                VM.FormatView.Format_MediaType_SelectedItem != "Audio")
            {
                // --------------------------------------------------
                // Add Each Filter to Master Filters List
                // --------------------------------------------------

                // -------------------------
                //  Speed
                // -------------------------
                Video.Speed(//VM.FormatView.Format_MediaType_SelectedItem,
                    VM.VideoView.Video_Codec_SelectedItem,
                    //VM.VideoView.Video_Quality_SelectedItem,
                    VM.VideoView.Video_Speed_SelectedItem,
                    VM.VideoView.Video_Speed_Text
                    );

                // -------------------------
                // Crop/Scale Switcher
                // -------------------------
                //  Scale is Custom width & height
                // -------------------------
                if ((VM.VideoView.Video_Codec_SelectedItem == "x264" ||
                     VM.VideoView.Video_Codec_SelectedItem == "x265" ||
                     VM.VideoView.Video_Codec_SelectedItem == "MPEG-2" ||
                     VM.VideoView.Video_Codec_SelectedItem == "MPEG-4")
                    &&
                    !string.Equals(VM.VideoView.Video_Width_Text, "auto", StringComparison.CurrentCultureIgnoreCase) &&
                    !string.Equals(VM.VideoView.Video_Height_Text, "auto", StringComparison.CurrentCultureIgnoreCase)// &&
                    //VM.VideoView.Video_CropClear_Text == "Clear"
                    )
                {
                    // -------------------------
                    //  Resize - Crop and Divisible Crop are added in the Video Scale() Method
                    // -------------------------
                    Video.Scale(VM.VideoView.Video_Codec_SelectedItem,
                                VM.VideoView.Video_Scale_SelectedItem,
                                VM.VideoView.Video_Width_Text,
                                VM.VideoView.Video_Height_Text,
                                VM.VideoView.Video_ScreenFormat_SelectedItem,
                                //VM.VideoView.Video_AspectRatio_SelectedItem,
                                VM.VideoView.Video_ScalingAlgorithm_SelectedItem,
                                VM.VideoView.Video_CropClear_Text
                                );
                }

                // -------------------------
                //  Scale is a Size Preset
                // -------------------------
                else
                {
                    // -------------------------
                    //  Crop (first)
                    // -------------------------
                    Video.Crop(MainWindow.cropwindow);

                    // -------------------------
                    //  Resize (second)
                    // -------------------------
                    Video.Scale(VM.VideoView.Video_Codec_SelectedItem,
                                VM.VideoView.Video_Scale_SelectedItem,
                                VM.VideoView.Video_Width_Text,
                                VM.VideoView.Video_Height_Text,
                                VM.VideoView.Video_ScreenFormat_SelectedItem,
                                //VM.VideoView.Video_AspectRatio_SelectedItem,
                                VM.VideoView.Video_ScalingAlgorithm_SelectedItem,
                                VM.VideoView.Video_CropClear_Text
                                );
                }

                // -------------------------
                // PNG to JPEG
                // -------------------------
                VideoFilters.PNGtoJPG_Filter();

                // -------------------------
                //    Subtitles Burn
                // -------------------------
                VideoFilters.SubtitlesBurn_Filter(/*mainwindow*/);

                // -------------------------
                //  Deband
                // -------------------------
                VideoFilters.Deband_Filter();

                // -------------------------
                //  Deshake
                // -------------------------
                VideoFilters.Deshake_Filter();

                // -------------------------
                //  Deflicker
                // -------------------------
                VideoFilters.Deflicker_Filter();

                // -------------------------
                //  Dejudder
                // -------------------------
                VideoFilters.Dejudder_Filter();

                // -------------------------
                //  Denoise
                // -------------------------
                VideoFilters.Denoise_Filter();

                // -------------------------
                //  Denoise
                // -------------------------
                VideoFilters.Deinterlace_Filter();

                // -------------------------
                //  EQ - Brightness, Contrast, Saturation, Gamma
                // -------------------------
                VideoFilters.Video_EQ_Filter();

                // -------------------------
                //  Selective SelectiveColorPreview
                // -------------------------
                VideoFilters.SelectiveColor_Filter();


                // -------------------------
                // Filter Combine
                // -------------------------
                if (VM.VideoView.Video_Codec_SelectedItem != "None") // None Check
                {
                    //System.Windows.MessageBox.Show(string.Join(",\r\n\r\n", vFiltersList.Where(s => !string.IsNullOrEmpty(s)))); //debug
                    //System.Windows.MessageBox.Show(Convert.ToString(vFiltersList.Count())); //debug

                    // -------------------------
                    // 1 Filter
                    // -------------------------
                    if (vFiltersList.Count == 1)
                    {
                        // Always wrap in quotes
                        vFilter = "-vf \"" + string.Join(", \r\n\r\n", vFiltersList
                                                         .Where(s => !string.IsNullOrEmpty(s)))
                                  + "\"";
                    }

                    // -------------------------
                    // Multiple Filters
                    // -------------------------
                    else if (vFiltersList.Count > 1)
                    {
                        // Always wrap in quotes
                        // Linebreak beginning and end
                        vFilter = "-vf \"\r\n" + string.Join(", \r\n\r\n", vFiltersList
                                                             .Where(s => !string.IsNullOrEmpty(s)))
                                  + "\r\n\"";
                    }

                    // -------------------------
                    // Empty
                    // -------------------------
                    else
                    {
                        vFilter = string.Empty;
                    }
                }

                // -------------------------
                // Video Codec None
                // -------------------------
                else
                {
                    vFilter = string.Empty;
                }
            }

            // Return Value
            return(vFilter);
        }
Esempio n. 5
0
        /// <summary>
        ///     Video Filter Combine (Method)
        /// <summary>
        public static String VideoFilter(MainWindow mainwindow)
        {
            // Video Bitrate None Check
            // Video Codec None Check
            // Codec Copy Check
            // Media Type Check
            if ((string)mainwindow.cboVideoQuality.SelectedItem != "None" &&
                (string)mainwindow.cboVideoCodec.SelectedItem != "None" &&
                (string)mainwindow.cboVideoCodec.SelectedItem != "Copy" &&
                (string)mainwindow.cboMediaType.SelectedItem != "Audio")
            {
                // --------------------------------------------------
                // Add Each Filter to Master Filters List
                // --------------------------------------------------

                // -------------------------
                //  Crop
                // -------------------------
                Video.Crop(mainwindow, Video.cropwindow);

                // -------------------------
                //  Resize
                // -------------------------
                Video.Size(mainwindow);


                // -------------------------
                // PNG to JPEG
                // -------------------------
                VideoFilters.PNGtoJPG_Filter(mainwindow);

                // -------------------------
                //    Subtitles Burn
                // -------------------------
                VideoFilters.SubtitlesBurn_Filter(mainwindow);

                // -------------------------
                //  Deband
                // -------------------------
                VideoFilters.Deband_Filter(/*mainwindow*/);

                // -------------------------
                //  Deshake
                // -------------------------
                VideoFilters.Deshake_Filter(mainwindow);

                // -------------------------
                //  Deflicker
                // -------------------------
                VideoFilters.Deflicker_Filter(mainwindow);

                // -------------------------
                //  Dejudder
                // -------------------------
                VideoFilters.Dejudder_Filter(mainwindow);

                // -------------------------
                //  Denoise
                // -------------------------
                VideoFilters.Denoise_Filter(mainwindow);

                // -------------------------
                //  EQ - Brightness, Contrast, Saturation, Gamma
                // -------------------------
                VideoFilters.Video_EQ_Filter(mainwindow);

                // -------------------------
                //  Selective SelectiveColorPreview
                // -------------------------
                VideoFilters.SelectiveColor_Filter(mainwindow);


                // -------------------------
                // Filter Combine
                // -------------------------
                if ((string)mainwindow.cboVideoCodec.SelectedItem != "None") // None Check
                {
                    //System.Windows.MessageBox.Show(string.Join(",\r\n\r\n", vFiltersList.Where(s => !string.IsNullOrEmpty(s)))); //debug
                    //System.Windows.MessageBox.Show(Convert.ToString(vFiltersList.Count())); //debug

                    // -------------------------
                    // 1 Filter
                    // -------------------------
                    if (vFiltersList.Count == 1)
                    {
                        // Always wrap in quotes
                        vFilter = "-vf \"" + string.Join(", \r\n\r\n", vFiltersList
                                                         .Where(s => !string.IsNullOrEmpty(s)))
                                  + "\"";
                    }

                    // -------------------------
                    // Multiple Filters
                    // -------------------------
                    else if (vFiltersList.Count > 1)
                    {
                        // Always wrap in quotes
                        // Linebreak beginning and end
                        vFilter = "-vf \"\r\n" + string.Join(", \r\n\r\n", vFiltersList
                                                             .Where(s => !string.IsNullOrEmpty(s)))
                                  + "\r\n\"";
                    }

                    // -------------------------
                    // Empty
                    // -------------------------
                    else
                    {
                        vFilter = string.Empty;
                    }
                }

                // -------------------------
                // Video Codec None
                // -------------------------
                else
                {
                    vFilter = string.Empty;
                }
            }

            // Return Value
            return(vFilter);
        }
Esempio n. 6
0
        public static string ffplay; // ffplay.exe

        /// <summary>
        ///     Preview FFplay
        /// </summary>
        public static void Preview(MainWindow mainwindow)
        {
            // -------------------------
            // Clear Variables before Run
            // -------------------------
            ffplay = string.Empty;
            MainWindow.ClearVariables(mainwindow);

            // Ignore if Batch
            if (mainwindow.tglBatch.IsChecked == false)
            {
                // -------------------------
                // Set FFprobe Path
                // -------------------------
                MainWindow.FFplayPath();

                // -------------------------
                //  Arguments List
                // -------------------------
                List <string> FFplayArgsList = new List <string>()
                {
                    //ffplay,

                    "-i " + "\"" + MainWindow.InputPath(mainwindow) + "\"",

                    Video.Subtitles(mainwindow),

                    //Video.VideoCodec(),
                    //Video.Speed(mainwindow),
                    //Video.VideoQuality(mainwindow),
                    Video.FPS(mainwindow),
                    VideoFilters.VideoFilter(mainwindow),
                    Video.ScalingAlgorithm(mainwindow),
                    Video.Images(mainwindow),
                    //Video.Optimize(mainwindow),
                    //Streams.VideoStreamMaps(mainwindow),

                    //Video.SubtitleCodec(mainwindow),
                    //"Streams.SubtitleMaps(mainwindow),

                    //Audio.AudioCodec(mainwindow),
                    //Audio.AudioQuality(mainwindow),
                    Audio.SampleRate(mainwindow),
                    Audio.BitDepth(mainwindow),
                    Audio.Channel(mainwindow),
                    AudioFilters.AudioFilter(mainwindow),
                    //Streams.AudioStreamMaps(mainwindow),

                    //Format.Cut(mainwindow),

                    //Streams.FormatMaps(mainwindow),

                    //Format.ForceFormat(mainwindow),

                    //MainWindow.ThreadDetect(mainwindow),

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


                // Join List with Spaces
                // Remove: Empty, Null, Standalone LineBreak
                string ffplayArgs = MainWindow.ReplaceLineBreaksWithSpaces(
                    string.Join(" ", FFplayArgsList)
                    );

                //string ffplayArgs = string.Join(" ", FFplayArgsList
                //                          .Where(s => !string.IsNullOrEmpty(s)))
                //                          .Replace("\r\n", " ") //Remove Linebreaks
                //                          .Replace(Environment.NewLine, " ");


                //MessageBox.Show(ffplayArgs); //debug


                // Start FFplay
                System.Diagnostics.Process.Start(
                    ffplay,
                    //"/c " //always close cmd
                    //FFmpeg.KeepWindow(mainwindow)
                    ffplayArgs
                    );
            }

            // Batch Warning
            else
            {
                MessageBox.Show("Cannot Preview Batch.",
                                "Notice",
                                MessageBoxButton.OK,
                                MessageBoxImage.Information);
            }
        }
Esempio n. 7
0
        /// <summary>
        ///     Video Filter Combine (Method)
        /// <summary>
        public static String VideoFilter(ViewModel vm)
        {
            // Video BitRate None Check
            // Video Codec None Check
            // Codec Copy Check
            // Media Type Check
            if (vm.Video_Quality_SelectedItem != "None" &&
                vm.Video_Codec_SelectedItem != "None" &&
                vm.Video_Codec_SelectedItem != "Copy" &&
                vm.Format_MediaType_SelectedItem != "Audio")
            {
                // --------------------------------------------------
                // Add Each Filter to Master Filters List
                // --------------------------------------------------

                // -------------------------
                //  Speed
                // -------------------------
                Video.Speed(//vm.Format_MediaType_SelectedItem,
                    vm.Video_Codec_SelectedItem,
                    //vm.Video_Quality_SelectedItem,
                    vm.Video_Speed_SelectedItem,
                    vm.Video_Speed_Text
                    );

                // -------------------------
                //  Crop
                // -------------------------
                Video.Crop(MainWindow.cropwindow, vm);

                // -------------------------
                //  Resize
                // -------------------------
                Video.Scale(vm.Video_Codec_SelectedItem,
                            vm.Video_Scale_SelectedItem,
                            vm.Video_Width_Text,
                            vm.Video_Height_Text,
                            vm._Video_ScreenFormat_SelectedItem,
                            //vm.Video_AspectRatio_SelectedItem,
                            vm.Video_ScalingAlgorithm_SelectedItem,
                            vm.Video_CropClear_Text
                            );

                // -------------------------
                // PNG to JPEG
                // -------------------------
                VideoFilters.PNGtoJPG_Filter(vm);

                // -------------------------
                //    Subtitles Burn
                // -------------------------
                VideoFilters.SubtitlesBurn_Filter(/*mainwindow*/ vm);

                // -------------------------
                //  Deband
                // -------------------------
                VideoFilters.Deband_Filter(vm);

                // -------------------------
                //  Deshake
                // -------------------------
                VideoFilters.Deshake_Filter(vm);

                // -------------------------
                //  Deflicker
                // -------------------------
                VideoFilters.Deflicker_Filter(vm);

                // -------------------------
                //  Dejudder
                // -------------------------
                VideoFilters.Dejudder_Filter(vm);

                // -------------------------
                //  Denoise
                // -------------------------
                VideoFilters.Denoise_Filter(vm);

                // -------------------------
                //  Denoise
                // -------------------------
                VideoFilters.Deinterlace_Filter(vm);

                // -------------------------
                //  EQ - Brightness, Contrast, Saturation, Gamma
                // -------------------------
                VideoFilters.Video_EQ_Filter(vm);

                // -------------------------
                //  Selective SelectiveColorPreview
                // -------------------------
                VideoFilters.SelectiveColor_Filter(vm);


                // -------------------------
                // Filter Combine
                // -------------------------
                if (vm.Video_Codec_SelectedItem != "None") // None Check
                {
                    //System.Windows.MessageBox.Show(string.Join(",\r\n\r\n", vFiltersList.Where(s => !string.IsNullOrEmpty(s)))); //debug
                    //System.Windows.MessageBox.Show(Convert.ToString(vFiltersList.Count())); //debug

                    // -------------------------
                    // 1 Filter
                    // -------------------------
                    if (vFiltersList.Count == 1)
                    {
                        // Always wrap in quotes
                        vFilter = "-vf \"" + string.Join(", \r\n\r\n", vFiltersList
                                                         .Where(s => !string.IsNullOrEmpty(s)))
                                  + "\"";
                    }

                    // -------------------------
                    // Multiple Filters
                    // -------------------------
                    else if (vFiltersList.Count > 1)
                    {
                        // Always wrap in quotes
                        // Linebreak beginning and end
                        vFilter = "-vf \"\r\n" + string.Join(", \r\n\r\n", vFiltersList
                                                             .Where(s => !string.IsNullOrEmpty(s)))
                                  + "\r\n\"";
                    }

                    // -------------------------
                    // Empty
                    // -------------------------
                    else
                    {
                        vFilter = string.Empty;
                    }
                }

                // -------------------------
                // Video Codec None
                // -------------------------
                else
                {
                    vFilter = string.Empty;
                }
            }

            // Return Value
            return(vFilter);
        }
Esempio n. 8
0
        /// <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" + 
                    "-i "+ "\"" + MainWindow.InputPath(mainwindow) + "\"",

                    "\r\n\r\n" + 
                    Video.Subtitles(mainwindow),

                    "\r\n\r\n" + 
                    Video.VideoCodec(mainwindow),
                    "\r\n" + 
                    Video.Speed(mainwindow, "pass single"),
                    Video.VideoQuality(mainwindow),
                    "\r\n" + 
                    Video.FPS(mainwindow),
                    "\r\n" + 
                    VideoFilters.VideoFilter(mainwindow),
                    "\r\n" + 
                    Video.ScalingAlgorithm(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" +
                    AudioFilters.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" + 
                    Format.ForceFormat(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(Environment.NewLine))
                                                    .Where(s => !s.Equals("\r\n\r\n"))
                                                    .Where(s => !s.Equals("\r\n"))
                                              );
            }


            // Return Value
            return Video.passSingle;
        }
Esempio n. 9
0
        /// <summary>
        /// Batch 2Pass Args
        /// </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" + 
                    "-i "+ "\"" + 
                    MainWindow.InputPath(mainwindow) + "\"",

                    //"\r\n\r\n" + 
                    //Video.Subtitles(mainwindow),

                    "\r\n\r\n" + 
                    Video.VideoCodec(mainwindow),
                    "\r\n" +
                    Video.Speed(mainwindow, "pass 1"),
                    Video.VideoQuality(mainwindow),
                    "\r\n" + 
                    Video.FPS(mainwindow),
                    "\r\n" + 
                    VideoFilters.VideoFilter(mainwindow),
                    "\r\n" + 
                    Video.ScalingAlgorithm(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(Environment.NewLine))
                                                   .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(),
                    "-y",

                    "\r\n\r\n" + 
                    Video.HWAcceleration(mainwindow),

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

                    "\r\n\r\n" +
                    Video.Subtitles(mainwindow),

                    "\r\n\r\n" + 
                    Video.vCodec,
                    "\r\n" + 
                    Video.Speed(mainwindow, "pass 2"),
                    Video.vQuality,
                    "\r\n" + 
                    Video.fps,
                    "\r\n" + 
                    VideoFilters.vFilter,
                    "\r\n" + 
                    Video.ScalingAlgorithm(mainwindow),
                    "\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" +
                    AudioFilters.AudioFilter(mainwindow),
                    "\r\n" + 
                    Streams.AudioStreamMaps(mainwindow),

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

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

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

                    "\r\n\r\n" + 
                    Configure.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(Environment.NewLine))
                                                   .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;
        }