2

I use this FFmpeg command to compare 2 videos:

ffmpeg -i video1.mp4 -i video2.mp4 -filter_complex "[0:v][1:v]blend=difference,blackframe=1:10" -f null -'

The command compares the same frame in each video.

I want to compare different frames from each video. For example, start at frame 0 of video1 but frame 5 of video2.

I tried to use the following command, but it simply started the compare of both videos at frame 5:

'ffmpeg -i video1.mp4 -i video2.mp4 -filter_complex "[0:v]select=gte(n\,0)[video1]; [1:v]select=gte(n\,5)[video2]; [video1][video2]blend=difference,blackframe=1:10" -f null -'

Is what I'm trying to do possible with Ffmpeg?

Note that I tried other approaches that didn't work:

  1. Comparing images generated from frames (create image from a frame, compare, go to next frame) but that was extremely time consuming and impractical for long clips.

  2. Cutting and reencoding is also not an option due to the loss of quality and time required.

Blind Spots
  • 2,607
  • 1
  • 16
  • 21
hell
  • 21
  • 2
  • 3
    add `-ss 0.2` before input (0.2 = 5 frames/25 fps) – Баяр Гончикжапов Jun 18 '23 at 04:08
  • 1
    Cross-posting https://video.stackexchange.com/questions/36598/compare-2-videos-at-different-frames-with-ffmpeg – harrymc Jun 18 '23 at 09:55
  • 1
    Does this answer your question? [How to cut at exact frames using ffmpeg?](https://superuser.com/questions/459313/how-to-cut-at-exact-frames-using-ffmpeg) – harrymc Jun 18 '23 at 09:56
  • The question above is not too related to comparing frames. – Destroy666 Jun 18 '23 at 15:57
  • If you are trying to compare frame quality between a source and its output, it would be better to do so with the `VMAF` filter, which will give you a score for the quality of the output. In any case, you will still need to make sure that your frames are aligned and in sync for both inputs, and you can do this by using `trim` instead of `select` (assuming the framerate for both is equal). – programmar Jun 22 '23 at 22:04

0 Answers0