I'm extracting frame images from an MP4 video using ffmpeg
in terminal.
I used the command:
ffmpeg -i Video.MP4 Pictures%d.bmp
Problem is that the extracted images have a size of 4.5-5MB! I want smaller images, say around 1-2 MB. How do I limit the size of output images?
The file size is a function of your video resolution and of the output format you choose. For example:
width x height x 3 bytes ( RGB24)
You have different ways to reduce the output file size.
Change the format for example YUV 4:2:0 with -pix_fmt yuv420
and I think the smaller format you can choose is gray or yuv400 but check with the following command showing the ffmpeg supported pixel format
‘ffmpeg -pix_fmts
the BMP format should handle that (generate a 8bpp image) but confirm with the file size that you get a factor 3!
Change the output resolution (HD to SD or CIF) with -s <Width>x<Height>
, e.g.:
ffmpeg -i Video.MP4 -s 192x168 Pictures%d.bmp
or with the -vf
option:
ffmpeg -I Video.MP4 -vf scale=192:168 Pictures%d.bmp
there is one more option you have to reduce filesize of the output pictures : Use another picture format like *.jpg.
ffmpeg -i input.flv -ss 00:00:14.435 -f image2 -vframes 1 out.jpg
(Source : http://trac.ffmpeg.org/wiki/Create%20a%20thumbnail%20image%20every%20X%20seconds%20of%20the%20video)
Have a nice day ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With