cv :: VideoWriter产生不可读的视频 [英] cv::VideoWriter yields unreadable video

查看:108
本文介绍了cv :: VideoWriter产生不可读的视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从以52fps流动的RGB图像流中产生视频文件.我发现opencv api非常易于使用(cv :: VideoWriter).问题是我只能用VLC播放制作的avi.播放视频但大喊:

I want to produce a video file out of a stream of RGB images flowing at 52fps. I found the opencv api pretty handy to use (cv::VideoWriter). The problem is that I can play the produced avi only with VLC; which plays the video but yells:

[0x28307b0] xcb_xv generic error: no available XVideo adaptor

任何其他视频播放器(在同一台计算机上)都无法读取和播放视频. 录制所有内容时看起来还不错:我得到有关输出,帧大小,视频编解码器,fps等的信息.没有错误.

Any other video player (on the same computer) is not able to read and play the video. While recording everything looks ok: I get information about the output, about the size of the frame, the video codec, the fps, etc...no error.

Output #0, avi, to '01-23-12_15-24-51.avi':
Stream #0.0: Video: flv, yuv420p, 500x242, q=2-31, 7744 kb/s, 90k tbn, 52tbc 

由于OpenCv仅支持avi作为视频容器,所以我唯一可以更改的是视频编解码器,我尝试使用(FOURCC代码)FLV1,DIVX,DIV3,但它们均无法正常工作.

As OpenCv only supports avi as video container, the only thing I could change is the video codec, I tried (FOURCC code) FLV1, DIVX, DIV3 but none of them works correctly.

我想用不同计算机上的任何视频播放器播放此视频.我该如何运作? VideoWriter是正确的选择吗?

I would like to play this video with any video player on different computers. How can I make it work? is VideoWriter the right choice?

任何建议都非常欢迎.

谢谢.

推荐答案

如果您有图像的视频源,则最好使用相同的编解码器进行输出:

If you have a video source for your images, it would be a good idea to use the same codec for output:

int videoType = (int)cap.get(CV_CAP_PROP_FORMAT);

VideoWriter vout;
vout.open(videofile + "_out.avi", videoType, 30, imgSize);

或者,您可以尝试使用更旧,更简单的FOURCC.或者,如果您只想在Windows上运行,则为Microsoft专用.

Or, you can try an older, simpler FOURCC. Or a Microsoft-specific, if you want to run it only on Windows.

这篇关于cv :: VideoWriter产生不可读的视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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