Answers.Body: <p>Try</p>
  
  <pre><code>ffmpeg -i video.mp4 -filter_complex
  "[0]trim=start_frame=0:end_frame=1[c];[c][0]blend=all_mode=difference,blackframe" -f null -
  </code></pre>
  
  <p>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:</p>
  
  <pre><code>[Parsed_blackframe_2 @ 0000000003607d20] frame:325 pblack:100 pts:13837 t:13.837000 type:I last_keyframe:325
  </code></pre>
  
  <p>That <code>t</code> value represents the duration of a single loop.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-28T19:02:25.733Z
Answers.Text: If anyone else is a dummy like me, and getting errors, try making sure the code isn't split onto multiple lines. ;)
Answers.UserDisplayName: aName
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-17T19:25:18.433Z
Answers.LastActivityDate: 2016-11-17T19:25:18.433Z
Answers.UserDisplayName: Gyan
Body: <p>I got a video of a fireplace, the video is 3 hours long.</p>
  
  <p>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.</p>
  
  <p>Is there some software available that can find where the video loops?</p>
  
  <p>So far my best idea is using ffmpeg to output all the frames in raw bmp and search for duplicate files.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-11-17T17:29:07.307Z
Comments.Text: 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.
Comments.UserDisplayName: BrettFromLA
Tags: <ffmpeg><software-recommendation>
Title: Finding the place where a video loops
UserDisplayName: Zalon
ThreadText: # Finding the place where a video loops
  
  (Asked by: username_0 on 2016-11-17)
  
  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.
  
  **Tags:** ffmpeg, software-recommendation
  
  > **Comments:**
  > **username_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.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2016-11-17. Score: 7 | Accepted answer
  
  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.
  
  > **Comments:**
  > **username_3**: If anyone else is a dummy like me, and getting errors, try making sure the code isn't split onto multiple lines. ;)  
  
  ---
  
  