ffmpeg Still Image Quality Setting Comparisons

You can adjust the quality of jpg images produces from FFmpeg with the `-q:v`` flag. Like:

Code

ffmpeg -i "input.mp4" -q:v 5 "output.mp4"

I'll write up more about that in another post. For now, we can look at the quality of the images.

These are sample images with different quality settings for single frame output from ffmpeg. The source is a 1920x1080 video. The images are the same size but will resize down to your browser if it's smaller.

  • add file sizes

PNG - 279K

JPG - (Quality 1 - With -qmin 1) 49.3K

This is the code I used to produce the image:

Code

#!/bin/bash

cd "/Users/alan/workshop/alanwsmith.com/content/images/ffmpeg-quality-examples"

CLIPNUM=1
CLIPTIME=54
WIDTH=700

# Make PNG
ffmpeg -ss $CLIPTIME -i /Users/alan/Desktop/input.webm \
-frames:v 1 -filter:v "crop=1840:2160:1000:0,scale=$WIDTH:-2" \
-y "ffmpeg-image-quality--clip-$CLIPNUM--png--%02d.png"

# Make quality 1 with qmin 1 jpg
ffmpeg -ss $CLIPTIME -i /Users/alan/Desktop/input.webm \
-frames:v 1 -filter:v "crop=1840:2160:1000:0,scale=$WIDTH:-2" -q:v 1 -qmin 1 \
-y "ffmpeg-image-quality--clip-$CLIPNUM--jpg-q1--w-qmin1--%02d.jpg"

# Make quality 1 without qmin jpg
ffmpeg -ss $CLIPTIME -i /Users/alan/Desktop/input.webm \
-frames:v 1 -filter:v "crop=1840:2160:1000:0,scale=$WIDTH:-2" -q:v 1 \
-y "ffmpeg-image-quality--clip-$CLIPNUM--jpg-q1--wo-qmin1--%02d.jpg"

# Maker quality 2-32 jpgs
for i in {2..31}
do 
ffmpeg -ss $CLIPTIME -i /Users/alan/Desktop/input.webm \
-frames:v 1 -filter:v "crop=1840:2160:1000:0,scale=$WIDTH:-2" -q:v $i \
-y "ffmpeg-image-quality--clip-$CLIPNUM--jpg-q$i--%02d.jpg"
done

References