I created a Python project to split long educational videos into smaller segments, each focused on a single question. The program uses OCR to detect text on video frames, identifies the word "Question," extracts the number following it, and splits the video whenever the number increases.
here is the video i am tring to split ((video))
Here's an example of the program's output:
Video loaded: 14071 frames at 60 FPS, duration: 234.52s
Frame 480, Time 8.00s, Question: 6
...
Frame 12360, Time 206.00s, Question: 7
Creating segment 1: 8.00s to 206.00s
Error: module 'ffmpeg' has no attribute 'Error'
I've shared the full code in a GitHub repository for reference: Automated Video Scene Cutting.
What the Program Does
- Input: A long educational video.
- Processing:
- Detects text in each frame using OCR.
- Searches for the word "Question" followed by a number.
- Monitors when the number increases to identify segment boundaries.
- Output: Creates video segments corresponding to individual questions.
The Problem
The program detects the questions and timestamps correctly, but when it tries to create the segments, I encounter the following error:
Error: module 'ffmpeg' has no attribute 'Error'
What I've Tried
- Verified the
ffmpeg-python
library is installed (pip show ffmpeg-python
confirms the installation). - Ensured the
ffmpeg
binary is accessible from the command line. - Reviewed the library documentation to ensure the correct usage of
ffmpeg
. - Tested with different video files to rule out input-specific issues.
Environment Details
- OS: Windows 11
- Python Version: 3.9.13
- Key Libraries:
ffmpeg-python
If anyone has insights into resolving this issue or suggestions for alternative approaches to handle this use case, I'd greatly appreciate your help.
Thank you!
-- video, Automated Video Scene Cutting