Reputation: 3095
I have a YUV file and I want to obtain each frame in the form of a BMP file, how to go by doing this ? I have FFMPEG and MPlayer at my disposal.
Upvotes: 0
Views: 2554
Reputation: 644
You can use the following command:
ffmpeg -s widthxheight -i input.yuv image%05d.bmp
Please make sure to define the widht and height in pixels. For example for Full HD it would be -s 1920x1080
, this is needed because the yuv format doesn't store any metadata for the video itself and you need to specify the resolution of the yuv file.
Upvotes: 1
Reputation: 1326
i would suggest u to first convert the .yuv file to .mp4 format by using this code.
ffmpeg -s 640x480 -i input.yuv -ss 00:00:00 -c:v libx264 -s:v 640x480 -preset slow -t 00:00:20 output.mp4
now extract the images from output.mp4 to .bmp format by using this code
ffmpeg -i output.mp4 images%03d.bmp
this will work.
a little explanantion of the above codes so that u can change the code according to ur needs.
-s 640x480 sets the resolution of the mp4 (u can change it to ur requirements)
-c:v libx264 sets the encoder to do encoding in libx264
-preset slow (this again change it to ur requirements ultrafast, medium etc)
-t sets the output file time. here i have set it 20 seconds.(remember format is hh:mm:ss.ms where ms is milliseconds)
image%03d.bmp is given as output. so this means the output files will be saved as image001.bmp,image002.bmp ...
or just image%d.bmp outputs as image1.bmo,image2.bmp and so on
hope this helps
Upvotes: 0