Video Cut Counter
Local video analysis for counting cut transitions.
My kids were watching a TV show yesterday on Netflix, and I noticed how rapidly the scenes were changing. The pacing of these modern productions felt noticeably different from the classic Disney cartoons I grew up with. Aside from the phosphorescent color palettes, the rapid scene changes of recent kid shows indicated the cultural arms race to maintain the viewer’s attention by increasing the frequency of cuts.
Building a Python Application to Analyze Hard Cuts
Curious to quantify this observation, I decided to build a Python application to analyze hard cuts in MP4 videos. My goal was to evaluate how frequently scenes change and whether this rapid pacing is indeed a defining characteristic of modern content.
Iconic Movie Scene Analysis
The first video I analyzed was Steamboat Willie. However, the inconsistency in its film exposure led to numerous false positives. To refine my analysis, I ran the application on iconic movie scenes known for their distinct editing styles:
- The journey to the island scene from Jurassic Park
- The shower scene from Psycho
- The final scene from Whiplash
- The continuous, no-cut steadicam sequence from Goodfellas (as expected, the script detected no cuts)
I even used the script to analyze a recent project of mine to understand my own editing style and the pacing of my video content.
Analysis Results
The Python script outputs detailed data for each analyzed video, including:
- Elapsed Time: How long the script took to process the video.
- Total Cuts Detected: For example, 140 cuts in a given video.
- Video File Name: The name of the processed video file.
It also provides a Shot Duration Distribution breakdown, such as:
< 1 second: 64 1 - 2 seconds: 32 2 - 3 seconds: 20 3 - 4 seconds: 10 4 - 5 seconds: 6 5 - 10 seconds: 5 10 - 20 seconds: 2 20 - 30 seconds: 1 30+ seconds: 0
Descriptive Statistics
Statistic | Shot Duration (seconds) |
---|---|
Count | 140 |
Mean | 2.4 |
Standard Deviation | 1.8 |
Min | 0.3 |
25th Percentile | 0.9 |
50th Percentile | 1.7 |
75th Percentile | 3.5 |
Max | 15.2 |
All results are logged and appended to a CSV file for easy review and analysis.
Performance Optimization
The script processes over 1,800+ frames per second on average. Processing speed improved significantly when analyzing lower-resolution videos. To streamline this, I developed a separate Python script as a sub-project to downscale 1080p content to 720p or 360p, renaming the files accordingly.
Challenges and Next Steps
This project turned out to be more intriguing than I expected, raising more questions than answers. While hard cuts were straightforward to detect, attempts to identify other transition types, such as dip to black, dip to white, and crossfades. These were less successful due to their increased variability. I believe Machine Learning could be the key to accurately detecting these more complex transitions. Exploring this approach is next on my list, and I'm excited to see where it leads.
This project provided fascinating insights into the evolving world of video editing and viewer engagement. The ability to quantify scene changes and shot durations can be a powerful tool for filmmakers, video editors, and anyone interested in understanding modern media consumption patterns.