如何在PYQT媒体播放器中加入houndypy?

发布于 2025-02-04 14:39:53 字数 1002 浏览 3 评论 0原文

我正在Python 3和Pyqt5中开发视频编辑器。我想将QMediaPlayer Widget和Qvideowidget与Hoypy一起使用。我尝试使用以下代码来播放视频:

self.mediaPlayer = QMediaPlayer(None, QMediaPlayer.VideoSurface).setMedia(QMediaContent(VideoFileClip('aaaspain.mp4')))

但是它返回了我的错误:

TypeError: arguments did not match any overloaded call:
  QMediaContent(): too many arguments
  QMediaContent(QUrl): argument 1 has unexpected type 'VideoFileClip'
  QMediaContent(QNetworkRequest): argument 1 has unexpected type 'VideoFileClip'
  QMediaContent(QMediaResource): argument 1 has unexpected type 'VideoFileClip'
  QMediaContent(Iterable[QMediaResource]): argument 1 has unexpected type 'VideoFileClip'
  QMediaContent(QMediaContent): argument 1 has unexpected type 'VideoFileClip'
  QMediaContent(QMediaPlaylist, contentUrl: QUrl = QUrl()): argument 1 has unexpected type 'VideoFileClip'

我正在使用Ubuntu 20.04.2和Python 3.8.10。

I am developing a video editor in python 3 and PyQt5. I would like to use the QMediaPlayer widget and QVideoWidget together with moviepy. I tried with the following line of code to play a video:

self.mediaPlayer = QMediaPlayer(None, QMediaPlayer.VideoSurface).setMedia(QMediaContent(VideoFileClip('aaaspain.mp4')))

but it returns me this error:

TypeError: arguments did not match any overloaded call:
  QMediaContent(): too many arguments
  QMediaContent(QUrl): argument 1 has unexpected type 'VideoFileClip'
  QMediaContent(QNetworkRequest): argument 1 has unexpected type 'VideoFileClip'
  QMediaContent(QMediaResource): argument 1 has unexpected type 'VideoFileClip'
  QMediaContent(Iterable[QMediaResource]): argument 1 has unexpected type 'VideoFileClip'
  QMediaContent(QMediaContent): argument 1 has unexpected type 'VideoFileClip'
  QMediaContent(QMediaPlaylist, contentUrl: QUrl = QUrl()): argument 1 has unexpected type 'VideoFileClip'

I am working on Ubuntu 20.04.2 and python 3.8.10.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文