beandog’s media bin: ffcompare and mpvcompare

When I’m doing QA on my media encodes, it helps a lot to compare the outcome against the original DVD source. ffmpeg can handle it pretty easy:

ffplay -an -sn -f lavfi "movie=dvd_track_01.mpg[a];movie=x264_encode.mkv[b];[a][b]hstack"

You can’t really do much control with ffplay though, but it is good if you just want to sit there and watch it, and pause using the spacebar. I’ve disabled audio and subtitles in that example as well in that example so I can just focus on the video differences.

I generally use MPV so I can get more control, fast forwarding, stepping through frames (. and ,), take screenshots (s), etc., etc. Plus I can put cool things in my mpv.conf.

mpv dvd_track_01.mpg --external-file x264_encode.mkv --lavfi-complex='[vid1] [vid2] hstack [vo]' --screenshot-format=png --screenshot-template="%F.mpv-compare-${2}-%ws.%wT" --fullscreen --mute=yes --osd-level=2

You can see the screenshot template in that one saves the filename of the first one (%F) followed by -mpv-compare- and then filename of the second one, so it makes it easy to see what videos it’s comparing.

Here’s an example where I’m testing a detelecine filter on Storm Hawks:

And here’s one where I’m comparing x264 CRF levels on Teen Titans, this one is 22 and on close inspection you can see the lines on the blue sky disappear:

And here’s the scripts, syntax is “video 1” and “video 2”:

ffcompare:

#!/bin/bash
ffplay -f lavfi "movie=${1}[a];movie=${2}[b];[a][b]hstack"

mpvcompare:

#!/bin/bash
mpv "${1}" --external-file "${2}" --lavfi-complex='[vid1] [vid2] hstack [vo]'

Leave a Reply