Question

I have this application where I display content together with a video file. The video files are either in image/jpeg (MJPG format according to vlc) or video/x-h264 format.

To do this, I use a mediasource combined with a video output element to display the video. This is working perfectly when using h264. However, this is not working at all with the mjpg video files.

But I have no idea how to do this. I have read up on libraries using either ffmpeg or vlc, but I can't seem to find libraries to use in combination with QML elements, only with regular QWidgets.

Here is some (stripped down) relevant code, it is really simple and I would prefer to keep it simple. So ideally I am just looking for a way to get a codec into the project or something like that.

property string videoLocation

FileDialog {
    id: videoFileDialog
    onAccepted: {
        videoLocation = fileUrl
    }
}

MediaPlayer {
    id: mediaplayer
    source: videoLocation
    autoPlay: false
}

 VideoOutput {
     id: videoOutput
     source: mediaplayer
}

Maybe relevant: my system is ubuntu 13.04 and I use qt 5.3. Thx in advance

EDIT: I have figured out the problem I think: The stream is recorded using gstreamer > 1.0. For some reason it won't play back in 0.10. If I record using the same settings, but with gstreamer 0.10, everything is fine and my application works (though this option is not feasible, I really need to capture using > 1)

Here is the code I am using to capture the stream to a file:

gst-launch-0.10 v4l2src device=/dev/cam1 ! image/jpeg,width=320,height=240,framerate=30/1 ! matroskamux ! filesink location=videotest.mkv

Any suggestions for a setting that is compatible between new and old gstreamer?

Was it helpful?

Solution 2

So I fixed it by using an avi container instead of a matroska container. No idea why it works now and not with matroska. I can honestly only think this has to be a bug somewhere.

OTHER TIPS

On *nix platforms, QtMultimedia uses GStreamer as its backend. On GStreamer's website it appears that JPEG is a supported format (and one would assume that includes motion jpeg.)

Check your package manager to make sure you have all of GStreamer's plugins installed. There's at least three different packages of GStreamer plugins on Ubuntu.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top