38

I'm trying to play a video using QtMediaPlayer in Raspberry pi 2 B. The source code is as follows:

QMediaPlayer *media;
QVideoWidget *video;
...
...
media = new QMediaPlayer(parent);
video = new QVideoWidget(parent);
media->setVideoOutput(video);
media->setMedia(QUrl::fromLocalFile("/home/pi/Desktop/test3.mp4"));
media->play();

But the result is a blank video screen and the following error:

** (Bus:2148): WARNING **: ffmpegcolorspace-vo: size 1105920 is not a   
multiple of unit size 829440
Error: "GStreamer encountered a general stream error."

System Information

Running latest raspbian Jessie OS, Installed Qt5.3, Installed gstreamer0.10-plugins-good/bad/ugly/ffmpeg and Installed Mpeg-2 License

Here is the video test3.mp4

I ran this code in Windows with Qt5 installed; it is working there. But it's not working in the Raspberry pi. Please tell me what I'm missing here.

Trying Pipe from Shell

enter image description here

20
  • I don't think that there is a answer for this but still hoping for some one to help since I'm new to Linux world.
    – Myanju
    Jan 28, 2016 at 16:39
  • 2
    well you can play with gstreamer debug logs and find something interesting. run your app like this: GST_DEBUG=3 ./yourapp
    – nayana
    Feb 1, 2016 at 12:32
  • 1
    Have you tried my hint? without some more debug info I dont think we can proceed, also please try this pipe from shell: gst-launch-0.10 videotestsrc ! ffmpegcolorspace ! autovideosink
    – nayana
    Feb 3, 2016 at 9:36
  • 1
    looks like this bug which is solvable by simple fix in code of gstreamer - the file has weird creation date (1970-01-01 000).. however I am not sure if it can cause that lagging.. The second video which is working is much smaller resolution and bitrate, also it has proper timestamp - does it work in Qt?
    – nayana
    Feb 9, 2016 at 12:29
  • 1
    @otopolsky Nope.! it didn't work in Qt.
    – Myanju
    Feb 9, 2016 at 16:09

1 Answer 1

1

Video playback on the Raspberry Pi is actually a bit of a tricky thing. The most common solution is to use OMXPlayer to play videos. It's a command line program, but there are lots of flags and repeated calls can control playback. All in all, it works pretty dang well for most smallish projects.

As far as actually using Qt, QMediaPlayer, and etc. I don't think you'll be able to make it work right out of the box. However, I found a blog that discusses this issue and has some Raspberry Pi firmware that fixes QtMultimedia support on the Raspberry Pi.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.