2014-07-13

raw image format, ffmpeg, and raspivid

The SwView.org node 165: RGB565 To PNG/JPEG showed up at the top of the results listing for a search on RGB565, an image data format produced by a camera. We are most interested in capturing an manipulating said data, so we want to know what format it's in, and this RGB565 is used to refer to the format throughout the files which we currently access.


if image.raw contains data for multiple frames (e.g. of a video), you can use "%d" and ffmpeg will automatically name the additional files generated: 
ffmpeg -vcodec rawvideo -f rawvideo -pix_fmt rgb565 -s 1024x768 -i movie.raw -f image2 -vcodec png image%d.png

Instead of a file, If you have an rgb565 stream, you may attempt to direct the data to stdin of ffmpeg and accomplish the same. In such a case, instead of "-i image.raw", you can use "-i -":
firstCommand | ffmpeg -vcodec rawvideo -f rawvideo -pix_fmt rgb565 -s 1024x768 -i - -f image2 -vcodec png image%d.png

Note that raspivid can produce raw video and place it on stdout.