Closed gilbertgong closed 4 weeks ago
Yeah seems to be good idea, but you could after "-i" pipe give a "-y" pipe (which means always say yes).
So this here: cmd_stream << "ffmpeg -i \"" << temp_filename << "\" -ar 16000 -ac 1 -c:a pcm_s16le \"" << converted_filename_temp << "\" 2>&1";
would become this: cmd_stream << "ffmpeg -i \"" << temp_filename << "\" -y -ar 16000 -ac 1 -c:a pcm_s16le \"" << converted_filename_temp << "\" 2>&1";
Yeah seems to be good idea, but you could after "-i" pipe give a "-y" pipe (which means always say yes).
So this here: cmd_stream << "ffmpeg -i "" << temp_filename << "" -ar 16000 -ac 1 -c:a pcm_s16le "" << converted_filename_temp << "" 2>&1";
would become this: cmd_stream << "ffmpeg -i "" << temp_filename << "" -y -ar 16000 -ac 1 -c:a pcm_s16le "" << converted_filename_temp << "" 2>&1";
Sounds good, I've made this change.
In our long running whisper.cpp instance, we ran into an issue where ffmpeg failed to convert a single file, and because it failed - it left the resultant target temp file. Subsequent requests failed to process because ffmpeg declined to overwrite the existing target file:
Deleting the file manually allows it to again proceed. This patch
preemptively removes the file just in case it exists to fix this potential issue.adds the-y
flag to ffmpeg instructing it to overwrite if necessary.