New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cv2.VideoCapture() dropping 2 frames per second #19930
Comments
I'm having an issue of the same with a webm video. It reports a frame rate of an even 30. VLC reports a frame rate of 23.976024 which I'm pretty sure from avmux is a standard frame rate which commonly appears. Standard H264 mp4 encoding. This is version 4.5.2, fresh build. capture the videocap = cv2.VideoCapture('../../input/01.webm') get the video frames' width and height for proper saving of videosframe_width = int(cap.get(3)) frame_count = int(cap.get(cv2.CAP_PROP_FRAME_COUNT)) |
I ended up using ffmpeg-pythons's tensorflow implementation. If interested, you can take a look at https://github.com/vijishmadhavan/SkinDeep/blob/master/videoProcessor.ipynb to see the crude parse of the ffmpeg banner for fps and such. |
@3dsf how did you get it working ? on ubuntu ? I'm having difficulty building it because of that damn bazel crap of googles. |
hey @makingglitches, I cut out the model I was running and put in a This requires
add your stuff at I seem to remember a bug for no sound videos, but I was only doing this for audio matching; if it is important to you, I'll let you fix it (Should be super minor). My understanding is that openCV uses ffmpeg-python, so I don't feel bad sharing this stopgap here. Based on your original comment and my original thoughts, this may have routes in how fps is calculated. |
@3dsf alot of variables in that script need predefined as they are out of scope when used. Kind of funny how this just wraps ffmpeg like one of my projects does it looks like :P interpreting its highly parseable output. |
Appears frames reported between webm and mp4 are differing between lib and ffprobe. 01.webm (an input file i'm using) in the lib reports 6544 frames
1.mp4 (another input file I'm using) in the lib reports 7538 frames, the same as ffprobe. I don't know what that suggests since I would think ffmpeg would be getting used all around for detection of these things and I would tend towards testing its output. Sorry for the earlier mistake, still waking up. |
@makingglitches |
@3dsf that code file you provided didn't run without being tweaked heavily |
@makingglitches |
@3dsf yes it did not run as is Christ provide me with some notion that I'll be well off and this won't all be scrapped and I'll fix the damn code which will require a time investment for sure lol |
System information (version)
openCV.config.txt from system install, rather than enviroment
Detailed description
cv2.VideoCapture() is missing 2 frames per second
5 second video @ 23.98 fps
ffmpeg -i c.mp4 ffmpeg.%03d.png
Image 110 from VideoCapture appears to be the same as image 120 from ffmpeg
Tested with {1..5} seconds, 2 frames missing per second
Crashes with a None frame error as no more frames arrive.
Steps to reproduce
Same results with
Video :
Issue submission checklist
forum.opencv.org, Stack Overflow, etc and have not found solution
The text was updated successfully, but these errors were encountered: