0
点赞
收藏
分享

微信扫一扫

OpenCV VideoWriter 写入自定义尺寸视频卡死问题

90哦吼 2022-01-12 阅读 81

参考文章 stackoverflow中的高赞回答。

我在使用opencv videowriter 写入视频的时候,发现有时候会卡死在videowriter 的release 方法,或者说会卡死在videowriter 的析构方法上,一直排查不到原因。后来看了上面的帖子,启发了我,主要是这句:

For me, this code does work, but MJPG does round the odd resolution to an even resolution. H264 did not work with that resolution at all.

分辨率如果是基数的话编解码没法正确处理,因此在自定义尺寸的时候,如果恰好是基数分辨率就±1改成偶数再保存,这样问题就解决啦。

举报

相关推荐

0 条评论