From 2b15aa28cacf9f50722b054b31291ace85945b00 Mon Sep 17 00:00:00 2001 From: James Crook Date: Sun, 28 Jul 2019 15:57:48 +0100 Subject: [PATCH] Bug 2178 - Export to (external program) fails with errors [WINDOWS] This fixes the problem on Windows that if a user does not specify a suffix then ffmpeg does not know what format to use and gives a cryptic error message, if exporting using ffmpeg -i - "filename" Now, if no suffix is given, .wav is appended in the command sent to ffmpeg. If a user gives a suffix, e.g. 'myfile.wma' then no suffix is added. --- src/export/ExportCL.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/export/ExportCL.cpp b/src/export/ExportCL.cpp index d9861e5cb..921a131ea 100644 --- a/src/export/ExportCL.cpp +++ b/src/export/ExportCL.cpp @@ -107,6 +107,7 @@ void ExportCLOptions::PopulateOrExchange(ShuttleGui & S) wxString cmd; for (size_t i = 0; i < mHistory.GetCount(); i++) { + cmd = mHistory.GetHistoryFile(i); cmds.push_back(mHistory.GetHistoryFile(i)); } cmd = cmds[0]; @@ -332,6 +333,11 @@ ProgressResult ExportCL::Export(AudacityProject *project, // Retrieve settings gPrefs->Read(wxT("/FileFormats/ExternalProgramShowOutput"), &show, false); cmd = gPrefs->Read(wxT("/FileFormats/ExternalProgramExportCommand"), wxT("lame - \"%f.mp3\"")); + // Bug 2178 - users who don't know what they are doing will + // now get a file extension of .wav appended to their ffmpeg filename + // and therefore ffmpeg will be able to choose a file type. + if( cmd == wxT("ffmpeg -i - \"%f\"") && fName.Index( '.' )==wxNOT_FOUND) + cmd.Replace( "%f", "%f.wav" ); cmd.Replace(wxT("%f"), fName); #if defined(__WXMSW__)