0

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.

  • QMediaPlayer can only work with actual source files. It may work with "piped" content through the audio/video sinks, but that would be quite complex. Besides, don't "chain" functions unless you're sure about their returned values: `setMedia()` returns `None`, so `self.mediaPlayer` would be invalid and the media player itself would be instantly garbage collected (i.e. destroyed). – musicamante Jun 06 '22 at 15:25
  • Ok, thanks, but I wanted to ask if you can include moviepy in PyQt5 – Leonardo Jun 09 '22 at 07:42
  • Your question was about using QMediaPlayer with moviepy, and I already answered it. If the question is about "using moviepy with PyQt", then that's a **too broad** question, and you need to explain what you need it for, with a real case scenario of its usage *in* PyQt, possibly providing a [mre] of your attempts in achieving your goal. – musicamante Jun 09 '22 at 11:22

0 Answers0