Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GStreamer encountered a general stream error in Qt5 raspberry pi

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

like image 202
Myanju Avatar asked Jan 28 '16 16:01

Myanju


1 Answers

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.

like image 190
ashbygeek Avatar answered Nov 02 '22 12:11

ashbygeek