How to read ffv1 16-bit video in Windows?

I have been trying to read a 16-bit grayscale video and I have failed. I created this video from Kinect depth images using ffmpeg like so:

ffmpeg -f concat -r 30 -i file_list.txt -c:v ffv1 -vf fps=30 -crf 0 output_ffv1.avi

The resulting file is reported as codec: FFV1, ColorSpace: Y, BitDepth/String: 16 by MediaInfo so I think it looks ok. And the images I use to create the video are truly 16 bit png files. I can load them into OpenCV (IMREAD_ANYDEPTH)) and read their 16-bit value.

Now, I am trying to read the video sequence with videocapture:

VideoCapture videoD;
videoD.set(CAP_PROP_CONVERT_RGB, false);"output_ffv1.avi");
Mat imgV (480, 640, CV_16UC1);

which gives me an 8UC3 image that can be shown, but the precision is lost (only 8 upper bits remain).

If I try for example"output_ffv1.avi", CAP_DSHOW);

then I get a 16UC1 image, but it is filled with a constant value of 52685.

How can I get the real 16-bit value from the video? I am using Windows 10 and OpenCV 4.4.0 and C++. I think I did not compile it with OpenNI support, but since I am not connecting a device i doubt it matters.
Any advice will be appreciated.


investigate CAP_PROP_CONVERT_RGB. it might work. or might not. somewhat new feature.

reading video that isn’t 8 bits per channel has been fairly uncommon.


always returns 0, regardless if I set it to false or true. Do you think it might work with the latest OpenCV build (I am using 4.4.0)?
I did compile the latest master branch, but it did not help :frowning:

look for “convertRGB”. there isn’t much going on, and what is going on, is conditional on a few things that might not hold true in your case.

you’ll note the latest change is 8 days ago and is related to this feature.

and there are a bunch of open issues mentioning the cap prop flag.

that means you can’t expect this to work yet. if you have trouble, consider adding your voice to an appropriate issue on github, or create one if you found a new problem.

Yes, I noticed that this issue is being worked upon and I verified it is not working yet. Anyway, thank you for your help.