I am trying to write a script that compares a version of a video file to a master file that has been quality checked and outputs any frames that differ from the master as .jpeg files with timecode burned in. I'm using this command (wrapped in an Automator script):

ffmpeg -i file_to_test.mp4 -i master_file.mov -filter_complex "scale2ref[1:v] [0:v],[1:v]format=yuva444p,lut=c3=128,negate[video2withAlpha],[0:v][video2withAlpha]overlay[out1],[out1]drawtext=timecode='00\:00\:00\:00': r=24: x=(w-tw)/2: y=h-(2*lh): fontcolor=white:fontsize=42[out2],[out2]select='gt(scene,0.001)'[out3]" -map [out3] -vsync 0 output%05d.jpg

It works fairly well. The script creates a 50% grey video with only differences showing. I then run that trough select='gt(scene,0.001)' to only output frames that differ from the previous frames. It successfully detects glitches that are a bit bigger. Like lines going through the frame. But it doesn't detect single black pixels for example. Now my idea is to look for ymin and ymax values and output all the frames, which have pixels differing from 50% grey by a certain amount. I'm sure this could be done trough signalstats. But I am stuck here. Can anyone of the pros here advise how to do this? In the best case keeping everything in a single command.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.