Currently I am using this command to extract the images:

ffmpeg.exe -i 10fps.h264 -r 10 -f image2 10fps.h264_%03d.jpeg

But how can I improve the JPEG image quality?

  • 1
    What is wrong with the current quality, apart from that it is not "good"? – bjoernz Apr 19 '12 at 11:05

Use -qscale:v

Use -qscale:v (or the alias -q:v) as an output option. Effective range for JPEG is 2-31 with 31 being the worst quality. I recommend trying values of 2-5.

To output a series of images:

ffmpeg -i input.mp4 -qscale:v 2 output_%03d.jpg

To output a single image at ~60 seconds duration:

ffmpeg -ss 60 -i input.mp4 -qscale:v 4 -frames:v 1 output.jpg

This will work with any video input. See below if your input is MJPEG.


If you input is MJPEG (Motion JPEG) then the images can be extracted without any quality loss.

The ffmpeg or ffprobe console output can tell you if your input is MJPEG:

$ ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=nw=1 input.avi

Then you can extract the frames using the mjpeg2jpeg bitstream filter:

$ ffmpeg -i input.avi -codec:v copy -bsf:v mjpeg2jpeg output_%03d.jpg

Also see

  • This seems to have no effect for me-- qscale 1 and 2 both give identical file sizes and (to my naked eye) appear the same as without qscale at all. – felwithe Jan 28 '15 at 23:03
  • Can you post the complete commandline you're using? Also please post the complete, uncut output from ffmpeg on the commandline. Note that placement of options is relevant, so -qscale:v 2 needs to be placed after the -i inputfile option, but before the output file option, to have any effect. – Ronald S. Bultje Apr 12 '15 at 12:10
  • 1
    For me adding -qmin 1 -qmax 1 in addition to -q:v 1 doubled the file size. And I can seem to see a very slight improvement also. – complistic Jun 27 '15 at 0:43
  • 1
    @complistic: -qmin 1 -qmax 1 resulted in larger file, but gives me an exact same image. I validated this via photoshop, 2 layers and difference filter. The pixels are the same. – cherouvim Nov 30 '15 at 15:41
  • @Kostanos You can try -qmin 1 -q:v 1. – llogan ::...
    当前网页内容, 由 大妈 ZoomQuiet 使用工具: ScrapBook :: Firefox Extension 人工从互联网中收集并分享;
    若有不妥, 欢迎评注提醒:


    订阅 substack 体验古早写作:

    点击注册~> 获得 100$ 体验券: DigitalOcean Referral Badge

    关注公众号, 持续获得相关各种嗯哼:


    关于 ~ DebugUself with DAMA ;-)
    公安备案号: 44049002000656 ...::