Python 视频框架

发布于 2024-07-25 13:36:27 字数 161 浏览 3 评论 0原文

我正在寻找一个 Python 框架,它将使我能够播放视频并在该视频上绘图(用于标记目的)。

我尝试过 Pyglet,但这似乎效果不是特别好 - 在现有视频上绘图时,会出现闪烁(即使使用双缓冲和所有这些好东西),而且似乎没有办法在每帧回调期间获取视频中的帧索引(仅自上一帧以来经过的时间)。

I'm looking for a Python framework that will enable me to play video as well as draw on that video (for labeling purposes).

I've tried Pyglet, but this doesn't seem to work particularly well - when drawing on an existing video, there is flicker (even with double buffering and all of that good stuff), and there doesn't seem to be a way to get the frame index in the video during the per-frame callback (only elapsed time since the last frame).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

旧人哭 2024-08-01 13:36:28

尝试使用 OpenCV 的 Python 包装器,例如 ctypes-opencv。 C API 参考位于此处,并且包装器非常接近(请参阅文档字符串任何变化)。

我用它在视频上绘图,没有任何闪烁,所以你应该没有问题。

您需要的调用的粗略轮廓:

  • 使用 cvCreateFileCapture 加载视频,使用 cvFont 加载字体。
  • 使用 cvQueryFrame 抓取帧,增加帧计数器。
  • 使用 cvPutText、cvEllipse 等在框架上绘制。
  • 使用 cvShowImage 向用户显示。

Try a Python wrapper for OpenCV such as ctypes-opencv. The C API reference is here, and the wrapper is very close (see docstrings for any changes).

I have used it to draw on video without any flicker, so you should have no problems with that.

A rough outline of calls you need:

  • Load video with cvCreateFileCapture, load font with cvFont.
  • Grab frame with cvQueryFrame, increment your frame counter.
  • Draw on the frame with cvPutText, cvEllipse, etc etc.
  • Display to user with cvShowImage.
窗影残 2024-08-01 13:36:28

Qt (PyQt) 有 Phonon,这可能会有所帮助。 PyQt 可作为 GPL 或付费软件使用。 (Qt 也有 LGPL,但 PyQt 包装器没有)

Qt (PyQt) has Phonon, which might help out. PyQt is available as GPL or payware. (Qt has LGPL too, but the PyQt wrappers don't)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文