Python Video Framework

随声附和 提交于 2019-12-22 08:06:46

问题


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).


回答1:


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.



回答2:


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)




回答3:


Try the Python bindings for GStreamer.



来源:https://stackoverflow.com/questions/1003376/python-video-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!