我有一个宠物项目,其中包含一个带有显示字幕功能的视频播放器.到目前为止,我正在研究项目的其他部分,但现在我必须以最佳方式实现字幕渲染部分.
我没有发现任何为此而有用的,除了这个.
但是当我使用这段代码时,我得到了错误的视频图片.

颜色被修改:红色→蓝色,蓝色→红色等.
有人可以帮助我使用此代码,或者向我展示另一种在视频上渲染字幕的解决方案吗?
PS:我用PySide 1.0.0,1.0.6以及Arch和Ubuntu linux进行了测试.
感谢alexisdm,这是一个丑陋的黑客攻击.它改变了paint()反转颜色的方法.
import sys
from PySide.QtGui import QApplication, QMessageBox
# overlay
from PySide.QtGui import QGraphicsScene, QGraphicsView, QGraphicsProxyWidget, QPainter, QImage
from PySide.QtOpenGL import QGLWidget
from PySide.phonon import Phonon
try:
from OpenGL import GL
except ImportError:
app = QApplication(sys.argv)
QMessageBox.critical(None, "OpenGL 2dpainting",
"PyOpenGL must be installed to run this example.",
QMessageBox.Ok | QMessageBox.Default,
QMessageBox.NoButton)
sys.exit(1)
#class CustomProxy(QGraphicsProxyWidget):
# def __init__(self, parent=None):
# QGraphicsProxyWidget.__init__(self, parent)
#
#
# def …Run Code Online (Sandbox Code Playgroud)