Esempio n. 1
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. 2
0
        /// <summary>
        ///     Debug Test Button
        /// </summary>
        private void btnDebugTest_Click(object sender, RoutedEventArgs e)
        {
            MainWindow mainwindow = (MainWindow)System.Windows.Application.Current.MainWindow;
            ViewModel  vm         = mainwindow.DataContext as ViewModel;

            // -------------------------
            // Clear Variables before Run
            // -------------------------
            MainWindow.ClearGlobalVariables(vm);

            // -------------------------
            // Batch Extention Period Check
            // -------------------------
            MainWindow.BatchExtCheck(vm);

            // -------------------------
            // Set FFprobe Path
            // -------------------------
            MainWindow.FFprobePath(vm);

            // -------------------------
            // Set youtube-dl Path
            // -------------------------
            MainWindow.youtubedlPath(vm);

            // -------------------------
            // Ready Halts
            // -------------------------
            if (MainWindow.ReadyHalts(vm) == true)
            {
                // -------------------------
                // Single
                // -------------------------
                if (vm.Batch_IsChecked == false)
                {
                    // -------------------------
                    // FFprobe Detect Metadata
                    // -------------------------
                    FFprobe.Metadata(vm);

                    // -------------------------
                    // FFmpeg Generate Arguments (Single)
                    // -------------------------
                    //disabled if batch
                    FFmpeg.FFmpegSingleGenerateArgs(vm);
                }

                // -------------------------
                // Batch
                // -------------------------
                else if (vm.Batch_IsChecked == true)
                {
                    // -------------------------
                    // FFprobe Video Entry Type Containers
                    // -------------------------
                    FFprobe.VideoEntryType(vm);

                    // -------------------------
                    // FFprobe Video Entry Type Containers
                    // -------------------------
                    FFprobe.AudioEntryType(vm);

                    // -------------------------
                    // FFmpeg Generate Arguments (Batch)
                    // -------------------------
                    //disabled if single file
                    FFmpeg.FFmpegBatchGenerateArgs(vm);
                }

                // -------------------------
                // Write Variables to Debug Window
                // -------------------------
                DebugWrite(this, vm);

                // -------------------------
                // Clear Variables for next Run
                // -------------------------
                MainWindow.ClearGlobalVariables(vm);
                GC.Collect();
            }
        }