Пример #1
0
        /// <summary>
        /// Perform the image conversion using FFmpeg.
        ///
        /// Assumes that a series of images are stored on local storage with file name format: Input%d.jpeg
        /// The output MP4 file is also written to local storage on success.
        /// </summary>
        private void RunConvert()
        {
            try
            {
                System.Diagnostics.Debug.WriteLine("Running FFmpeg...");

                var ffmpeg = new FFMPEGRuntime.FFMpeg(_logFilePath);

                // Create argument list and pass to ffmpeg
                var commands = GetCommands();
                var status   = ffmpeg.Run(commands);

                Dispatcher.BeginInvoke(
                    () =>
                {
                    var statusStr       = status == 0 ? "Success" : ("Failure (" + status + ")");
                    txtBlockAnswer.Text = "FFMPEG conversion status: " + statusStr;

                    if (status == 0)
                    {
                        System.Diagnostics.Debug.WriteLine("Successfully converted input using FFmpeg!");

                        PlayOutputVideo(_outputFilePath);
                    }
                    else
                    {
                        System.Diagnostics.Debug.WriteLine("Failed to converted input using FFmpeg.");
                    }
                });
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex);
            }
            finally
            {
                Dispatcher.BeginInvoke(() => btnSubmit.IsEnabled = true);
            }
        }
Пример #2
0
        /// <summary>
        /// Perform the image conversion using FFmpeg.
        /// 
        /// Assumes that a series of images are stored on local storage with file name format: Input%d.jpeg
        /// The output MP4 file is also written to local storage on success.
        /// </summary>
        private void RunConvert()
        {
            try
            {
                System.Diagnostics.Debug.WriteLine("Running FFmpeg...");

                var ffmpeg = new FFMPEGRuntime.FFMpeg(_logFilePath);

                // Create argument list and pass to ffmpeg
                var commands = GetCommands();
                var status = ffmpeg.Run(commands);

                Dispatcher.BeginInvoke(
                    () =>
                        {
                            var statusStr = status == 0 ? "Success" : ("Failure (" + status + ")");
                            txtBlockAnswer.Text = "FFMPEG conversion status: " + statusStr;

                            if (status == 0)
                            {
                                System.Diagnostics.Debug.WriteLine("Successfully converted input using FFmpeg!");

                                PlayOutputVideo(_outputFilePath);
                            }
                            else
                            {
                                System.Diagnostics.Debug.WriteLine("Failed to converted input using FFmpeg.");
                            }
                        });
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex);
            }
            finally
            {
                Dispatcher.BeginInvoke(() => btnSubmit.IsEnabled = true);
            }
        }