Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV cannot read MP4 videos

I'm using OpenCV 2.4.8 on Ubuntu 14.04 to read in some MP4 videos. The program works on Macs and other Linux machines, but for some reason when I compile and run the program it gives me these errors before exiting:

[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
Non-reference picture received and no reference available
[h264 @ 0x1d0dcc0] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1d0dcc0] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1d0dcc0] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1d0dcc0] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1d0dcc0] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1d0dcc0] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1d0dcc0] decode_slice_header error
[h264 @ 0x1d0dcc0] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1d0dcc0] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1d0dcc0] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1d0dcc0] decode_slice_header error
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
Non-reference picture received and no reference available
[h264 @ 0x1d8a5c0] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1d8a5c0] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1d8a5c0] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1d8a5c0] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1cf8f40] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1cf8f40] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1cf8f40] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1cf8f40] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1cf8f40] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1cf8f40] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1cf8f40] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1cf8f40] decode_slice_header error
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit

The main parts of the code that are reading in the files look like this (they're split between some methods so I've included the lines that do all the work to do with opening and reading the frames:

cv::VideoCapture cap;
cap.open (input_path);
success = cap.read (data.frames[i]);

Does anyone know how I can get my program to correctly read in these videos? I tried to add "cap.set(CV_CAP_PROP_FOURCC, CV_FOURCC('H', '2', '6', '4'));" before "cap.open" but that didn't seem to work.