GUI 应用程序中视频播放的多媒体框架?
前段时间我开始了一个项目,我需要做以下事情:
- 播放视频:
- 任何常见格式(avi、mpeg、xvid 等)
- 能够以编程方式暂停和重新定位流。
- 能够设置播放速度(不是强制性的,但需要)
- 让我在播放组件上绘制自定义图形(与视频保持同步)。
- 允许以光栅图像的形式访问当前帧(这不是强制性的,但需要)。
而且也易于使用(例如,面向视觉组件,我不想处理太多多媒体流的内部结构)。
由于我已经用 Java 编写了一些相关代码,因此我尝试了我找到的所有 Java 库(JMF、FMJ、JVLC、Jffmpeg、gstreamer-java),但没有人满足我所有的硬性要求(例如,那些允许我画在框架上无法暂停或倒带,那些功能齐全的已经过时了等等),所以我搁置了该项目。
现在我有心情卷土重来,我不介意用其他语言重写代码(水平等于或高于Java,但请不要使用C或C++,我已经变得太懒了:-p)也有一个很好的 GUI 框架或免费的富客户端平台。 多平台是一个很好的点,因为我喜欢在 Linux 中进行开发和测试,但我想接触到更多的受众,因此能够针对 Windows 是必须的。
那么您会推荐我什么语言和框架?
Some time ago I started a project in which I needed to do the following things:
- Play videos:
- In any common format (avi, mpeg, xvid, etc.)
- Be able to pause and reposition the stream programmatically.
- Be able to set the playback speed (not mandatory, but desirable)
- Let me paint custom graphics (kept in sync with the video) over the playback component.
- Allow access the current frame as a raster image (this is not mandatory, but desirable).
And also be easy to use (e.g. visual component oriented, I don't want to deal a lot with the multimedia streams internals).
As I already had some related code written in Java, I tried with all the Java libraries that I found (JMF, FMJ, JVLC, Jffmpeg, gstreamer-java) but no one satisfied all my hard requirements (for example, those which allowed me to draw over the frame couldn't be paused or rewinded, those which were full-featured were outdated, etc.), so I put the project on hold.
Now I'm on the mood for a comeback and I won't mind to rewrite the code in other language (of a level equal or higher than Java, but please not C or C++, I've become too lazy :-p) that has a good GUI framework or Rich Client Platform freely available too. Being multiplatform is a good point, as I like to develop and test in Linux, but I'd like to reach a larger audience, so being able to target Windows is a must.
So what language and frameworks would you recommend me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
Qt 的声子。 Qt 也可用于 Java,如 Qt Jambi 。
Qt's Phonon. Qt also is available for Java, as Qt Jambi.
如果您并不完全害怕只使用 Windows,那么 WPF 应该能够满足您的几乎所有(如果不是全部)需求。
您可以将它与 C# 和所有 .net 语言一起使用。
If you're not totally afraid to go windows only, WPF should respond to nearly all, if not all, of your demands.
You can use it with C# and all .net language.
我会使用 OpenCV 库。
这里有您需要的所有功能:格式支持、任意帧获取、帧修改等。
查看此安装指南和一些示例。
I would use OpenCV library.
There are all the features you need: formats support, any frame fetching, frame modification, etc.
Check out this installation guide and some samples.
您可能会考虑的另一个框架是 mlt 框架: http://mltframework.org/
它的设计很棒,是用 C 编写,并使用 SWIG 进行语言绑定(java、perl、php、python、ruby、tcl)。我知道人们已经让它在大多数主要平台上运行。
要了解它的功能,请查看令人敬畏的 NLE kdenlive,它是最活跃的用户。
Another framework you might consider is the mlt framework: http://mltframework.org/
It's got a great design, is written in C, and uses SWIG for language bindings (java, perl, php, python, ruby, tcl.) I know people have had it running on most of the major platforms.
To understand what it's capable of, check out the awesome NLE kdenlive, it's most active user.
你说你尝试过gstreamer-java。 也许它的绑定不是那么好? 我非常确定 Gstreamer 可以满足您的所有要求。 也许您应该检查一下 Python 绑定。 Python 是 Gstreamer 开发人员的一等公民,因此绑定应始终完整且最新。
Python 还具有多个可用的跨平台 GUI 框架。 就我个人而言,我喜欢使用 libglade 的 GTK,因为使用 Glade 构建 GUI 非常容易,而且它是 XML 文件(GTK 也可以在 Windows 上运行,所以没有问题)。 如果您更喜欢其他东西,那么还有 Qt、wxWidgets 和 Tk,它们都可以在 Linux 和 Windows 上运行(我假设也可以在 MacOSX 上运行)。
You say that you tried gstreamer-java. Perhaps it's bindings aren't all that good? I am pretty sure that Gstreamer can do all that you ask. Perhaps you should check out the Python bindings instead. Python is a first class citizen for the Gstreamer developers so the bindings should always be complete and up-to-date.
Python also has multiple cross-platform GUI frameworks available. Personally I like GTK using libglade because it's ridiculously easy to build a GUI using glade and it's XML files (and GTK runs on Windows too, so no problem there). If you prefer something else then there's Qt, wxWidgets and Tk, all of which run on Linux and Windows (and I assume MacOSX as well).
嵌入式 Web 浏览器可以满足您的要求:
光栅化当前帧会比较困难,您可能需要一些自定义 ffmpeg 将帧转储到磁盘,然后将其读回为 << 图像>
An embedded web browser would handle your stated requirements:
To raster the current frame would be harder, you may need some custom ffmpeg to dump a frame to disk then read it back in as an < img >