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".


No comments: