最好的 Python 视频操作库?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/220866/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Best video manipulation library for Python?
提问by TheObserver
I'd like to include some simple video editing functionality for the Python application I'm writing and googling comes up with:
我想为我正在编写的 Python 应用程序和谷歌搜索提供一些简单的视频编辑功能:
- pymedia
- pyglet (using the media module)
- gst-python
- pymedia
- pyglet(使用媒体模块)
- gst-python
Requirements:
要求:
- Small footprint. I'm already using wxPython(just because), which bloats up the final EXE file pretty easily so preferably whatever I use to implement this video editing functionality shouldn't add to the bloat significantly.
- The library should still be actively maintained.
- It shouldn't require proprietary licensing, so FMOD is out of the question.
- Minimal dependencies
- Not a full-blown video editor. No need for fancy pants stuff. Just the ability to skip to different parts of a video and either grab a frame or put (multiple) markers for start and end of video sections to lop off bits.
- Cross platform - should be able to run on Windows, Linux and OS X at the end of the day.
- 占地面积小。我已经在使用wxPython(只是因为),它很容易使最终的 EXE 文件膨胀,所以最好是我用来实现这个视频编辑功能的任何东西都不应该显着增加膨胀。
- 图书馆仍应积极维护。
- 它不应该需要专有许可,因此 FMOD 是不可能的。
- 最小的依赖
- 不是一个成熟的视频编辑器。不需要花哨的裤子。只是能够跳到视频的不同部分,或者抓取一个帧或者为视频部分的开始和结束放置(多个)标记来删除位。
- 跨平台 - 最终应该能够在 Windows、Linux 和 OS X 上运行。
If you've used any of the above video editing libraries listed above or others I have yet to come across in your Python application, I'd like to know the pitfalls for each and how they stack up against each other. If you also know of a Python binding for avbin, I would like to know where to find it.
如果您使用过上面列出的任何上述视频编辑库或其他我尚未在您的 Python 应用程序中遇到的库,我想知道每个库的陷阱以及它们如何相互叠加。如果您还知道 avbin 的 Python 绑定,我想知道在哪里可以找到它。
gst-python (Gstreamer with Python bindings) doesn't seem to be very well documented. It also appears to be tightly coupled with pyGTK, which is also a pretty big toolkit.
gst-python(带有 Python 绑定的 Gstreamer)似乎没有很好的文档记录。它似乎也与 pyGTK 紧密结合,pyGTK 也是一个非常大的工具包。
回答by Dan Lenski
I would recommend that you look again at gst-python! It is notcoupled with pyGTK. You can use it completely separately, with no dependencies on either the Python bindings or the C libraries of GTK. I've written several command-line utilities that use gst-python and not GTK.
我建议你再看看 gst-python!它没有与 pyGTK 耦合。您可以完全单独使用它,不依赖于 Python 绑定或 GTK 的 C 库。我已经编写了几个使用 gst-python 而不是 GTK 的命令行实用程序。
It's true that the gst-python docsare not so great. However, the documentation for the C API and modulesis really very extensive, and the mapping from the C API to the Python API is very straightforward. And there is a very active Gstreamer community and I had good luck finding help on the mailing lists and IRC!
gst-python 文档确实不是很好。但是,C API 和模块的文档确实非常广泛,从 C API 到 Python API 的映射非常简单。并且有一个非常活跃的 Gstreamer 社区,我很幸运在邮件列表和 IRC 上找到了帮助!
回答by Ryan
I'm working on a project using pyglet right now and I absolutely love it. Their website is going slow right now, but normally the programming guideon their documentation page is an excellent introduction to the library. Their standard API documentation is also very thorough.
我现在正在使用 pyglet 进行一个项目,我非常喜欢它。他们的网站现在运行缓慢,但通常他们文档页面上的编程指南是对该库的极好介绍。他们的标准 API 文档也非常详尽。
I can't really go into the specifics right now of what our project is, but when you say you need
我现在无法详细说明我们的项目是什么,但是当你说你需要的时候
Not a full blown video editor. No need for fancy pants stuff. Just the ability to skip to different parts of a video and either grab a frame or put (multiple) markers for start and end of video sections to lop off bits.
不是一个成熟的视频编辑器。不需要花哨的裤子。只是能够跳到视频的不同部分,或者抓取一个帧或者为视频部分的开始和结束放置(多个)标记来删除位。
I can verify that pyglet will make coding this a breeze.
我可以验证 pyglet 将使编码变得轻而易举。
Going through the rest of your list, I can't speak for/against the file size right now, but pyglet is being actively maintained (in fact the devs were quite helpful to me on the bug tracker just two weeks ago), is BSD licensed, depends on nothing (with optional AVBIN support for additional file formats), It works for us on Windows and Linux.
浏览您列表的其余部分,我现在无法支持/反对文件大小,但是 pyglet 正在积极维护(实际上,开发人员在两周前就在错误跟踪器上对我很有帮助),是 BSD许可,不依赖任何东西(可选的 AVBIN 支持其他文件格式),它适用于我们在 Windows 和 Linux 上。
So far the only cross-platform gotcha we have come to is that as far as sound is concerned on Linux, you've got the option of OpenAL which will mix down stereo files to mono and ALSA which will not give you any volume control while a sound is playing. They claim that both of these problems are with upstream and are being worked on.
到目前为止,我们遇到的唯一跨平台问题是,就 Linux 上的声音而言,您可以选择 OpenAL,它将立体声文件混合成单声道和 ALSA,这不会给您任何音量控制,而有声音在播放。他们声称这两个问题都与上游有关并且正在解决中。
回答by Thomas Vander Stichele
gst-python isn't coupled with pygtk at all - it just happens to share a common object model (pygobject) and a way to help generate bindings. But you can easily use gst-python without pygtk - take Flumotionas an example.
gst-python 根本没有与 pygtk 结合——它只是碰巧共享一个公共对象模型(pygobject)和一种帮助生成绑定的方法。但是你可以在没有 pygtk 的情况下轻松使用 gst-python - 以Flumotion为例。
Here's a small demoI put together; one with an example of a player with a GTK frontend, and one with a wx frontend.
这是我放在一起的一个小演示;一个是带有 GTK 前端的播放器示例,另一个是带有 wx 前端的示例。
回答by smerten
I am currently in the same predicament. I have been fortunate to get in touch with the developers of the Ardome Media Library project.
我目前处于同样的困境。我有幸与Ardome 媒体库项目的开发人员取得了联系。
This library is a filter graph based system. It is freely based on the http://www.khronos.org/openml/I think.
这个库是一个基于过滤器图的系统。我认为它是免费基于 http://www.khronos.org/openml/ 的。
It currently runs on Linux and OS X with pending Windows integration.
它目前在 Linux 和 OS X 上运行,并带有待定的 Windows 集成。