M. *_*len 7 python opencv h.264 python-3.x
I am reading a video file with OpenCV for image recognition where I'm just interested in 1 of 60 frames every second, so instead of capturing 60 frames before getting to the next one I thought I could speed up the code by setting frame position between each iteration
while (capture.isOpened()):
capture.set(cv2.CAP_PROP_POS_FRAMES, frame_count)
ret, frame = capture.read()
frame_count += round(fps)
if ret:
...
Run Code Online (Sandbox Code Playgroud)
However, when I do it this way the following errors keep spamming in the terminal:
[h264 @ 0x21fc89c0] co located POCs unavailable
[h264 @ 0x21fba0a0] mmco: unref short failure
Run Code Online (Sandbox Code Playgroud)
and it looks like it's reading two frames, then waiting a little or slowing down before the next frame, and then reading two frames fast after each other again:
如果我以“正常”方式读取所有帧但仅在每 60 帧上运行图像识别,则它完全正常工作,但是如果我增加运行图像识别之间的间隔(例如每分钟 1 帧或更少)我经验,实际上需要相当多的时间来捕捉所有我不用于任何东西的帧。
对此的任何输入都将不胜感激,我已经搜索了很长一段时间的解决方案,但还没有找到任何东西:)
归档时间: |
|
查看次数: |
1162 次 |
最近记录: |