Load RAW YUV video in OPENCV

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

scaling (resizing) raw yuv video with ffmpeg

Is it possible to scale a raw YUV video using ffmpeg? I have a 1920×1080 raw yuv video and i want to downscale it to 960×540. I used below command but i didn’t work. ffmpeg -i input.yuv -vf scale=960:

YUV Raw frames to video stream

Im trying to stream raw YUV frames in an array generated in a C++ program to video using FFPEG. Can anyone point me to the right direction?

convert H264 video to raw YUV format

Is it possible to create a raw YUV video from H264 encoded video using ffmpeg? I want to open the video with matlab and access Luma, Cb and Cr components frame by frame.

How to write YUV 420 video frames from RGB data using OpenCV or other image processing library?

I have an array of rgb data generated from glReadPixels(). Note that RGB data is pixel packed (r1,g1,b1,r2,g2,b2,…). How can I quickly write a YUV video frame using OpenCV or another C++ library, s

How to read a frame from YUV file in OpenCV?

How to read a frame from YUV file in OpenCV?

YUV video processing in Matlab

I am using this function I got from the internet: >>[Y,U,V]=yuv_import(‘test.yuv’,[176 144],150,0) I got this from: Convert YUV CIF 4:2:0 video file to image files It prints out the Y, U and V

Convert YUV to lossy compression with OpenCV

How would I go about converting an image in YUV colorspace to a JPEG image? I have a raw image data saved in a char* variable: char* frame = (char*)camera->getFrame(); // YUV colorspace image data

Play YUV video on Android

I want to show the YUV video on the android However, my project can only display first frame of the video I cannot display next frame successfully in current state the following is my java code: publi

Where can I obtain a raw YUV File? [closed]

I need a raw YUV file for research purposes. Neither the size nor the content is critical. Any ideas on where such files exist?

Playing YUV on VLC Player

When playing a raw video (.yuv) file on VLC Player. How can I tell VLC the width, height and frame-rate of the video?

Answers

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