master-of-zen / Av1an

Cross-platform command-line AV1 / VP9 / HEVC / H264 encoding framework with per scene quality encoding
GNU General Public License v3.0
1.45k stars 151 forks source link

Failed audio conversion leads to "audio_done: true" #621

Open mxsrm opened 2 years ago

mxsrm commented 2 years ago

As noted above, when the audio transcoding fails (e.g. wrong ffmpeg commands are given) the resulting audio.mkv is empty but av1an saves this as audio_done: true. In my opinion this should not be saved as done since this is not the case and the concatenation will likely fail.

mxsrm commented 2 years ago

@master-of-zen

WARN [av1an_core::ffmpeg] FFmpeg failed to encode audio!

leads to (in done.json)

"audio_done":true

and failure to concentate because audio.mkv is not existing which leads to a loss of all encoded video material because the temporary dir is just deleted afterwards.

Rev is newest git master (https://github.com/master-of-zen/Av1an/commit/fa738555c8f028a7dedafbcf65f314e04bf47b67).

redzic commented 2 years ago

I'm not sure that the issue is that audio_done is set to true -- audio_done is just used to see whether or not we redo the audio encoding when resuming; (I believe) setting it to false shouldn't change whether or not the audio is concatenated. I think to fix this we would need to check the exit code of the ffmpeg process that encoded the audio, and if it failed, do not try to mux it in during concatenation.

and failure to concentate because audio.mkv is not existing which leads to a loss of all encoded video material because the temporary dir is just deleted afterwards.

That seems strange, given that we do check if the output file exists before deleting it (if not using --keep). Are you sure the output file really doesn't exist?