Comparison of decoded data with MD5 hash
You can use the FFmpeg MD5 muxer to show that the decoding results in the exact same output:
Get MD5 hash of the video stream from your original input:
$ ffmpeg -loglevel error -i original.vid -map 0:v -f md5 - MD5=5ee3ae1ee5feaf30618938290225f682
Convert to a lossless output:
$ ffmpeg -i original.vid -c:v libx264 -qp 0 lossless.mkv
Compare MD5 hash of the lossless video:
$ ffmpeg -loglevel error -i lossless.mkv -map 0:v -f md5 - MD5=5ee3ae1ee5feaf30618938290225f682
You may not get the same hash even with a lossless encoder. Changes to various attributes can occur that can alter the MD5 hash such as the colorspace or chroma subsampling.
You can see that the MD5 hash can change if you output to a lossy format.
Other losslessly compressed video encoders supported by FFmpeg include: ffv1, ffvhuff, huffyuv, and utvideo.
See the framemd5 muxer to view the hash for each frame.
With the blend filter
Viewing the difference of a lossy output.
You can use the blend filter to visually compare the difference.
ffplay -f lavfi \
blend is slow, and this command may not play in real time depending on your CPU and the inputs. Alternatively you could output a video with
ffmpegthen watch it as shown below.
There are modes other than
differencethat may fit your needs. See the documentation.
ffmpeg -i original.mkv -i encoded.mkv \
-filter_complex "blend=all_mode=difference" \
-c:v libx264 -crf 18 -c:a copy output.mkv
- You may need to add
,format=yuv420pto the end of your filterchain (immediately after
difference) to view the output in non-FFmpeg based players.