Home
Head's Up: I'm in the middle of upgrading my site. Most things are in place, but there are something missing and/or broken including image alt text. Please bear with me while I'm getting things fixed.

ffmpeg Still Image Quality Setting Comparisons

You can adjust the quality of jpg images produces from FFmpeg with the [TODO: Code shorthand span ] flag. Like :

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 :

#!/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

- The [TODO: Code shorthand span ] sets a sequence number that isn't really needed but ffmpeg complains if it's not there.

Footnotes And References