コード例 #1
0
ファイル: FFplay.cs プロジェクト: Frixuu/axiom
        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);
            }
        }
コード例 #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);
        }
コード例 #3
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);
        }
コード例 #4
0
ファイル: FFplay.cs プロジェクト: orf53975/Axiom
        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);
            }
        }