Closed borijang closed 1 year ago
When keep_audio is True, but there's no audio stream in the video, we get the following error:
keep_audio is True
0%| | 0/2250 [00:00<?, ?it/s]Stream map '1:a:0' matches no streams. To ignore this, add a trailing '?' to the map. Traceback (most recent call last): File "/home/borijang/deface/lib/python3.9/site-packages/imageio_ffmpeg/_io.py", line 630, in write_frames p.stdin.write(bb) BrokenPipeError: [Errno 32] Broken pipe FFMPEG COMMAND: /home/borijang/deface/lib/python3.9/site-packages/imageio_ffmpeg/binaries/ffmpeg-linux64-v4.2.2 -y -f rawvideo -vcodec rawvideo -s 1280x720 -pix_fmt rgb24 -r 25.00 -i - -i vid2.mp4 -vcodec libx264 -pix_fmt yuv420p -v warning -acodec copy -map 0:v:0 -map 1:a:0 blur.mp4
This PR fixes this error by checking if audio_codec exists in the metadata, and only then attempts to keep the audio.
audio_codec
Thanks @borijang
When
keep_audio is True
, but there's no audio stream in the video, we get the following error:This PR fixes this error by checking if
audio_codec
exists in the metadata, and only then attempts to keep the audio.