UNIX / Linux keyboard.

How to Add Multimedia Support to CentOS and RHEL

Red Hat and Multimedia

Red Hat removed MP3 support from their distribution of Linux due to patent licensing and conflicts between patent licenses and the licenses of application source code. This happened all the way back in September 2002 when Red Hat 8.0 came out. Red Hat provided an explanation on their site back in 2003-2008. It seems that they no longer even provide an explanation. You simply don't get the codecs, the encoding and decoding shared libraries, with Red Hat. Therefore you don't get them with clones like CentOS or with derivatives like Oracle Linux or Scientific Linux. There are ways around this. You can add MP3 and other codecs for audio and video players and other tools. This page explains how to do that.

Red Hat's decision is understandable. There is very little desire to play audio or video on the console of a server for which you're paying up to US $3,500 per CPU socket pair per year. What does make sense is to store media files on a file server that sits in the server room. Then your Ubuntu (or Mac OS, or Windows) desktop connects to that file server as an NFS client, and you do the playing on that desktop client.

The Workarounds Change

The details for doing this have changed from year to year as Linux software package repositories (or repos) have variously lost support, been renamed, become untrustworthy, or disappeared. Some are merely outdated, like the DAG repo for RHEL 2.1 through 5, and the rpm.livna.org repo that merged with others into RPM Fusion and supported RHEL 5 and 6. Then there was the SourceForge site, which became a hive of malware and malicious advertising in 2013-2016. SourceForge is slowly coming back, but it's not useful for solving this problem.

RPMForge became pkgs.repoforge.org, and now both are unmaintained. Its Wikipedia page begins:
RepoForge (formerly RPMforge) is a dead project. It is not maintained. DO NOT USE.
That page has a link to a CentOS page which says:
RPMForge/RepoForge is a dead project. It is not maintained. DO NOT USE.

Audacious audio player listening to the Radio Echoes MP3 stream from Thessaloniki, Greece.

audacious audio player, listening to the Radio Echoes MP3 stream from Thessaloniki

Overview of the Fix

The following procedure works with CentOS / RHEL 7, and is said to also work on Oracle Linux and Scientific Linux. This example walks through the steps followed immediately after installing CentOS from the "Everything" DVD ISO image.

We will add two repo definitions. The first is for EPEL, or Extra Packages for Enterprise Linux. This repo is maintained by the Fedora project.

Travel in
Romania

The second is the Nux Dextop repo, a desktop and multimedia-oriented RPM collection. This repo has been in use since 2012 for the RHEL 6 packages, and since early 2016 for the RHEL 7 packages. No, nothing is entirely risk-free, but this seems to be a very good and useful software collection. The fact that it's at a .ro domain will freak out the paranoid and xenophobic.

Do be careful to verify the PGP public key in the following steps. You want to get the real Nux collection. DNS cache poisoning, other network man-in-the-middle attacks, and spear-phishing attacks (as in "Click here to start adding MP3/MPEG capability to Red Hat") could all lead you to fake sites with malware.

Your remaining problem is to decide whether you trust me as a person to give you advice, and my site as a channel for communicating that advice...

Ready? Here we go.

See What You Have So Far

As I said, I had just installed CentOS from the 7.2.1511 Everything DVD ISO image. Let's see what that has set up for software repositories.

[root@centos ~]# yum repolist
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: centos.mbni.med.umich.edu
 * extras: mirror.tzulo.com
 * updates: mirror.tzulo.com
repo id                             repo name                             status
base/7/x86_64                       CentOS-7 - Base                       9,363
extras/7/x86_64                     CentOS-7 - Extras                       435
updates/7/x86_64                    CentOS-7 - Updates                      418
repolist: 10,216

I am interested in the Chrome browser, although I'm never certain if it's going to be called chrome or chromium or maybe something like stable-chrome-browser or whatever. I am also interested in any MP3 and MPEG codecs and players, the Mplayer and VLC video players, NTFS support, the Lyx WYSIWIG editor for LaTeX, and the libdvdcss package so I can make a backup copy of a DVD that I own.

NTFS-3G seems to be quite safe for R/W use, despite the dire warnings we still encounter when configuring a kernel build. Experimentation shows that I don't need NTFS support in the kernel itself in order to mount NTFS file systems with the FUSE (or File System in Userspace) utilities. But I will want the NTFS user-space programs.

[root@centos7 ~]# df -hT /run/media/cromwell/EXTERNAL
Filesystem     Type     Size  Used Avail Use% Mounted on
/dev/sdb1      fuseblk  932G  116M  932G   1% /run/media/cromwell/EXTERNAL
[root@centos7 ~]# egrep 'NTFS|FUSE' /boot/config*
CONFIG_FUSE_FS=m
# CONFIG_NTFS_FS is not set

My use of NTFS is purely for convenience, moving data on portable media. I don't rely on NTFS for archival storage.

Let's see what, if any, of the desired components are included with RHEL/CentOS:

[root@centos ~]# yum list | egrep 'chrome|chromium|mp3|mpeg|mpg|vlc|lyx|skype|mplayer|libdvdcss|ntfs'
xorg-x11-drv-openchrome.i686               0.3.3-14.el7                base
xorg-x11-drv-openchrome.x86_64             0.3.3-14.el7                base
xorg-x11-drv-openchrome-devel.i686         0.3.3-14.el7                base
xorg-x11-drv-openchrome-devel.x86_64       0.3.3-14.el7                base

That's disappointing. Let's add software repositories that provide the desired packages.

Let's start by adding EPEL, the Fedora-hosted Extra Packages for Enterprise Linux repo. First, we need to get the Fedora PGP public key:

[root@centos ~]# wget https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7Server
-- 2016-03-17 09:34:19--  https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7Server
Resolving dl.fedoraproject.org (dl.fedoraproject.org)... 209.132.181.26, 209.132.181.27, 209.132.181.23, ...
Connecting to dl.fedoraproject.org (dl.fedoraproject.org)|209.132.181.26|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1662 (1.6K)
Saving to: 'RPM-GPG-KEY-EPEL-7Server'

100%[======================================>] 1,662       --.-K/s   in 0s

2016-03-17 09:34:19 (54.1 MB/s) - 'RPM-GPG-KEY-EPEL-7Server' saved [1662/1662]

The wget program connected to somewhere and got something. Yes, it used HTTPS, but I'm not comfortable with simply trusting wget to do the right thing. The wget manual says that it verifies the certificate against the authorities, but it's not clear how it really does that. Besides, using HTTPS for the connection provides no guarantee that the site has not been hacked and its contents replaced with malware.

So, I'm going to check the SHA-2-256 hash of what I downloaded. Here is what I got, you should have precisely the same value:

[root@centos ~]# openssl sha256 RPM-GPG-KEY-EPEL-7Server
SHA256(RPM-GPG-KEY-EPEL-7Server)= 028b9accc59bab1d21f2f3f544df5469910581e728a64fd8c411a725a82300c2

If you got exactly the same SHA-2-256 hash output, add the key to your RPM database:

[root@centos ~]# rpm --import RPM-GPG-KEY-EPEL-7Server

Now our subsequent rpm and yum commands can verify the digital signatures embedded within packages downloaded from the EPEL repo. So, let's first browse the collection and then download and install the most recent available epel-release package. Change the 7-9 release number in the following when you find a newer one on the site. And please let me know that I need to update this page...

[root@centos ~]# rpm -Uvh https://dl.fedoraproject.org/pub/epel/7Server/x86_64/e/epel-release-7-9.noarch.rpm
  Retrieving https://dl.fedoraproject.org/pub/epel/7Server/x86_64/e/epel-release-7-9.noarch.rpm
  Preparing...                          ################################# [100%]
  Updating / installing...
     1:epel-release-7-9                 ################################# [100%]

That will have added a new file /etc/yum.repos.d/epel.repo" which contains new repo definitions. Let's get an updated list of the repos and the packages of possible interest. Notice that the total number of packages has roughly doubled, from 10,216 to 21,216:

[root@centos ~]# yum repolist
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: centos.mbni.med.umich.edu
 * epel: ftp.osuosl.org
 * extras: mirror.tzulo.com
 * updates: mirror.sesp.northwestern.edu
repo id               repo name                                           status
base/7/x86_64         CentOS-7 - Base                                      9,363
epel/x86_64           Extra Packages for Enterprise Linux 7 - x86_64      11,042
extras/7/x86_64       CentOS-7 - Extras                                      435
updates/7/x86_64      CentOS-7 - Updates                                     418
repolist: 21,258

[root@centos ~]# yum list | egrep 'chrome|chromium|mp3|mpeg|mpg|vlc|lyx|skype|mplayer|libdvdcss|ntfs'
chrome-remote-desktop.x86_64            55.0.2883.87-1.el7.1           epel
chromedriver.x86_64                     55.0.2883.87-1.el7.1           epel
chromium.x86_64                         55.0.2883.87-1.el7.1           epel
chromium-libs.x86_64                    55.0.2883.87-1.el7.1           epel
chromium-libs-media.x86_64              55.0.2883.87-1.el7.1           epel
lyx.x86_64                              2.1.4-7.el7                    epel
lyx-common.noarch                       2.1.4-7.el7                    epel
lyx-fonts.noarch                        2.1.4-7.el7                    epel
mathjax-winchrome-fonts.noarch          2.4.0-1.el7                    epel
ntfs-3g.x86_64                          2:2016.2.22-3.el7              @epel
ntfsprogs.x86_64                        2:2016.2.22-3.el7              @epel
ntfs-3g-devel.x86_64                    2:2016.2.22-3.el7              epel
xorg-x11-drv-openchrome.i686            0.3.3-14.el7                   base
xorg-x11-drv-openchrome.x86_64          0.3.3-14.el7                   base
xorg-x11-drv-openchrome-devel.i686      0.3.3-14.el7                   base
xorg-x11-drv-openchrome-devel.x86_64    0.3.3-14.el7                   base

That added the Chrome browser, NTFS tools, and Lyx, but that's it. We need to add the Nux repo for the MP3, MPEG, and other multimedia support. However, even if we didn't want Chrome, NTFS, and Lyx, we still need EPEL as Nux depends on some packages in EPEL. We will follow the same process: download the Nux PGP key, check its SHA-2-256 hash, and only if good, install the Nux repo definition. Again, browse around the li.nux.ro site to find the URL for the key:

[root@centos ~]# wget http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
--2016-03-17 01:12:52--  http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
Resolving li.nux.ro (li.nux.ro)... 217.19.15.108
Connecting to li.nux.ro (li.nux.ro)|217.19.15.108|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3109 (3.0K) [text/plain]
Saving to: 'RPM-GPG-KEY-nux.ro'

100%[======================================>] 3,109       --.-K/s   in 0s

2016-03-17 01:12:52 (292 MB/s) - 'RPM-GPG-KEY-nux.ro' saved [3109/3109]

[root@centos ~]# openssl sha256 RPM-GPG-KEY-nux.ro
SHA256(RPM-GPG-KEY-nux.ro)= a01c2956a99b71c67d79cc78c4e7acf6391e1fe12ae2f7efd1c9fbea3500a354

If you got a matching SHA-2-256 hash output, it is safe to continue.

[root@centos ~]# rpm --import RPM-GPG-KEY-nux.ro

Again, a browse around the repo will tell you the precise name of the latest release file:

[root@centos ~]# rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
Retrieving http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:nux-dextop-release-0-5.el7.nux   ################################# [100%]

Now we will have more packages of interest:

[root@centos ~]# yum repolist
Loaded plugins: fastestmirror, langpacks
nux-dextop                                               | 2.9 kB     00:00
nux-dextop/x86_64/primary_db                               | 1.6 MB   00:01
Loading mirror speeds from cached hostfile
 * base: centos.mbni.med.umich.edu
 * epel: mirror.steadfast.net
 * extras: mirror.tzulo.com
 * nux-dextop: li.nux.ro
 * updates: centos.mirrors.tds.net
repo id               repo name                                           status
base/7/x86_64         CentOS-7 - Base                                      9,363
epel/x86_64           Extra Packages for Enterprise Linux 7 - x86_64      11,042
extras/7/x86_64       CentOS-7 - Extras                                      435
nux-dextop/x86_64     Nux.Ro RPMs for general desktop use                  2,543
updates/7/x86_64      CentOS-7 - Updates                                     418
repolist: 23,801

[root@centos ~]# yum list | egrep 'chrome|chromium|mp3|mpeg|mpg|vlc|lyx|mplayer|libdvdcss|ntfs'

audacious-plugins-freeworld-mp3.x86_64   3.5-2.el7.nux                nux-dextop
chrome-remote-desktop.x86_64             55.0.2883.87-1.el7.1         epel
chromedriver.x86_64                      55.0.2883.87-1.el7.1         epel
chromium.x86_64                          55.0.2883.87-1.el7.1         epel
chromium-libs.x86_64                     55.0.2883.87-1.el7.1         epel
chromium-libs-media.x86_64               55.0.2883.87-1.el7.1         epel
chromium-pepper-flash.x86_64             18.0.0.233-1.el7.nux         nux-dextop
chromium-pepper-flash-debuginfo.x86_64   18.0.0.233-1.el7.nux         nux-dextop
chromium-widevinecdm-plugin.x86_64       18.0.0.233-1.el7.nux         nux-dextop
ffmpeg.x86_64                            2.6.8-3.el7.nux              nux-dextop
ffmpeg-compat.x86_64                     0.6.7-9.el7.nux              nux-dextop
ffmpeg-compat-debuginfo.x86_64           0.6.7-9.el7.nux              nux-dextop
ffmpeg-compat-devel.x86_64               0.6.7-9.el7.nux              nux-dextop
ffmpeg-debuginfo.x86_64                  2.6.8-3.el7.nux              nux-dextop
ffmpeg-devel.x86_64                      2.6.8-3.el7.nux              nux-dextop
ffmpeg-libs.x86_64                       2.6.8-3.el7.nux              nux-dextop
ffmpegthumbnailer.x86_64                 2.0.9-1.el7.nux              nux-dextop
ffmpegthumbnailer-debuginfo.x86_64       2.0.9-1.el7.nux              nux-dextop
ffmpegthumbnailer-devel.x86_64           2.0.9-1.el7.nux              nux-dextop
gstreamer-ffmpeg.x86_64                  0.10.13-15.el7.nux           nux-dextop
gnome-mplayer.x86_64                     1.0.9-1.el7.nux              nux-dextop
gnome-mplayer-common.x86_64              1.0.9-1.el7.nux              nux-dextop
gnome-mplayer-debuginfo.x86_64           1.0.9-1.el7.nux              nux-dextop
gnome-mplayer-minimal.x86_64             1.0.9-1.el7.nux              nux-dextop
gnome-mplayer-nautilus.x86_64            1.0.9-1.el7.nux              nux-dextop
gnome-mplayer-nemo.x86_64                1.0.9-1.el7.nux              nux-dextop
gstreamer-ffmpeg-debuginfo.x86_64        0.10.13-15.el7.nux           nux-dextop
lame-mp3x.x86_64                         3.99.5-2.el7                 nux-dextop
libdvdcss.x86_64                         1.2.13-1.el7.nux             nux-dextop
libdvdcss-debuginfo.x86_64               1.2.13-1.el7.nux             nux-dextop
libdvdcss-devel.x86_64                   1.2.13-1.el7.nux             nux-dextop
libmpeg2.x86_64                          0.5.1-10.el7.nux             nux-dextop
libmpeg2-debuginfo.x86_64                0.5.1-10.el7.nux             nux-dextop
libmpeg2-devel.x86_64                    0.5.1-10.el7.nux             nux-dextop
libmpeg3.x86_64                          1.8-5.el7.nux                nux-dextop
libmpeg3-debuginfo.x86_64                1.8-5.el7.nux                nux-dextop
libmpeg3-devel.x86_64                    1.8-5.el7.nux                nux-dextop
libmpeg3-utils.x86_64                    1.8-5.el7.nux                nux-dextop
libmpg123.x86_64                         1.15.1-1.el7.nux             nux-dextop
libmpg123-devel.x86_64                   1.15.1-1.el7.nux             nux-dextop
lyx.x86_64                               2.1.4-7.el7                  epel
lyx-common.noarch                        2.1.4-7.el7                  epel
lyx-fonts.noarch                         2.1.4-7.el7                  epel
mathjax-winchrome-fonts.noarch           2.4.0-1.el7                  epel
mlt-ffmpeg.x86_64                        6.2.0-3.el7.nux              nux-dextop
mp3gain.x86_64                           1.5.2-5.el7.nux              nux-dextop
mp3gain-debuginfo.x86_64                 1.5.2-5.el7.nux              nux-dextop
mpeg2dec.x86_64                          0.5.1-10.el7.nux             nux-dextop
mpg123.x86_64                            1.15.1-1.el7.nux             nux-dextop
mpg123-debuginfo.x86_64                  1.15.1-1.el7.nux             nux-dextop
mpg123-plugins-extras.x86_64             1.15.1-1.el7.nux             nux-dextop
mpg123-plugins-jack.x86_64               1.15.1-1.el7.nux             nux-dextop
mpg123-plugins-pulseaudio.x86_64         1.15.1-1.el7.nux             nux-dextop
mplayer.x86_64                           1.1-33.20150505svn.el7.nux   nux-dextop
mplayer-common.x86_64                    1.1-33.20150505svn.el7.nux   nux-dextop
mplayer-debuginfo.x86_64                 1.1-33.20150505svn.el7.nux   nux-dextop
mplayer-doc.x86_64                       1.1-33.20150505svn.el7.nux   nux-dextop
mplayer-gui.x86_64                       1.1-33.20150505svn.el7.nux   nux-dextop
mplayer-tools.x86_64                     1.1-33.20150505svn.el7.nux   nux-dextop
mythffmpeg.x86_64                        0.28-4.el7.nux               nux-dextop
ntfs-3g.x86_64                           2:2016.2.22-3.el7            @epel
ntfsprogs.x86_64                         2:2016.2.22-3.el7            @epel
ntfs-3g-devel.x86_64                     2:2016.2.22-3.el7            epel
skype.i586                               4.3.0.37-2.R                 nux-dextop
smplayer.x86_64                          15.11.0-1.el7.nux            nux-dextop
smplayer-debuginfo.x86_64                15.11.0-1.el7.nux            nux-dextop
vlc.x86_64                               1:2.2.2-6.el7.nux            nux-dextop
vlc-core.x86_64                          1:2.2.2-6.el7.nux            nux-dextop
vlc-debuginfo.x86_64                     1:2.2.2-6.el7.nux            nux-dextop
vlc-devel.x86_64                         1:2.2.2-6.el7.nux            nux-dextop
vlc-extras.x86_64                        1:2.2.2-6.el7.nux            nux-dextop
vlc-plugin-jack.x86_64                   1:2.2.2-6.el7.nux            nux-dextop
xmms-mp3.x86_64                          1.2.11-5.20071117cvs.el7.nux nux-dextop
xmms-mp3-debuginfo.x86_64                1.2.11-5.20071117cvs.el7.nux nux-dextop
xorg-x11-drv-openchrome.i686             0.3.3-14.el7                 base
xorg-x11-drv-openchrome.x86_64           0.3.3-14.el7                 base
xorg-x11-drv-openchrome-devel.i686       0.3.3-14.el7                 base
xorg-x11-drv-openchrome-devel.x86_64     0.3.3-14.el7                 base

Some vague how-to pages suggested that I needed to replace all the installed GStreamer packages. However, that isn't very practical due to widespread package dependencies. I believe that all I really need to do is add that one gstreamer-ffmpeg.x86_64 package. Plus, I am mainly interested in using audacious to play audio files and streams, ffmpeg to do video processing and conversion, and gmplayer to test the results.

Now we're ready for the big installation! Notice that I can use wildcards if I hide them from the shell. I have broken the long command line for readability:

[root@centos ~]# yum install audacious audacious-plugin\* \
		ffmpeg ffmpegthumbnailer gstreamer-ffmpeg \
		mp3gain mpeg2dec mpg123 mpg123-plugins\* skype \
		vlc mplayer-gui libdvdcss ntfs-3g ntfsprogs
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: lug.mtu.edu
 * epel: mirror.steadfast.net
 * extras: mirror.tzulo.com
 * nux-dextop: mirror.li.nux.ro
 * updates: mirror.sesp.northwestern.edu
Resolving Dependencies
[... much output deleted ...]
Transaction Summary
================================================================================
Install  25 Packages (+160 Dependent packages)

Total download size: 117 M
Installed size: 379 M
Is this ok [y/d/N]: y
[... much output deleted ...]
Audacious audio player streaming mid-Atlantic HF air traffic control.

Audacious audio player streaming mid-Atlantic HF air traffic control (also here and here)

Mplayer playing 'Charade'.

Mplayer playing "Charade". Universal published the movie with an invalid copyright notice, so the film was in the public domain in the U.S. upon its release and can be downloaded from archive.org.