MP4 with GStreamer and QMediaPlayer on Ubuntu 16.04 LTS
← August 29th 2016 Svg Painter | ● | September 1st 2016 Trackz App Released →
MP4 videos won’t play on Ubuntu 16.04 LTS with GStreamer out-of-the-box. Nor does Qt’s QMediaPlayer play MP4 files out-of-the-box.
This is due to a long story of missing codec plugins:
On Ubuntu 12.04 we simply installed the GStreamer-0.1 “gstreamer0.10-ffmpeg” plugin and mp4 files played fine with GStreamer’s “gst-play” tool.
But with Ubuntu 14.04 ffmpeg has been replaced with libav so that the ffmpeg plugin is no longer available as standard Ubuntu package. What is more, the libav plugin is only available for GStreamer-1.0 and not GStreamer-0.1.
For GStreamer-1.0 the missing libav codecs can be installed from the “ubuntu-restricted-extras” package:
sudo apt-get install ubuntu-restricted-extras
After that installation, “gst-play” will work again on Ubuntu 14.04. However, some other video players and internet browsers like Firefox explicitly require the ffmpeg plugin to be available, so we are basically out of luck for those applications on Ubuntu 14.04 and above. But, fortunately, it is possible to install the missing plugin from a PPA (yay ;-):
sudo add-apt-repository ppa:mc3man/trusty-media sudo apt-get update sudo apt-get install gstreamer0.10-ffmpeg
On Ubuntu 16.04 LTS this also works, we just need a different PPA:
sudo add-apt-repository ppa:mc3man/gstffmpeg-keep sudo apt-get update sudo apt-get install gstreamer0.10-ffmpeg
The QMediaPlayer class of Qt also relies on GStreamer to play videos. GStreamer-1.0 is not yet supported (at least not for Qt 5.7.0 and below), so the QMediaPlayer also requires the GStreamer-0.1 ffmpeg plugin to play MP4 files.
As a result, we need to install the following packages to enable the Qt media player with MP4 playback:
sudo apt-get install gstreamer0.10 sudo apt-get install gstreamer0.10-plugins-base sudo apt-get install gstreamer0.10-plugins-good sudo apt-get install gstreamer0.10-fluendo-mp3 sudo apt-get install gstreamer0.10-pulseaudio sudo add-apt-repository ppa:mc3man/gstffmpeg-keep sudo apt-get update sudo apt-get install gstreamer0.10-ffmpeg
After that, the QMediaPlayer will play the majority of common video formats on Ubuntu 16.04 LTS!
← August 29th 2016 Svg Painter | ● | September 1st 2016 Trackz App Released →