jlarsch February 2016

opencv and ffmpeg multipart avi files > 2GB

Is there a way OpenCV can read large (>2GB) .avi video files?

I am using openCV 3.0 and python 2.7 on Windows 7 64 bit.

I have mpeg4 compressed .avi files, often > 2GB. These are created using ffmpeg. Such files read fine up to some point using the following commands:

import cv2
#avi_path is full path to avi
cap = cv2.VideoCapture(avi_path)
img1=cap.read()

but at some frame number, read() returns 'false'

Using Gspot, I found that such problematic videos are 'Multipart OpenDML AVI' and read() seems to only be able to read the first part. Doing some google searches, it seems other people are having similar issues but no obvious solution.

apparently, openCV VideoWriter is also limited to 2 GB videos: openCV documentation Is the limitation in VideoCapture by design also?

Is there a workaround perhaps to read large video files? Alternatively, can I avoid creating multipart avi files in ffmpeg?

Answers


Ronald S. Bultje February 2016

The ffmpeg AVI muxer will only generate an openDML file if the file is >2GB. Coincidentally, there is no way to create AVI files > 2GB without openDML extensions, so you're essentially out of luck. The only way to create non-openDML (AVI) files is to keep them under 2GB; alternatively, you could use some other (non-AVI) container format.

But by far your best bet is to make openCV support openDML, either by writing support for the extension into their demuxer, or by having them use ffmpeg's demuxer instead of their own.

Post Status

Asked in February 2016
Viewed 2,864 times
Voted 14
Answered 1 times

Search




Leave an answer