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

<pre><code>-filter_complex "blend=difference:shortest=1,blackf...
</code></pre>

CC BY-SA 3.0
2018-03-23T16:38:00.283Z
2018-03-23T16:38:00.283Z
Gyan
<p>I'm trying to find frames in a video that match a certain input image.  I'm currently using this command:</p>

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

<p>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.</p>

<p>Sample output (exited manually - video is only 8mins long):</p>

<pre>
[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.
</pre>

<p>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?</p>

<p>I'm using version <code>ffmpeg version n3.2.9-1-g519a54c</code></p>

CC BY-SA 4.0
2020-09-30T11:58:17.920Z
is there any command with "**ffmpeg.exe**" or it should be only "**ffmpeg**"
user3559780
<ffmpeg>
Finding frames in video that match an image
ilitirit
# Finding frames in video that match an image

(Asked by: username_0 on 2018-03-23)

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

**Tags:** ffmpeg

> **Comments:**
> **username_1**: is there any command with "**ffmpeg.exe**" or it should be only "**ffmpeg**"  

---

## 1 answers

### Answer by username_2 on 2018-03-23. Score: 4 | Accepted answer

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...


---

