Generating the supercut shows video_fps key error
cmprmsd opened this issue · 2 comments
Sometimes, when videogrep generates the final output it seems to have issues calling moviepy the correct way. Maybe it's an upstream error in moviepy or ffmpeg_reader.py itself.
Here's the output
...
Moviepy - video ready supercut.mp4.tmp0.mp4
[+] Creating clips.
[+] Concatenating clips.
[+] Writing ouput file.
Moviepy - Building video supercut.mp4.tmp20.mp4.
MoviePy - Writing audio in temp-audio1655024971.7431457.m4a
MoviePy - Done.
Moviepy - Writing video supercut.mp4.tmp20.mp4
Moviepy - Done !
Moviepy - video ready supercut.mp4.tmp20.mp4
Traceback (most recent call last):
File "/usr/bin/videogrep", line 8, in <module>
sys.exit(main())
File "/usr/lib/python3.10/site-packages/videogrep/cli.py", line 146, in main
videogrep(
File "/usr/lib/python3.10/site-packages/videogrep/videogrep.py", line 466, in videogrep
create_supercut_in_batches(segments, output)
File "/usr/lib/python3.10/site-packages/videogrep/videogrep.py", line 288, in create_supercut_in_batches
clips = [VideoFileClip(filename) for filename in batch_comp]
File "/usr/lib/python3.10/site-packages/videogrep/videogrep.py", line 288, in <listcomp>
clips = [VideoFileClip(filename) for filename in batch_comp]
File "/usr/lib/python3.10/site-packages/moviepy/video/io/VideoFileClip.py", line 88, in __init__
self.reader = FFMPEG_VideoReader(filename, pix_fmt=pix_fmt,
File "/usr/lib/python3.10/site-packages/moviepy/video/io/ffmpeg_reader.py", line 37, in __init__
self.fps = infos['video_fps']
KeyError: 'video_fps'
Command: videogrep --input source/**/*.mp4 --search 'freunde der sonne' --search-type fragment --padding 0.1
This happens on some keywords. I don't know yet what's causing it. I will try adding one video after the other until the fps error occurs.
All videos have the same codec as I downloaded them with yt-dlp -f 22 ...
as your great tutorial on your blog stated. :)
Immediate edit :laugh:
The error is caused by --padding 0.1. Removing it circumvents the error message. But I can't imagine that this phrase occurs directly one after the other within one video which might cause overlapping issues.
I'm guessing this is a bug where the padded clip is exceeding the duration of the video! Not sure, but will check it out...
I believe this should be fixed now in the master branch.