How to extract frames(or a perticular frame) from a YUV video using ffmpeg

mrana picture mrana · Aug 13, 2015 · Viewed 8.3k times · Source

Here is the code for extracting frames from a MP4 video. ffmpeg -i above_marathon_250.mp4 images%03d.bmp But the same code does not work for YUV format video. Does anyone knows how it is possible to extract frame(s) from YUVformat video?

Answer

Ronald S. Bultje picture Ronald S. Bultje · Aug 13, 2015

It's not working because yuv files have no header, so ffmpeg doesn't know what size/pixfmt the file is. You need to specify resolution and pixmt manually:

ffmpeg -video_size 1920x1080 -r 25 -pixel_format yuv422p -i file.yuv output-%d.png

And then adjust size/pixfmt to match your particular video.

[edit] I'd also suggest to post such questions on superuser in the future, this has nothing to do with programming.