如何处理cv :: VideoCapture解码错误? [英] How to deal with cv::VideoCapture decode errors?

查看:2854
本文介绍了如何处理cv :: VideoCapture解码错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用OpenCV的VideoCapture(使用ffmpeg支持编译)从IP摄像机流式传输H264内容。到目前为止,事情工作正常,但每隔一段时间我都会得到解码错误(来自ffmpeg我推测):



在$ 2600
[h264 @ 0x103006400]错误同时解码MB 26 10
[h264 @ 0x103006400] mb_type 137在我切片太大26 $ $ $ $ $ $ ]解码MB 25 5
[h264 @ 0x103006400] cbp太大(421)at 35 13
[h264 @ 0x103006400] ]错误解码MB 35 13
[h264 @ 0x103006400] mb_type 121在P切片太大20 3
[h264 @ 0x103006400]错误解码MB 20 3

这些消息显示在控制台中。有没有干净的方式听这些?



任何提示/提示?

解决方案

最近我解决了同样的问题,并尝试解释我遵循的步骤。



我更新了最近的 opencv_ffmpeg.dll (我将opencv_ffmpeg.dll重命名为opencv_ffmpeg310.dll以用于OpenCV 3.1,也重命名为相同的dll opencv_ffmpeg2412 .dll与OpenCV 2.4.12一起使用



通过这样做,一个基本的捕获帧和显示成功没有问题,但仍然是同样的问题,如果我做一些图像 - 处理或检测会导致捕获帧之间的延迟。



解决第二个问题,我使用线程连续抓取帧并更新全局 Mat 用于处理。



这里
你可以找到我的测试代码(需要一些改进,如更新Mat时使用互斥锁和锁定内存)



我希望这些信息将会很有用(对不起,我可怜的英语)


I'm streaming H264 content from an IP camera using the VideoCapture from OpenCV (compiled with ffmpeg support).

So far things work ok, but every once in a while I get decoding errors (from ffmpeg I presume):

[h264 @ 0x103006400] mb_type 137 in I slice too large at 26 10
[h264 @ 0x103006400] error while decoding MB 26 10
[h264 @ 0x103006400] negative number of zero coeffs at 25 5
[h264 @ 0x103006400] error while decoding MB 25 5
[h264 @ 0x103006400] cbp too large (421) at 35 13
[h264 @ 0x103006400] error while decoding MB 35 13
[h264 @ 0x103006400] mb_type 121 in P slice too large at 20 3
[h264 @ 0x103006400] error decoding MB 20 3

These messages show up in the console. Is there any clean way to listen to these ? I'd like to skip processing the glitchy frames.

Any hints/tips ?

解决方案

recently i have solved the same problem and try to explain the steps i followed.

i updated most recent opencv_ffmpeg.dll ( i renamed opencv_ffmpeg.dll to opencv_ffmpeg310.dll to use with OpenCV 3.1, also renamed same dll opencv_ffmpeg2412.dll to use with OpenCV 2.4.12

by doing that, a basic capturing frames and display became successful without problem.but still the same problem if i do some image-processing or detection causes delay between capturing frames.

to solve the second problem i used a thread to grab frames continiously and update a global Mat for processing.

here you can find my test code ( it need some improvements like using mutex and lock memory when update the Mat)

i hope the information will be useful ( sorry for my poor english )

这篇关于如何处理cv :: VideoCapture解码错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆