Every video is of type "avc1" and pixel format is "I420"

I’m using cv::VideoCapture on Ubuntu 20.04 to read many video files from disk. I get the video detail like this:

const auto number_of_frames	= cap.get(cv::VideoCaptureProperties::CAP_PROP_FRAME_COUNT			);
const auto fps				= cap.get(cv::VideoCaptureProperties::CAP_PROP_FPS					);
const auto frame_width		= cap.get(cv::VideoCaptureProperties::CAP_PROP_FRAME_WIDTH			);
const auto frame_height		= cap.get(cv::VideoCaptureProperties::CAP_PROP_FRAME_HEIGHT			);
const uint32_t fourcc		= cap.get(cv::VideoCaptureProperties::CAP_PROP_FOURCC				);
const uint32_t pixel_format	= cap.get(cv::VideoCaptureProperties::CAP_PROP_CODEC_PIXEL_FORMAT	);
const auto backend			= cap.getBackendName();

const std::string fourcc_str		(reinterpret_cast<const char *>(&fourcc			), 4);
const std::string pixel_format_str	(reinterpret_cast<const char *>(&pixel_format	), 4);

The video import/capture works fine. And the video details seems to be valid. But no matter what video I import, the FOURCC is always “avc1” and the pixel format is always “I420”. This seems unlikely as these videos come from different camera devices, and running “file” on them return very different results.

Is this a known issue? Is there a way to get the video details using the cv::VideoCapture interface?

I wouldn’t trust file to tell you video-specific information, or that it’s accurate. feel free to post its output.

use ffprobe (ffmpeg) to check what your videos actually contain.

if these files come from camcorders, it’s VERY likely that they’re all H.264.

feel free to post its output.

Thanks for the reply. Here is some example output from file on some of the videos I’m processing in OpenCV. I don’t understand why you say you wouldn’t trust it.

WebM
ISO Media, MP4 v2 [ISO 14496-14]
ISO Media, MP4 Base Media v1 [IS0 14496-12:2003]
RIFF (little-endian) data, AVI, 640 x 360, video: DivX 4
ISO Media, Apple QuickTime movie, Apple QuickTime (.MOV/QT)

Of the hundreds of videos I’ve tried, I’ve now found one that shows up with a FOURCC of “DIVX”. I also found 2 webm videos that show up with a FOURCC of zero. So my initial thought was wrong, they don’t all show up as avc1. But I guess I misunderstood what “avc1” means since almost all videos show up with that specific FOURCC.

“avc1” does mean H.264, but that’s just the video codec (like divx). it’s a very popular codec and has been for over a decade.

it says nothing about the container format (webm, mp4, mov, avi)

I hope OpenCV isn’t claiming avc1 for a video that has a different codec. you can determine codecs reliably with ffprobe/ffmpeg. file seems able to determine the container type but only in the riff/avi case did it report the video codec.