7

I got a video of a fireplace, the video is 3 hours long.

I can see that it is looping as the logs keep burning forever. My guess is that it is looping in the region of 5-15minutes.

Is there some software available that can find where the video loops?

So far my best idea is using ffmpeg to output all the frames in raw bmp and search for duplicate files.

1
  • That's a tough question. Your solution may be the most straightforward. I'd recommend outputting as PNG instead of BMP, since the files will be smaller. You also might be able to output the audio file and look for duplicate 3-second-long stretches of audio. That would take up way less disk space, though I don't know what software to use to make the comparison. Commented Nov 17, 2016 at 17:29

1 Answer 1

7

Try

ffmpeg -i video.mp4 -filter_complex
"[0]trim=start_frame=0:end_frame=1[c];[c][0]blend=all_mode=difference,blackframe" -f null -

As long as the very first frame of the video is not something like a static logo screen or similar, this should help you locate the loop joint. If it is, change the start frame value to a higher number. The end_frame should be 1 greater. Basically, one instance of the video is trimmed to just one frame, then it's composited with the full video frame-by-frame, in difference mode. When the blend filter encounters an identical frame i.e. the point of loop, the result will be a black frame. The blackframe filter should then identify that frame (and all others at each loop turnover), with a readout looking like this:

[Parsed_blackframe_2 @ 0000000003607d20] frame:325 pblack:100 pts:13837 t:13.837000 type:I last_keyframe:325

That t value represents the duration of a single loop.

1
  • 2
    If anyone else is a dummy like me, and getting errors, try making sure the code isn't split onto multiple lines. ;)
    – aName
    Commented Apr 28, 2020 at 19:02

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