Allow using "ffmpeg" for generating waveform on Linux

This commit is contained in:
Nikolaj Olsson 2020-01-18 15:15:00 +01:00
parent 504ae9373d
commit d9078b1b45
2 changed files with 10 additions and 6 deletions

View File

@ -86,13 +86,13 @@ namespace Nikse.SubtitleEdit.Forms
}
}
if (Configuration.Settings.General.UseFFmpegForWaveExtraction && File.Exists(Configuration.Settings.General.FFmpegLocation))
if (Configuration.Settings.General.UseFFmpegForWaveExtraction && (File.Exists(Configuration.Settings.General.FFmpegLocation)) || !Configuration.IsRunningOnWindows)
{
encoderName = "FFmpeg";
string audioParameter = string.Empty;
if (audioTrackNumber > 0)
{
audioParameter = string.Format("-map 0:a:{0}", audioTrackNumber);
audioParameter = $"-map 0:a:{audioTrackNumber}";
}
const string fFmpegWaveTranscodeSettings = "-i \"{0}\" -vn -ar 24000 -ac 2 -ab 128 -vol 448 -f wav {2} \"{1}\"";
@ -106,6 +106,10 @@ namespace Nikse.SubtitleEdit.Forms
// "-map 0:a:0" is the first audio stream, "-map 0:a:1" is the second audio stream
exeFilePath = Configuration.Settings.General.FFmpegLocation;
if (!Configuration.IsRunningOnWindows)
{
exeFilePath = "ffmpeg";
}
parameters = string.Format(fFmpegWaveTranscodeSettings, inputVideoFile, outWaveFile, audioParameter);
}
return new Process { StartInfo = new ProcessStartInfo(exeFilePath, parameters) { WindowStyle = ProcessWindowStyle.Hidden } };

View File

@ -535,13 +535,13 @@ namespace Nikse.SubtitleEdit.Forms
checkBoxUseFFmpeg.Text = language.WaveformUseFFmpeg;
buttonDownloadFfmpeg.Text = language.DownloadFFmpeg;
if (Configuration.IsRunningOnLinux || Configuration.IsRunningOnMac)
if (!Configuration.IsRunningOnWindows)
{
buttonDownloadFfmpeg.Visible = false;
}
labelFFmpegPath.Visible = false;
textBoxFFmpegPath.Visible = false;
buttonBrowseToFFmpeg.Visible = false;
if (Configuration.IsRunningOnLinux)
{
buttonMpvSettings.Visible = false;
radioButtonVideoPlayerDirectShow.Enabled = false;
radioButtonVideoPlayerMpcHc.Enabled = false;