/// <summary> /// Searches several predefined locations for existing installations of FFMpeg, /// then selects the latest version available. /// /// Locations searched are Program Files and Program Files (x86) on fixed disks, /// the user's home directory, and VideoCutter's own directory. /// /// This method should only be called when necessary, as it may attempt to access /// idling hard drives, causing the application to feel unresponsive. /// </summary> public static void AutoSetupFFMpeg() { Debug.WriteLine("Searching for ffmpeg executables..."); List <FFMpegLocation> ffmpegLocations = FindFFMpegDirectories(); foreach (FFMpegLocation location in ffmpegLocations) { Debug.WriteLine("Complete set of ffmpeg executables found..."); Debug.WriteLine("Path to ffmpeg directory: " + location.path); Debug.WriteLine("Path to ffmpeg: " + location.ffmpeg[0]); Debug.WriteLine("Path to ffprobe: " + location.ffprobe[0]); Debug.WriteLine("Path to ffplay: " + location.ffplay[0] + "\n"); } if (ffmpegLocations.Count == 0) { Debug.WriteLine("No installations of FFMpeg were found."); } else { FFMpegLocation latestFFMpeg = GetLatestFFMpeg(ffmpegLocations); Debug.WriteLine("Path to latest ffmpeg directory: " + latestFFMpeg.path); PreferencesHelper.setFFMpegLocations(latestFFMpeg.ffmpeg[0], latestFFMpeg.ffprobe[0], latestFFMpeg.ffplay[0]); } }
private static void EnsureDirectoryExists(ILogger logger) { //string directory = FFMpegLocation?.FullName ?? Directory.GetCurrentDirectory(); ; if (!FFMpegLocation.Exists) { logger.LogDebug("Creating FFMpeg Directory"); FFMpegLocation.Create(); } FFMpegLocation.Refresh(); }
private static void EnsureFFmpegFileExists(ILogger logger) { if (!FFMpegExecutable.Exists || !FFMpegOldExecutable.Exists || !FLVToolExecutable.Exists) { FFMpegLocation.Delete(true); FFMpegLocation.Create(); UnpackFFmpegExecutable(FFMpegLocation, logger); } FFMpegExecutable.Refresh(); }