コード例 #1
0
ファイル: TaskHelpers.cs プロジェクト: RavenZZ/ShareX
        public static bool CheckFFmpeg(TaskSettings taskSettings)
        {
            string ffmpegPath = taskSettings.CaptureSettings.FFmpegOptions.FFmpegPath;

            if (string.IsNullOrEmpty(ffmpegPath))
            {
                ffmpegPath = Program.DefaultFFmpegFilePath;
            }

            if (!File.Exists(ffmpegPath))
            {
                if (MessageBox.Show(string.Format(Resources.ScreenRecordForm_StartRecording_does_not_exist, ffmpegPath),
                                    "ShareX - " + Resources.ScreenRecordForm_StartRecording_Missing + " ffmpeg.exe", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                {
                    if (FFmpegDownloader.DownloadFFmpeg(false, DownloaderForm_InstallRequested) == DialogResult.OK)
                    {
                        Program.DefaultTaskSettings.CaptureSettings.FFmpegOptions.CLIPath = taskSettings.TaskSettingsReference.CaptureSettings.FFmpegOptions.CLIPath =
                            taskSettings.CaptureSettings.FFmpegOptions.CLIPath            = Program.DefaultFFmpegFilePath;

#if STEAM
                        Program.DefaultTaskSettings.CaptureSettings.FFmpegOptions.OverrideCLIPath = taskSettings.TaskSettingsReference.CaptureSettings.FFmpegOptions.OverrideCLIPath =
                            taskSettings.CaptureSettings.FFmpegOptions.OverrideCLIPath            = true;
#endif
                    }
                }
                else
                {
                    return(false);
                }
            }

            return(true);
        }
コード例 #2
0
        private async Task Convert()
        {
            DialogResult result     = dialogSaveOutput.ShowDialog();
            string       outputPath = "";

            if (result == DialogResult.OK)
            {
                outputPath = dialogSaveOutput.FileName;
            }
            else
            {
                return;
            }

            txtOutput.Text       = "";
            prgProgressBar.Value = 0;

            string audio = dialogOpenAudioFile.FileName;
            string image = dialogOpenCoverArt.FileName;

            await FFmpegDownloader.GetLatestVersion(FFmpegVersion.Official);

            // FFMpeg arguments based on this answer
            // https://superuser.com/a/1041818
            IConversion conversion = FFmpeg.Conversions.New();

            conversion
            .SetOutput(outputPath)
            .SetOverwriteOutput(true)
            .AddParameter("-loop 1")
            .AddParameter("-y")
            .AddParameter($"-i {image}")
            .AddParameter($"-i {audio}")
            .AddParameter("-shortest")
            .AddParameter("-framerate 2")
            .AddParameter("-acodec copy")
            .AddParameter("-vcodec mjpeg")
            .AddParameter("-preset ultrafast");

            string ffmpegParams = conversion.Build();

            txtOutput.AppendText($"ffmpeg {ffmpegParams}{Environment.NewLine}");

            conversion.OnDataReceived += Conversion_OnDataReceived;
            conversion.OnProgress     += Conversion_OnProgress;

            try
            {
                _state         = State.Converting;
                btnCreate.Text = Language.Stop;
                IConversionResult conversionResult = await conversion.Start(_cts.Token);
            }
            catch (OperationCanceledException) { }
            catch (Exception ex)
            {
                _state         = State.Ready;
                btnCreate.Text = Language.Convert;
                txtOutput.AppendText(Environment.NewLine + Environment.NewLine + ex.Message);
            }
        }
コード例 #3
0
        internal async Task DownloadLatestVersionTest(OperatingSystem os)
        {
            var operatingSystemProvider = Substitute.For <IOperatingSystemProvider>();

            operatingSystemProvider.GetOperatingSystem().Returns(x => os);

            var linkProvider          = new LinkProvider(operatingSystemProvider);
            var ffmpegExecutablesPath = FFmpeg.ExecutablesPath;

            try
            {
                FFbinariesVersionInfo currentVersion = JsonConvert.DeserializeObject <FFbinariesVersionInfo>(File.ReadAllText(Resources.FFbinariesInfo));
                FFmpeg.ExecutablesPath = "assemblies";
                if (Directory.Exists("assemblies"))
                {
                    Directory.Delete("assemblies", true);
                }

                FFmpegDownloader._linkProvider = linkProvider;
                await FFmpegDownloader.DownloadLatestVersion(currentVersion).ConfigureAwait(false);

                Assert.True(File.Exists(FFmpegDownloader.ComputeFileDestinationPath("ffmpeg", os)));
                Assert.True(File.Exists(FFmpegDownloader.ComputeFileDestinationPath("ffprobe", os)));
            }
            finally
            {
                FFmpeg.ExecutablesPath = ffmpegExecutablesPath;
            }
        }
コード例 #4
0
ファイル: Form1.cs プロジェクト: YacovGold/FastAudioExtractor
        private async void btn_analyze_Click(object sender, EventArgs e)
        {
            Settings.Default.LastFolder = tb_dir.Text;
            Settings.Default.Save();

            btn_extract.Enabled = false;

            await FFmpegDownloader.GetLatestVersion(FFmpegVersion.Full);

            var extenssions = new List <string> {
                ".mov", "mp4"
            };

            var files = Directory.EnumerateFiles(tb_dir.Text)
                        .Where(v => extenssions.Any(x => v.ToLower().EndsWith(x)));

            foreach (var file in files)
            {
                var audioStream = (await FFmpeg.GetMediaInfo(file))
                                  .AudioStreams.FirstOrDefault();

                var codec = "Unknown";
                if (audioStream != null)
                {
                    codec = audioStream.Codec;
                }

                var lvi = new ListViewItem(new string[] { file, codec });
                lv.Items.Add(lvi);
            }

            btn_extract.Enabled = true;
        }
コード例 #5
0
        // Points the FFmpeg library to the right executables
        public static void SetFFMpegPath()
        {
            FFmpeg.SetExecutablesPath(FFMPEG_PATH);
#if DEBUG
            // Automatically downloads FFmpeg useful for development
            FFmpegDownloader.GetLatestVersion(FFmpegVersion.Official, FFmpeg.ExecutablesPath);
#endif
        }
コード例 #6
0
 private async void Window_Loaded(object sender, RoutedEventArgs e)
 {
     Main.Content = pageVodDownload;
     if (!File.Exists("ffmpeg.exe"))
     {
         await FFmpegDownloader.GetLatestVersion(FFmpegVersion.Full);
     }
 }
コード例 #7
0
        static void Main(string[] args)
        {
            if (args.Any(x => x.Equals("--download-ffmpeg")))
            {
                Console.WriteLine("[INFO] - Downloading ffmpeg and exiting");
                if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
                {
                    FFmpegDownloader.GetLatestVersion(FFmpegVersion.Official).Wait();
                    try
                    {
                        var filePermissions = new Mono.Unix.UnixFileInfo("ffmpeg");
                        filePermissions.FileAccessPermissions = FileAccessPermissions.UserRead | FileAccessPermissions.UserWrite | FileAccessPermissions.GroupRead | FileAccessPermissions.OtherRead | FileAccessPermissions.UserExecute | FileAccessPermissions.GroupExecute | FileAccessPermissions.OtherExecute;
                        filePermissions.Refresh();
                    }
                    catch { }
                }
                else
                {
                    FFmpegDownloader.GetLatestVersion(FFmpegVersion.Full).Wait();
                }
                Environment.Exit(1);
            }

            Options inputOptions  = new Options();
            var     optionsResult = Parser.Default.ParseArguments <Options>(args).WithParsed(r => { inputOptions = r; });

            if (optionsResult.Tag == ParserResultType.NotParsed)
            {
                Environment.Exit(1);
            }


            if (!File.Exists(ffmpegPath) && (inputOptions.FfmpegPath == null || !File.Exists(inputOptions.FfmpegPath)) && !ExistsOnPath(ffmpegPath))
            {
                Console.WriteLine("[ERROR] - Unable to find ffmpeg, exiting. You can download ffmpeg automatically with the argument --download-ffmpeg");
                Environment.Exit(1);
            }

            switch (inputOptions.RunMode)
            {
            case RunMode.VideoDownload:
                DownloadVideo(inputOptions);
                break;

            case RunMode.ClipDownload:
                DownloadClip(inputOptions);
                break;

            case RunMode.ChatDownload:
                DownloadChat(inputOptions);
                break;

            case RunMode.ChatRender:
                RenderChat(inputOptions);
                break;
            }
        }
コード例 #8
0
        static void Main()
        {
            FFmpegDownloader.GetLatestVersion(FFmpegVersion.Official).Wait(); //TODO: wrap this into a splash or so

            Application.SetHighDpiMode(HighDpiMode.SystemAware);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new FrmStart());
        }
コード例 #9
0
ファイル: MainWindow.xaml.cs プロジェクト: hanfeijp/Captura
        public MainWindow()
        {
            Instance = this;
            
            FFmpegService.FFmpegDownloader += () =>
            {
                if (_downloader == null)
                {
                    _downloader = new FFmpegDownloader();
                    _downloader.Closed += (Sender, Args) => _downloader = null;
                }

                _downloader.ShowAndFocus();
            };
            
            InitializeComponent();

            if (DataContext is MainViewModel vm)
            {
                vm.Init(!App.CmdOptions.NoPersist, true, !App.CmdOptions.Reset, !App.CmdOptions.NoHotkeys);

                // Register for Windows Messages
                ComponentDispatcher.ThreadPreprocessMessage += (ref MSG Message, ref bool Handled) =>
                {
                    const int wmHotkey = 786;

                    if (Message.message == wmHotkey)
                    {
                        var id = Message.wParam.ToInt32();

                        vm.HotKeyManager.ProcessHotkey(id);
                    }
                };

                Loaded += (Sender, Args) =>
                {
                    RepositionWindowIfOutside();

                    vm.HotKeyManager.ShowNotRegisteredOnStartup();

                    if (vm.AudioSource is NoAudioSource)
                    {
                        ServiceProvider.MessageProvider.ShowError(
                            "Could not find bass.dll or bassmix.dll.\nAudio Recording will not be available.", "No Audio");
                    }
                };
            }

            if (App.CmdOptions.Tray || ServiceProvider.Get<Settings>().UI.MinToTrayOnStartup)
                Hide();

            Closing += (Sender, Args) =>
            {
                if (!TryExit())
                    Args.Cancel = true;
            };
        }
コード例 #10
0
 private async void Window_Loaded(object sender, RoutedEventArgs e)
 {
     Main.Content = pageChatRender;
     Settings.Default.Upgrade();
     Settings.Default.Save();
     if (!File.Exists("ffmpeg.exe"))
     {
         await FFmpegDownloader.GetLatestVersion(FFmpegVersion.Full);
     }
 }
コード例 #11
0
 public static void GetPrerequisite()
 {
     // Downloads FFMPEG if it's not already there.
     if (!File.Exists(ffmpegLocation))
     {
         FFmpegDownloader.GetLatestVersion(FFmpegVersion.Official, $@"{Directory.GetCurrentDirectory()}\ressources\");
     }
     // Creates temp folder just in case.
     Directory.CreateDirectory(Path.GetDirectoryName(concatFileLocation));
 }
コード例 #12
0
        public MusicManager()
        {
            _ytClient = new YoutubeClient();

            FFmpegDownloader.GetLatestVersion(FFmpegVersion.Official).Wait();

            if (Directory.Exists(_tmpDir))
            {
                Directory.Delete(_tmpDir, true);
            }
        }
コード例 #13
0
        private async void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Main.Content = pageVodDownload;
            Settings.Default.Upgrade();
            Settings.Default.Save();
            if (!File.Exists("ffmpeg.exe"))
            {
                await FFmpegDownloader.GetLatestVersion(FFmpegVersion.Full);
            }

            AutoUpdater.Start("https://downloader-update.twitcharchives.workers.dev");
        }
コード例 #14
0
ファイル: TaskHelpers.cs プロジェクト: RavenZZ/ShareX
        private static void DownloaderForm_InstallRequested(string filePath)
        {
            bool result = FFmpegDownloader.ExtractFFmpeg(filePath, Program.DefaultFFmpegFilePath);

            if (result)
            {
                MessageBox.Show(Resources.ScreenRecordForm_DownloaderForm_InstallRequested_FFmpeg_successfully_downloaded_, "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show(Resources.ScreenRecordForm_DownloaderForm_InstallRequested_Download_of_FFmpeg_failed_, "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #15
0
        private async void CheckFFmpeg()
        {
            if (!File.Exists("ffmpeg.exe") || !File.Exists("ffprobe.exe"))
            {
                buttonOpenFile.Enabled = false;
                LogToConsole("FFmpeg doesn't exist.");
                LogToConsole("Downloading FFmpeg...");
                await FFmpegDownloader.GetLatestVersion(FFmpegVersion.Official);

                LogToConsole("FFmpeg downloaded.");
                buttonOpenFile.Enabled = true;
            }
        }
コード例 #16
0
ファイル: TaskHelpers.cs プロジェクト: KoMiI/ShareX
        private static void DownloaderForm_InstallRequested(string filePath)
        {
            string extractPath = Path.Combine(Program.ToolsFolder, "ffmpeg.exe");
            bool   result      = FFmpegDownloader.ExtractFFmpeg(filePath, extractPath);

            if (result)
            {
                MessageBox.Show(Resources.ScreenRecordForm_DownloaderForm_InstallRequested_FFmpeg_successfully_downloaded_, "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show(Resources.ScreenRecordForm_DownloaderForm_InstallRequested_Download_of_FFmpeg_failed_, "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #17
0
        private static async Task <int> Main(string[] args)
        {
            Flags = CommandLineFlags.ParseFlags <SubSplitFlags>(args);

            if (Flags == null)
            {
                return(1);
            }

            if (!File.Exists(Flags.InputFile))
            {
                Logger.Error("Program", "Input file does not exist");
                return(4);
            }

            Logger.Info("Program", "Downloading ffmpeg");

            await FFmpegDownloader.GetLatestVersion(FFmpegVersion.Official);

            var probe = await FFmpeg.GetMediaInfo(Flags.InputFile);

            if (probe == null)
            {
                Logger.Error("FFmpeg", "Can't probe media file");
                return(2);
            }

            if (!File.Exists(Flags.PrimarySubtitleFile))
            {
                Logger.Error("Program", "Subtitle file missing");
                return(5);
            }

            var subtitles = SubtitleFile.GetSubtitles(await File.ReadAllLinesAsync(Flags.PrimarySubtitleFile), out var subtitleLeadIn);

            if (!File.Exists(Flags.OverrideSubtitleFile))
            {
                if (!string.IsNullOrEmpty(Flags.OverrideSubtitleFile))
                {
                    Logger.Warn("Program", "Override Subtitle File does not exist");
                }
            }
            else
            {
                subtitles = SubtitleFile.GetSubtitles(await File.ReadAllLinesAsync(Flags.OverrideSubtitleFile), out subtitleLeadIn).Select((t, index) => subtitles.ElementAt(index) with
                {
                    Text         = t.Text,
                    OriginalText = t.OriginalText
                }).ToList();
コード例 #18
0
        internal static async Task Run()
        {
            Console.Out.WriteLine("[Start] Basic Conversion");
            FileInfo fileToConvert = GetFilesToConvert(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)).First();

            //Set directory where app should look for FFmpeg executables.
            FFmpeg.SetExecutablesPath(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location));
            //Get latest version of FFmpeg. It's great idea if you don't know if you had installed FFmpeg.
            await FFmpegDownloader.GetLatestVersion(FFmpegVersion.Official);

            //Run conversion
            await RunConversion(fileToConvert);

            Console.Out.WriteLine("[End] Basic Conversion");
        }
コード例 #19
0
        public override async Task Initialize()
        {
            //download ffmpeg here
            string tempFFmpegFolder = Path.Combine(Path.GetTempPath(), "ffmpeg");

            if (!Directory.Exists(tempFFmpegFolder))
            {
                Directory.CreateDirectory(tempFFmpegFolder);
                Console.WriteLine($"Created directory {tempFFmpegFolder}");
            }

            FFmpeg.SetExecutablesPath(tempFFmpegFolder);

            await FFmpegDownloader.GetLatestVersion(FFmpegVersion.Official, FFmpeg.ExecutablesPath, this);
        }
コード例 #20
0
ファイル: BasicConversion.cs プロジェクト: yyalon/Xabe.FFmpeg
        internal static async Task Run()
        {
            Console.Out.WriteLine("[Start] Basic Conversion");
            FileInfo fileToConvert = GetFilesToConvert(".").First();

            //Set directory where app should look for FFmpeg executables.
            FFmpeg.SetExecutablesPath(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "FFmpeg"));
            //Get latest version of FFmpeg. It's great idea if you don't know if you had installed FFmpe1g.
            await FFmpegDownloader.GetLatestVersion(FFmpegVersion.Official);

            //Run conversion
            await RunConversion(fileToConvert);

            Console.Out.WriteLine("[End] Basic Conversion");
        }
コード例 #21
0
ファイル: MpegOptions.cs プロジェクト: lulzzz/magic-media
        public async Task Intitialize()
        {
            var location = GetDirectory();

            Log.Information("Initialize FFmpeg with location: {Location}", location);
            if (_options.AutoDownload)
            {
                Log.Information("FFmpeg GetLatestVersion");
                await FFmpegDownloader.GetLatestVersion(
                    FFmpegVersion.Official,
                    location);
            }

            FFmpeg.SetExecutablesPath(location);
        }
コード例 #22
0
        public static async Task Run()
        {
            Console.Out.WriteLine("[Start] Modify streams");

            Queue <FileInfo> filesToConvert = new Queue <FileInfo>(GetFilesToConvert(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)));
            await Console.Out.WriteLineAsync($"Find {filesToConvert.Count()} files to convert.");

            //Set directory where app should look for FFmpeg executables.
            FFmpeg.SetExecutablesPath(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "FFmpeg"));
            //Get latest version of FFmpeg. It's great idea if you don't know if you had installed FFmpe1g.
            await FFmpegDownloader.GetLatestVersion(FFmpegVersion.Official);

            //Run conversion
            await RunConversion(filesToConvert);

            Console.Out.WriteLine("[End] Modify streams");
        }
コード例 #23
0
        public VideoHelper()
        {
            InitializeComponent();
            info = new Info(pictureBox1.Width, pictureBox1.Height);


            this.labelBgmVolume.DataBindings.Add("Text", trackBarBgm, "Value");
            this.labelPersonVolume.DataBindings.Add("Text", trackBarPerson, "Value");
            this.labelEndTime.DataBindings.Add("Text", trackBarEndTime, "Value");
            this.labelBeginTime.DataBindings.Add("Text", trackBarBeginTime, "Value");
            this.trackBarEndTime.DataBindings.Add("Minimum", trackBarBeginTime, "Value");
            this.trackBarEndTime.DataBindings.Add("Maximum", trackBarBeginTime, "Maximum");
            this.textBoxThickness.DataBindings.Add("Text", info, "thickness");
            this.textBoxScale.DataBindings.Add("Text", info, "scale");
            this.trackBarBeginTime.DataBindings.Add("Value", info, "BeginTime");
            this.trackBarEndTime.DataBindings.Add("Value", info, "EndTime");
            this.textBoxSubtitlePositionX.DataBindings.Add("Text", info, "X");
            this.textBoxSubtitlePositionY.DataBindings.Add("Text", info, "Y");
            this.pictureBox1.BackColor = Color.Black;
            this.labelSub.MouseDown   += new MouseEventHandler(labelSub_MouseDown);
            this.labelSub.MouseMove   += new MouseEventHandler(labelSub_MouseMove);
            this.labelSub.MouseUp     += new MouseEventHandler(labelSub_MouseUp);
            //this.labelSub.Parent = pictureBox1;
            pictureBox1.Image = info.bmp;
            pictureBox1.Controls.Add(labelSub);
            this.labelSub.BackColor                  = Color.White;
            modeVideoToolStripMenuItem.Checked       = true;
            importAudioFileToolStripMenuItem.Enabled = false;
            this.labelSub.Location = new Point(0, 0);
            if (File.Exists(info.mixed))
            {
                System.IO.File.Delete(info.mixed);
            }
            if (File.Exists(info.bgmTemp))
            {
                System.IO.File.Delete(info.bgmTemp);
            }
            if (File.Exists(info.speechTemp))
            {
                System.IO.File.Delete(info.speechTemp);
            }
            if (!File.Exists("ffmpeg.exe"))
            {
                FFmpegDownloader.GetLatestVersion(FFmpegVersion.Full);
            }
        }
コード例 #24
0
ファイル: VideoConverter.cs プロジェクト: lulzzz/magic-media
        public async Task GenerateVideosAsync(CancellationToken cancellationToken)
        {
            await FFmpegDownloader.GetLatestVersion(FFmpegVersion.Official);

            List <Store.Media> videos = await _storeContext.Medias.AsQueryable()
                                        .Where(x => x.MediaType == Store.MediaType.Video)
                                        .ToListAsync(cancellationToken);

            var todo = videos.Count;

            var videoPreview = @"H:\Drive\Moments\System\VideoPreview";

            foreach (Store.Media video in videos)
            {
                todo--;

                var filename = _mediaBlobStore.GetFilename(new MediaBlobData
                {
                    Directory = video.Folder,
                    Filename  = video.Filename,
                    Type      = MediaBlobType.Media
                });

                try
                {
                    var outfile = Path.Combine(videoPreview, $"720P_{video.Id}.mp4");

                    if (!File.Exists(outfile))
                    {
                        var inputLength = new FileInfo(filename).Length / 1024 / 1024;

                        await _videoProcessing.ConvertTo720Async(filename, outfile, cancellationToken);

                        Console.WriteLine($"{todo} - Video created: {Path.GetFileName(outfile)}");

                        var outLength = new FileInfo(outfile).Length / 1024 / 1024;

                        Console.WriteLine($"{inputLength} --> {outLength} (-{100.0 / inputLength * outLength}%)");
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine($"Error in Media: {video.Id}. --> {ex.Message}");
                }
            }
        }
コード例 #25
0
        private void DownloaderForm_InstallRequested(string filePath)
        {
            string extractPath = Path.Combine(App.ToolsDir, "ffmpeg.exe");
            bool   result      = FFmpegDownloader.ExtractFFmpeg(filePath, extractPath);

            if (result)
            {
                this.InvokeSafe(() =>
                {
                    App.Settings.FFmpegPath = extractPath;
                });

                MessageBox.Show(Resources.MainWindow_DownloaderForm_InstallRequested_Successfully_downloaded_FFmpeg_, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show(Resources.MainWindow_DownloaderForm_InstallRequested_Failed_to_download_FFmpeg_, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #26
0
        static void Main()
        {
            Display.title          = "Ascier";
            Display.dynamicRefresh = true;
            Display.start();

            string[] directories = { "input", "output", "ffmpeg" };

            for (int i = 0; i < directories.Length; i++)
            {
                if (!Directory.Exists($"{Directory.GetCurrentDirectory()}/{directories[i]}"))
                {
                    Program.Logger.info($"The following directory has not been found.");
                    Program.Logger.info($"{Directory.GetCurrentDirectory()}/{directories[i]}");

                    Directory.CreateDirectory(directories[i]);

                    Program.Logger.info($"{directories[i]} directory has been created.");
                }
                else
                {
                    Program.Logger.info($"{directories[i]} directory has been found.");
                }
            }

            Display.forceRedraw();

            var status = FFmpegDownloader.GetLatestVersion(FFmpegVersion.Official, $"{Directory.GetCurrentDirectory()}/ffmpeg");

            if (!status.IsCompleted)
            {
                Program.Logger.info("Downloading FFMPEG library for video conversion.");
                while (!status.IsCompleted)
                {
                    ;
                }
                Program.Logger.info("Done.");
            }
            else
            {
                Program.Logger.info("ffmpeg has been found.");
            }
        }
コード例 #27
0
ファイル: FFmpegOptionsForm.cs プロジェクト: yehaike/ShareX
        private void DownloaderForm_InstallRequested(string filePath)
        {
            bool result = FFmpegDownloader.ExtractFFmpeg(filePath, DefaultToolsFolder);

            if (result)
            {
                this.InvokeSafe(() =>
                {
                    txtFFmpegPath.Text = Helpers.GetVariableFolderPath(Path.Combine(DefaultToolsFolder, "ffmpeg.exe"));
                    RefreshSourcesAsync();
                    UpdateUI();
                });

                MessageBox.Show(Resources.FFmpegOptionsForm_DownloaderForm_InstallRequested_Successfully_downloaded_FFmpeg_, "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show(Resources.FFmpegOptionsForm_DownloaderForm_InstallRequested_Download_of_FFmpeg_failed_, "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #28
0
ファイル: FFmpegOptionsForm.cs プロジェクト: Vpload/ShareX
        private void DownloaderForm_InstallRequested(string filePath)
        {
            string extractPath = DefaultToolsPath ?? "ffmpeg.exe";
            bool   result      = FFmpegDownloader.ExtractFFmpeg(filePath, extractPath);

            if (result)
            {
                this.InvokeSafe(() =>
                {
                    txtFFmpegPath.Text = extractPath;
                    RefreshSourcesAsync();
                    UpdateUI();
                });

                MessageBox.Show(Resources.FFmpegOptionsForm_DownloaderForm_InstallRequested_Successfully_downloaded_FFmpeg_, "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show(Resources.FFmpegOptionsForm_DownloaderForm_InstallRequested_Download_of_FFmpeg_failed_, "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #29
0
        internal async Task FullProcessPassed()
        {
            var operatingSystemProvider = Substitute.For <IOperatingSystemProvider>();

            operatingSystemProvider.GetOperatingSystem().Returns(x => OperatingSystem.Linux64);
            FFmpegDownloader._linkProvider = new LinkProvider(operatingSystemProvider);
            var ffmpegExecutablesPath = FFmpeg.ExecutablesPath;

            try
            {
                FFmpeg.ExecutablesPath = Path.Combine(Path.GetTempPath(), System.Guid.NewGuid().ToString("N"));

                await FFmpegDownloader.GetLatestVersion();

                Assert.True(File.Exists(Path.Combine(FFmpeg.ExecutablesPath, "ffmpeg")));
                Assert.True(File.Exists(Path.Combine(FFmpeg.ExecutablesPath, "ffprobe")));
            }
            finally
            {
                FFmpeg.ExecutablesPath = ffmpegExecutablesPath;
            }
        }
コード例 #30
0
ファイル: TaskHelpers.cs プロジェクト: KoMiI/ShareX
        public static bool CheckFFmpeg(TaskSettings taskSettings)
        {
            if (!File.Exists(taskSettings.CaptureSettings.FFmpegOptions.CLIPath))
            {
                string ffmpegText = string.IsNullOrEmpty(taskSettings.CaptureSettings.FFmpegOptions.CLIPath) ? "ffmpeg.exe" : taskSettings.CaptureSettings.FFmpegOptions.CLIPath;

                if (MessageBox.Show(string.Format(Resources.ScreenRecordForm_StartRecording_does_not_exist, ffmpegText),
                                    "ShareX - " + Resources.ScreenRecordForm_StartRecording_Missing + " ffmpeg.exe", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                {
                    if (FFmpegDownloader.DownloadFFmpeg(false, DownloaderForm_InstallRequested) == DialogResult.OK)
                    {
                        Program.DefaultTaskSettings.CaptureSettings.FFmpegOptions.CLIPath = taskSettings.TaskSettingsReference.CaptureSettings.FFmpegOptions.CLIPath =
                            taskSettings.CaptureSettings.FFmpegOptions.CLIPath            = Path.Combine(Program.ToolsFolder, "ffmpeg.exe");
                    }
                }
                else
                {
                    return(false);
                }
            }

            return(true);
        }