BleuBleu/FamiStudio

Permit FFMpeg from PATH

Closed this issue · 4 comments

It's not convenient in all environments to specify a full path to the ffmpeg binary. It should be possible to let it be searched for in the PATH.

This already mostly works. The executable path for ffmpeg can default to just ffmpeg on Darwin & Linux.

// Linux or Mac is more likely to have standard path for ffmpeg.
if (Platform.IsLinux || Platform.IsMacOS)
{
if (string.IsNullOrEmpty(FFmpegExecutablePath) || !File.Exists(FFmpegExecutablePath))
{
if (File.Exists("/usr/bin/ffmpeg"))
FFmpegExecutablePath = "/usr/bin/ffmpeg";
else if (File.Exists("/usr/local/bin/ffmpeg"))
FFmpegExecutablePath = "/usr/local/bin/ffmpeg";
else
FFmpegExecutablePath = "ffmpeg"; // Hope for the best!
}
}

This line currently blocks the FFMpeg-using export options from being usable, because of the File.Exists check.

canExportToVideo = (!Platform.IsDesktop || (!string.IsNullOrEmpty(Settings.FFmpegExecutablePath) && File.Exists(Settings.FFmpegExecutablePath)));

Removing this check makes it work just fine.


Some leftover problems afterwards:

  1. It doesn't seem possible to reset the FFMpeg path in the settings UI to ffmpeg. You can manually edit the settings file and input it there, but some way of doing this from within FamiStudio would be great.
  2. The export pages for FFMpeg also appear if there is some file called ffmpeg in the CWD, but the actual export will not work because:
  3. If there's a file called ffmpeg in the CWD, then Process.Start seems to prefer that over a PATH lookup. I'm not sure if that can really be fixed, so it's something to be aware of.

Hi. Ill try to take a look soon. Im planning a hotfix in 1-2 weeks, so lets see if I can throw that in there.

You can take a look at 6126ce2. Should be better now.

I replaced the dumb "button" that allowed choosing the ffmpeg executable by a textbox and a "browse" button. You can now type whatever you want in there. I also removed the File.Exists check.

image

Seems fine now, thanks.

On the topic of that configuration page, the tooltip for that textbox has a typo:

FFmpegPathTooltip=Path to FFmpeg executable. On Windows this is ffmpeg.exe. To download and install ffpmeg, check the link below.

To download and install ffpmeg

Included in 4.1.1 which was just released.