opencv-python
opencv-python copied to clipboard
FFV1 Container / Container information for codecs
What container does FFV1 use? I can't find where this is at in documentation. It mentions the codecs but not corresponding containers when you are using extensions.
I've tried mkv, avi, mp4, etc for FFV1 but I always get
OpenCV: FFMPEG: tag 0x31766666/'ffv1' is not supported with codec id 33 and format '[container]'
OpenCV: FFMPEG: fallback to use tag 0x31564646/'FFV1'
such as for mkv which everything tells me FFV1 often uses
OpenCV: FFMPEG: tag 0x31766666/'ffv1' is not supported with codec id 33 and format 'matroska / Matroska'
OpenCV: FFMPEG: fallback to use tag 0x31564646/'FFV1'
The resulting MKV file is openable with a video player, and does look lossless, but the file is also not proper, thus no thumbnail or recognized information in properties.
According to tests ffv1 should work with avi and mkv: https://github.com/opencv/opencv/blob/4.x/modules/videoio/test/test_ffmpeg.cpp#L78.
According to tests ffv1 should work with avi and mkv: https://github.com/opencv/opencv/blob/4.x/modules/videoio/test/test_ffmpeg.cpp#L78.
That's strange. Yeah, it says MKV is not supported, and then the resulting MKV file is openable, and works, but the timeline is not accurate, it will reach the "end of the file" before it actually does, and continue playing for X seconds.
When I use AVI, it says it's also invalid, also
OpenCV: FFMPEG: tag 0x31766666/'ffv1' is not supported with codec id 33 and format 'avi / AVI (Audio Video Interleaved)'
OpenCV: FFMPEG: fallback to use tag 0x31564646/'FFV1'
The resulting AVI file is not playable in default AVI players (windows media player/video player), but will work in MPC-HQ/VideoLan
I am using opencv-python-headless[ffmpeg] which installed opencv-python-headless==4.7.0.72
The resulting AVI file is not playable in default AVI players - it could be system codecs issue on Windows.
The resulting AVI file is not playable in default AVI players - it could be system codecs issue on Windows.
I have codec pack installed, WMP should have access to a wide range of video codecs, especially all those from FFMPEG.
Additionally, the resulting files in both cases, aren't saving correctly, as they have no length data or other data for the video players statistics. Both files will reach the "end of the file" and continue playing for awhile.
Edit: Using cv2 to get the last frame doesn't seem to actually yield the last frame of the video, but where it stops prematurely in the video player.
I changed cv2.VideoWriter_fourcc(*"ffv1") to cv2.VideoWriter_fourcc(*"FFV1"). It worked for me.
And I am not sure if you have tried VLC but it does seem to be able to decode it. https://en.m.wikipedia.org/wiki/FFV1
And it only works when the width & height of the video are the same. Otherwise it only writes first frame and nothing else!!!