在 Qt 中播放视频(在 Mac 上)
这个问题是由于我第一次使用视频和不熟悉 Mac 的结合而产生的。基本上,我发现很难弄清楚如何使用任何标准格式(例如 avi、mpeg、mov 等)播放视频(在 QWidget 内或以其他方式)。特别是
QMovie::supportedFormats ()
只给我 .gif 和 .mng,但我需要使用标准格式。有没有办法增加支持的格式数量?Phonon
需要存在 '虽然网络上有很多 avi(等)播放器,但我认为我可能不太可能使用它们 - 我需要开始、停止和更改视频的播放速度以编程方式,即通过我的 C++ 程序。
我不知道为什么这会如此困难——相比之下,在 Qt 中处理图像简直就是小菜一碟。那么:在 C++/Qt 程序中播放视频的好方法是什么?
This question arises out of a combination of this being my first time working with video and unfamiliarity with Macs. Basically I'm finding it difficult to figure out how to play a video (within a QWidget, or otherwise) using any standard format, e.g. avi, mpeg, mov, etc. In particular,
QMovie::supportedFormats()
gives me only .gif and .mng, but I need to use standard formats. Is there a way to increase the number of supported formats?Phonon
requires the presence of a 'backend' which the user has to implement himself. I looked to see if I could somehow do this with Quicktime, but I couldn't get the application to launch--and anyway I didn't really see how to do that. Also,Phonon
looks pretty heavyweight, I'd like to avoid it if I could.While there are plenty of avi (et al.) players floating around on the web, I think it's probably unlikely I'd be able to use them--I need to start, stop, and change the playback speed of videos programmatically i.e. through my C++ program.
I'm not sure why this should be so hard--working with images in Qt is a snap by comparison. So: What's a good way to play videos from within a C++/Qt program?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
停止你现在正在做的事情:声子已经成为过去,Qt Mobility 是未来。
下载、编译并安装 Qt Mobility 后,请检查示例:videowidget 和 videographicsitem,位于:
qt-mobility-opensource-src-1.2.0/ example/
他们几乎回答了你所有的问题。
Stop what you are doing right now: Phonon is the past, Qt Mobility is the future.
After you download, compile and install Qt Mobility, check the examples: videowidget and videographicsitem, located at:
qt-mobility-opensource-src-1.2.0/examples/
They pretty much answer all your questions.