server : ffmpeg overwrite leftover temp file (#2431)

* Remove possible leftover ffmpeg temp file from a previous failed conversion

* Revert "Remove possible leftover ffmpeg temp file from a previous failed conversion"

This reverts commit 00797403bd.

* Flag to force ffmpeg to overwrite output file if it exists
This commit is contained in:
gilbertgong 2024-10-02 05:06:40 -07:00 committed by GitHub
parent 2ef717b293
commit ede1718f6d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -219,7 +219,7 @@ void check_ffmpeg_availibility() {
bool convert_to_wav(const std::string & temp_filename, std::string & error_resp) { bool convert_to_wav(const std::string & temp_filename, std::string & error_resp) {
std::ostringstream cmd_stream; std::ostringstream cmd_stream;
std::string converted_filename_temp = temp_filename + "_temp.wav"; std::string converted_filename_temp = temp_filename + "_temp.wav";
cmd_stream << "ffmpeg -i \"" << temp_filename << "\" -ar 16000 -ac 1 -c:a pcm_s16le \"" << converted_filename_temp << "\" 2>&1"; cmd_stream << "ffmpeg -i \"" << temp_filename << "\" -y -ar 16000 -ac 1 -c:a pcm_s16le \"" << converted_filename_temp << "\" 2>&1";
std::string cmd = cmd_stream.str(); std::string cmd = cmd_stream.str();
int status = std::system(cmd.c_str()); int status = std::system(cmd.c_str());