2

I have a problem with a RAW YUB video load in OpenCV. I can play it in mplayer with the following command:

mplayer myvideo.raw -rawvideo w=1280:h=1024:fps=30:y8 -demuxer rawvideo

My code for load in OpenCV is:

CvCapture* capture=cvCaptureFromFile("C:\\myvideo.raw");

cvCaptureFromFile always return NULL. But if I try with a normal avi file, the code runs normally (capture is not null).

I'm working with the lastest version of OpenCV under Windows 7.

EDIT: Output messages are

[IMGUTILS @ 0036f724] Picture size 0x0 is invalid  
[image2 @ 009f3300] Could not find codec parameters (Video: rawvideo, yuv420p)

Thanks

1 Answer 1

1

OpenCV uses ffmpeg as back-end, however, it includes only a subset of ffmpeg functions. What you can try is to install some codecs. (K-lite helped me some time ago)

But, if your aim is to obtain raw YUV in OpenCV, the answer is "not possible".

OpenCV is hardcoded to convert every input format to BGR, so even if you will be able to open the raw input, it will automatically convery it to BGR before passing it. No chance to solve that, the only way is to use a different capture library or hack into OpenCV.

What you can do (to simulate YUV input) is to capture the avi, convert to YUV

cvtColor(...,CV_BGR2YCBCR /* or CV_BGR2YUV */ );

and then process it

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.