26 February, 2009

Extracting Raw Video Stream with Ffmpeg

We utilize raw, uncompressed video streams as input to sensor related video processing. Normally, our camera streams are captured directly from the camera source and stored in raw, uncompressed data file (no header or codec). Lately, we've found it useful to extract uncompressed streams from standard video file formats. Here's how:


$ ffmpeg -i ./VideoIn.avi -f rawvideo -pix_fmt gray /tmp/video.raw


This will convert the video stream to 8-bit grayscale and store it in a raw WxH stream, which you can play with:


$ mplayer -demuxer rawvideo -rawvideo w=640:h=352:y8 /tmp/video.raw


Note, the 640x352 image resolution was outputted as part of the ffmpeg extraction command, without the resolution you'll have more trouble viewing the video than 15 minutes of "The View".

Enjoy.

1 comment:

Anonymous said...

I was wondering if you ever thought of changing the layout of your blog?

Its very well written; I love what youve got to say.
But maybe you could a little more in the way of content so
people could connect with it better. Youve got an awful
lot of text for only having one or two images. Maybe you could space it out
better?