Number of cuts in a 30min video file

slice, video

Solution

As other answers have pointed out, obtaining good accuracy with an automatic solution is difficult. Crossfades, zooms, pans, etc... all make it difficult for an automatic tool to conclude if consecutive frames belong to the same scene or not.

That being said, I would try to use the OpenCV library to analyze differences between consecutive frames and try to determine, using some empirical threshold, if they are similar enough to be considered from the same scene (choose the interval of frames, not necessarily every frame).

It's easy to extract frames from a video using the VideoCapture class.

Once frames are extracted you can use various methods to try to decide if two frames are related.

A few ideas:

- Use the Lucas-Kanade method to find the optical flow between frames and conclude if the difference indeed results from motion of objects in the frames, or if it's completely different scenes.

- Use a features detection algorithm (SIFT, SURF, etc) to characterize the frame and compare it to other frames. See also discussion here.

Good luck!

Problem

I have a video that is 30min long (encoded mp4:h264) and I need to count the numbers of cuts in the movie. It should include cuts as well as cross-fades. So something quite similar to i-Frame detection.... I have available Linux with ffmpeg / libav as well as a Windows with Adobe Premiere. Any clues? Or other software?

Original source