How to read yuv video?

asked 2014-10-07 21:51:31 -0500


I have a problem reading yuv UHD video. It is 4K 10bit YUV RAW video.

My goal is to extract all frames of video to 10-bit depth images.

I tried with following code.

char* source = "UHD.yuv";

VideoCapture InputVideo(source);
if (!InputVideo.isOpened())
    cout << "Could not open the input video << endl;

    return -1;

But here comes the error message.

[IMGUTILS @ 000000000013f4b0] Picture size 0x0 is invalid

[IMGUTILS @ 000000000013ef40] Picture size 0x0 is invalid

[IMGUTILS @ 000000000013ef90] Picture size 0x0 is invalid

warning: Could not find codec parameters (../../modules/highgui/src/cap_ffmpeg_impl.hpp:548)

Could not open the imput video

Thanks for help in advance.

edit retag flag offensive close merge delete


You are reading in a video format that is unsupported by ffmpeg. This is not an OpenCV problem I am afraid... you should google on ffmpeg and your error to find possible solutions.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-10-08 04:12:26 -0500 )edit

Oh..then, I should read it as binary. Thank you!

Seungjun gravatar imageSeungjun ( 2014-10-11 23:20:50 -0500 )edit

Hi Seungjun,

Do you know what's the values of width, height? Your file have any header, footer, etc...? What's your chroma subsampling, is 4:4:4?

Victor Fernandes gravatar imageVictor Fernandes ( 2015-01-07 17:15:43 -0500 )edit