6

I'm trying to find frames in a video that match a certain input image. I'm currently using this command:

ffmpeg.exe -i video.mp4 -loop 1 -i image.jpg -an -filter_complex "blend=difference,blackframe=99:32" -f null -

This spits out the frames whose difference between the input image is less than 32 for 99% of the pixels. The problem is the process doesn't appear to stop.

Sample output (exited manually - video is only 8mins long):

[Parsed_blackframe_1 @ 0000000003421660] frame:6498 pblack:100 pts:3326976 t:216.600000 type:P last_keyframe:6496
[Parsed_blackframe_1 @ 0000000003421660] frame:6499 pblack:99 pts:3327488 t:216.633333 type:P last_keyframe:6496
[Parsed_blackframe_1 @ 0000000003421660] frame:9839 pblack:99 pts:5037568 t:327.966667 type:P last_keyframe:9832
[Parsed_blackframe_1 @ 0000000003421660] frame:9840 pblack:99 pts:5038080 t:328.000000 type:P last_keyframe:9832
frame=18321 fps=495 q=-0.0 Lsize=N/A time=00:10:25.26 bitrate=N/A speed=16.9x
video:8731kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Exiting normally, received signal 2.

Is there a way to tell ffmpeg to stop once it reaches the end of the file, or is there maybe a different way to achieve what I'm trying to do?

I'm using version ffmpeg version n3.2.9-1-g519a54c

1
  • is there any command with "ffmpeg.exe" or it should be only "ffmpeg" Sep 30, 2020 at 11:58

1 Answer 1

4

The blend filter can be told to terminate with the shortest input, which in your command, will be the video.

-filter_complex "blend=difference:shortest=1,blackf...

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.