Multimedia – includes Nvidia driver, CUDA

This repository contains multimedia programs that I use on my systems. The full list is as follows:

  • HandBrake with supporting programs MakeMKV and libdvdcss
  • CUDA enabled FFMpeg with most of the possible options
  • CUDA enabled Blender
  • CDRtools in place of cdrkit for burning Blu-Rays and any other kind of disc
  • VLC and MPV media player, again compiled with most options enabled
  • Cryptocurrency miners, most notably ethminer, ccminer with CUDA support, sgminer for mining hardware and cpuminer for CPU only mining
  • GStreamer plugins with additional forbidden codecs and compilation options
  • Nvidia driver, CUDA with additional libraries and Video SDK components

None of these packages can be distributed inside the main Fedora repositories as they are presented here due to patent and licensing issues or simply because they are coupled with non open source software. This repository is NOT compatible with RPMFusion, nor it does attempt to replace it as I have no interest in adding any software out there.

For details on the Nvidia components, please read the relevant page for the Nvidia-only repository. The packages hosted in this repository are exactly the same.

This repository requires the EPEL repository to be enabled if you’re running CentOS/RHEL.

These packages try to comply as maximum to the Fedora Packaging Guidelines; which means they have debuginfo packages, default Fedora’s GCC compile time options (where possible) and standard locations for binaries, data and docs.

Supported Fedora/CentOS/RHEL distributions:

  • Fedora – i686/x86_64
  • CentOS/RHEL 6 – i686/x86_64
  • CentOS/RHEL 7 – x86_64

Not all distributions are on par regarding features and packages, and this is mostly true to CentOS/RHEL where not all the required libraries are available at the correct version. Let’s say most of the development goes on to the latest Fedora release due to it being my daily desktop, and there everything is supported.

Most of the desktop packages that ship with a menu icon and launcher are also available in Gnome Software, just type something in the search bar:

HandBrake, MakeMKV and libdvdcss

HandBrake HandBrake is a tool for converting video from nearly any format to a selection of modern, widely supported codecs. MakeMKV is a one-click solution to convert video into free and patents-unencumbered format that can be played everywhere. It converts the video clips from proprietary (and usually encrypted) disc into a set of MKV files, preserving most information but not changing it in any way. Additionally MakeMKV can instantly stream decrypt video without intermediate conversion and can decrypt Blue Ray discs and protected DVD discs. libdvdcss is a support library designed for accessing DVDs without having to bother about the decryption.HandBrake

By the combination of these 3 packages any video title can be ripped or transcoded without problems.

Additional libraries that are normally fetched during HandBrake compilation have been pre downloaded and are shipped in the source rpm. This to avoid unnatural behaviour when compiling packages with Fedora tools such as mock or Koji.

HandBrake is made of two separate packages; HandBrake-gui and HandBrake-cli. The former being the GTK main GUI interface, and the latter the command line program. MakeMKV contains both graphical and command line interfaces into one package.

Fedora and CentOS/RHEL 7 ship the latest HandBrake with the GTK 3 interface enabled, while CentOS/RHEL 6 version is at 0.9.8; as it is the last version available that still builds with GTK 2.20 as shipped in the distribution.

HandBrake Bundled libraries

Historically, HandBrake has always linked statically the libraries required by the program. Since version 0.9.9 there’s the option to have them as external libraries and link them to the main executable. This does not mean thought that they can be used straight from Fedora repositories; some have restrictive licenses, some are forked and some do not contain the required patches for HandBrake.

All the libraries that can be linked are now linked from the main repositories, while the rest is left as bundled. Still left as bundled libraries inside the build due to versioning/patches are the following modules (libav is a fork of ffmpeg):

  • CentOS/RHEL 6: faac, mp4v2, ffmpeg, libbluray, libdca
  • Fedora, CentOS/RHEL 7: libav (for UTF-8 subtitles detection)

Installing HandBrake/MakeMKV/libdvdcss

To install the repository on a supported Fedora distribution, run as root the following command:

dnf config-manager --add-repo=https://negativo17.org/repos/fedora-multimedia.repo

To install the repository on CentOS/RHEL:

yum-config-manager --add-repo=https://negativo17.org/repos/epel-multimedia.repo

Then, to install the HandBrake packages (as an example both the graphical interface and the command line tool), perform the following commands:

yum/dnf -y install HandBrake-gui HandBrake-cli

For MakeMKV:

yum/dnf -y install makemkv

For libdvdcss:

yum/dnf -y install libdvdcss

Please note that the 64 bit MakeMKV tarballs contain a 32 bit binary. The binary is required by the main MakeMKV program (makemkvcon) for proper operation and comes only in binary format. This means that the 64 bit MakeMKV package will pull in the 32 bit mmtdsdec and associated glibc packages; which in a normal 64 bit desktop system are not guaranteed to be installed:

$ rpm -q --whatrequires mmdtsdec
makemkv-1.10.6-1.fc25.x86_64
$ rpm -ql mmdtsdec | grep bin
/usr/bin/mmdtsdec
$ file /usr/bin/mmdtsdec
/usr/bin/mmdtsdec: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.24, stripped

Registering MakeMKV to avoid expiration

Please use the provided beta registration key published by the developers:

http://www.makemkv.com/forum2/viewtopic.php?f=5&t=1053

After starting MakeMKV just press the “Register” button and paste the provided code.

makemkv_register

Playing protected Blu-Ray discs

Starting with version 1.8.5, MakeMKV comes with the libmmbd library. This library provides a simple API that any application can use to decrypt M2TS/SSIF files from a Blu-Ray disc. The library is licensed under the open-source LGPL license; although the way the library works, it launches a MakeMKV instance in background and communicates with MakeMKV in order to get decryption keys; so a working MakeMKV installation is required for the library to function. The libmmbd library is designed to be updated very infrequently – all the logic is inside MakeMKV (in makemkvcon), and libmmbd is just a proxy. The libmmbd source code is part of MakeMKV oss linux package.

Also, libmmbd emulates two popular open-source libraries, libaacs and libbdplus. What this means, that after a one-time setup, any application that uses libbluray/libaacs for decryption will be able to open a protected Blu-Ray disc, as long as MakeMKV is installed. Most notable application that uses libbluray is Videolan VLC player.

The libbluray library, starting from version 0.5.0 supports setting two environment variables to ease libmmbd loading, so the MakeMKV package already contains what’s required for the override (of course adjusted for 32/64 bit environments):

$ cat /etc/profile.d/makemkv.sh 
export LIBBDPLUS_PATH=/usr/lib64/libmmbd.so.0
export LIBAACS_PATH=/usr/lib64/libmmbd.so.0

This is equivalent to set an explicit library override in your library directory:

ln -sf libmmbd.so.0 libaacs.so.0
ln -sf libmmbd.so.0 libbdplus.so.0

For additional details see the original announcement and how to page on MakeMKV‘s forums.

To debug such a setup, you can use the variable MMBD_TRACE prepended to the command you want to run. For example, to decrypt and print information from a Blu-Ray disc:

MMBD_TRACE=1 bd_info /dev/sr0

Or to make sure MakeMKV is doing it’s part for VLC playing a Blu-Ray disc:

MMBD_TRACE=1 vlc

Fully fledged FFMpeg binaries

FFMPegIt started due to my personal usage with support for NVENC, the hardware encoding support for Nvidia video cards, but due to popular request the custom built FFMpeg package is available here and enables linking and support for all the codecs/encoders/decoders that would result in an unredistributable binary.

The following codecs/encoders/decoders/transports have been enabled, along with much more stuff:

  • VP8 and VP9 de/encoding
  • WebP encoding
  • AAC (Fraunhofer, LibVO and other variants) de/encoding
  • OpenAL 1.1 capture support
  • BluRay reading
  • AMR-WB de/encoding
  • AMR-NB de/encoding
  • RTMP[E] support
  • NVENC/CUDA (Nvidia H.264/265 GPU hardware encoder/decoder)
  • QSV (Intel Quick Sync Video H.264/265 CPU hardware encoder)
  • HE-AAC+ (3GPP AAC+ High Efficiency Advanced Audio Codec v2 encoder)
  • H.264/H.265 (through various meaning, x264, x264, OpenH264, Kvazaar)

This FFMPeg libraries are now tied to all the other multimedia libraries available in this repository. The support for Nvidia H.264/H.265 hardware encoding/decoding and Intel Quick Sync Video is enabled here as well and the required packages are now installed through the use of RPM hard dependencies if feasible.

To install the main FFMPeg binary and enable transcoding of practically everything, proceed as you would with a normal package:

yum/dnf install ffmpeg

Then after installing, you can see what options have been enabled at compile time by issuing one of the following commands:

ffmpeg -formats
ffmpeg -devices
ffmpeg -codecs
ffmpeg -decoders
ffmpeg -encoders

The idea is to have all the possible codecs/transports supported out of the box.

CUDA/FFMpeg enabled Blender

BlenderThe Blender packages contained herein enable all the possible build options including support for the RedCode image formats (for the old Red line of professional cameras), CUDA and FFMPeg.

Installing Blender works exactly like with the normal package from Fedora, except that the package will pull in all required libraries to enable FFMpeg support:

dnf install blender

If you have an Nvidia video card supported by the latest drivers and have the Nvidia repository enabled, you can install blender with the following command and get the benefit of using your GPU(s) for rendering.

dnf install blender-cuda nvidia-driver

This will pull in CUDA support for the installed Nvidia driver as well as the CUDA kernels for the various cards. Remember to manually load the nvidia-uvm module (or simply reboot) prior to starting Blender.

CUDA devices will then be selectable in the System pane of the User Preferences in the main Blender interface as depicted in the Screenshot below.

Screenshot from 2015-12-11 19-20-27

Plex Media Player

The Plex Media Player works as a standalone player and also as the main interface for an HTPC setup, where the “TV interface” starts as the main thing when you power up your system.

Plex Media Player uses MPV in the background, so any compilation option that was added to MPV, is now also part of Plex Media Player by using the same libraries that were already available in the multimedia repository.

To install it on Fedora, just perform the following commands:

dnf -y install plex-media-player

You will then find it along with the other applications in your menu. You will be greeted with the familiar Plex web interface, with the main difference being that the player is local through the MPV library.

If you are instead planning to do an HTPC installation, and would like to have Plex Media Player starting instead of the login screen the moment you boot the device, execute the following commands as root:

dnf install plex-media-player-session
systemctl set-default plex-media-player
echo "allowed_users = anybody" >> /etc/X11/Xwrapper.config

The first command installs the required files (services, targets and PolicyKit overrides). The second command instructs the system to load by default the Plex Media Player target; that is X immediately followed by the player itself. The third command allows the system to start the X server as the Plex Media Player user, otherwise only users logged in through a console or root can start it.

You will be greeted with the TV interface just after boot:

If you want to go back to your normal installation (let’s say Gnome), then revert back the changes (again type the following commands as root):

systemctl set-default graphical
sed -i -e '/allowed_users = anybody/d' /etc/X11/Xwrapper.config
rpm -e plex-media-player-session

CUDA enabled MPV

This has been already available for a long time, but with FFmpeg 3.3, CUDA dynamic support loading is enabled also in MPV, so the hard dependency on the CUDA library is gone, and the binaries load the library dynamically:

$ strings /usr/bin/mpv | grep libcuda
libcuda.so.1
$ strings /usr/lib64/libmpv.so.1.25.0 | grep libcuda
libcuda.so.1

So assuming you have the Nvidia driver already installed with the appropriate CUDA part, you can then play a video with the following command line:

mpv --hwdec=cuda /path/to/video.file

And then check with nvidia-smi or with the Nvidia control panel if the video engine is being utilized:

If you want to enable that by default, just make sure your configuration file has something like this inside:

$ cat ~/.config/mpv/mpv.conf 
#hwdec=vdpau
#vo=vdpau
hwdec=cuda

Apart from CUDA support, MPV as well has been built with all possible options enabled out of the box.

Bugs

The address for contacting me is in the package’s changelog, otherwise leave a comment in the post, I’ll do my best to reply to everyone.

433 thoughts to “Multimedia – includes Nvidia driver, CUDA”

  1. Maybe adding a “priority=1” to the repo file is useful, as the fedora-multimedia repo replaces packages that are included in the base repositories (e.g. twolame-libs, libmp4v2, libdvbpsi, ..). Also, setting the priority avoids conflicts with the rpmfusion repo.

    1. Using the multimedia repository with RPMFusion is not supported. If you need to use RPMFusion, please remove the multimedia repository.

  2. Is there something wrong with the multimedia repo?, I’m getting the following error:
    Dependency Resolution Errors:

    Package: gstreamer-plugins-ugly-0.10.19-23.fc27.x86_64 (installed)
    Requires: libx264.so.148()(64bit)
    Removing: 1:x264-libs-0.148-12.20170521gitaaa9aa8.fc27.x86_64 (installed)
    libx264.so.148()(64bit)
    Updated By: 1:x264-libs-0.152-13.20171224gite9a5903.fc27.x86_64 (fedora-multimedia)
    ~libx264.so.152()(64bit)
    Available: x264-libs-0.148-22.20170521gitaaa9aa8.fc27.x86_64 (rpmfusion-free)
    libx264.so.148()(64bit)

      1. Right, I see the problem, the gstreamer-plugin-* packages where actually installed from rpmfusion, but the updates from yours. Somehow I’d ended up with both installed.

  3. Thank you for going through all the trouble to compile and distribute these programs. They are very useful and having them in an up-to-date form and repo is awesome.

    It looks like FFMPEG added Newtek’s NDI support (I did see SpeedHQ, but from what I understand that is different from NDI), but that option is not available in the compiled version. Would you consider adding support for NDI?

    Thank you for your time.

    1. There are some issues with the binary components that are downloaded through conan. I can’t fix them and so I can’t build a new build until those are fixed.

  4. I followed the guide on Fedora 27 (Blender + CUDA) and I’m always getting this error:

    “CUDA error at cuModuleLoad: Out of memory

    Refer to the Cycles GPU rendering documentation for possible solutions:
    https://docs.blender.org/manual/en/dev/render/cycles/gpu_rendering.html

    Failed loading CUDA kernel /usr/share/blender/scripts/addons/cycles/lib/kernel_sm_61.cubin.
    Writing: /tmp/blender.crash.txt
    Segmentation fault (Speicherabzug geschrieben)”

    Any idea what’s wrong? :/

    1. Can you paste the content of your /tmp/blender.crash.txt file? This should be enough to get a working CUDA installation of Blender, btw:

      dnf install nvidia-driver-cuda blender-cuda && reboot
      1. I got the same problem (although it says Failed to load […]kernel_sm_51.cubin). My blender.crash.txt says:

        # Blender 2.79 (sub 0), Commit date: 1970-01-01 00:00, Hash unknown
        bpy.context.scene.render.engine = 'CYCLES' # Property
        bpy.context.space_data.viewport_shade = 'RENDERED' # Property
        bpy.context.scene.cycles.device = 'GPU' # Property

        # backtrace
        blender(BLI_system_backtrace+0x33) [0x55d4544d3b73]
        blender(+0xb31fed) [0x55d453a75fed]
        /lib64/libc.so.6(+0x376f0) [0x7f96279346f0]
        /lib64/libc.so.6(+0xb4281) [0x7f96279b1281]
        /lib64/libcuda.so.1(+0x1d49ba) [0x7f95c98759ba]
        /lib64/libcuda.so.1(+0x1d4fee) [0x7f95c9875fee]
        /lib64/libcuda.so.1(+0xf3092) [0x7f95c9794092]
        /lib64/libcuda.so.1(cuModuleLoadData+0x5a) [0x7f95c98bf02a]
        blender(_ZN3ccl10CUDADevice12load_kernelsERKNS_23DeviceRequestedFeaturesE+0x384) [0x55d454a122e4]
        blender(_ZN3ccl7Session12load_kernelsEb+0x51d) [0x55d4549c6f9d]
        blender(_ZN3ccl7Session3runEv+0x38) [0x55d4549c93e8]
        blender(_ZN3ccl6thread3runEPv+0xe) [0x55d4553e96ee]
        /lib64/libpthread.so.0(+0x761b) [0x7f9627eeb61b]
        /lib64/libc.so.6(clone+0x3f) [0x7f9627a1491f]

        (Fresh Blender installation, GTX 960, latest Fedora kernel, etc.)

    1. There are some issues with the binary components that are downloaded through conan. I can’t fix them and so I can’t build a new build until those are fixed.

Leave a Reply