Processing of mp4 files with attached pictures fails + workaround
Hey,
I just tried to use mat2 with some video files which (apparently) have an attached picture that causes mat2/ffmpeg to fail.
I am referring to mat2 0.12.3 with ffmpeg version n5.0 and Python 3.10.4 under Arch Linux with kernel 5.17.1-zen1-1-zen.
Stream description: Stream #0:15[0x0]: Video: bmp, bgra, 340x192, 90k tbr, 90k tbn (attached pic)
Error message when loglevel panic is commented out:
Could not find tag for codec bmp in stream #15, codec not currently supported in container
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Error initializing output stream 0:15 --
I played around with the command in the video.py file and found a workaround fixing the issue for me. According to the decumentation the filter "’V’ only matches video streams which are not attached pictures" which is exactly what needs to be done to get rid of the issue. Therefore, I suggest to replace the line '-map', '0',
in the command definition in video.py with
'-map', '0:V?', # copy video sections which are not attached pictures from input to output
'-map', '0:a?', # copy audio from input to output
'-map', '0:s?', # copy subtitles from input to output
'-map', '0:d?', # copy data from input to output
'-map', '0:t?', # copy attachments from input to output
as attached images might also be seen as metadata. Maybe even the last two lines should be left out as I am not sure video files with data or actual attachments will work...
However, thanks in advance and thanks for the great tool!
dvs23