cv::VideoWriter 产生不可读的视频
我想用 52fps 的 RGB 图像流生成一个视频文件。我发现 opencv api 使用起来非常方便(cv::VideoWriter)。问题是我只能用VLC播放生成的avi;它播放视频但大喊:
[0x28307b0] xcb_xv generic error: no available XVideo adaptor
任何其他视频播放器(在同一台计算机上)都无法读取和播放该视频。 录制时一切看起来都正常:我得到有关输出、帧大小、视频编解码器、fps 等的信息......没有错误。
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,但它们都无法正常工作。
我想在不同计算机上使用任何视频播放器播放此视频。我怎样才能让它发挥作用? VideoWriter 是正确的选择吗?
任何建议都非常受欢迎。
谢谢。
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
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
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.
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?
Any suggestion is very welcome.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您的图像有视频源,最好使用相同的编解码器进行输出:
或者,您可以尝试更旧、更简单的 FOURCC。或者是 Microsoft 特定的,如果您只想在 Windows 上运行它。
If you have a video source for your images, it would be a good idea to use the same codec for output:
Or, you can try an older, simpler FOURCC. Or a Microsoft-specific, if you want to run it only on Windows.