söndag, mars 17, 2019

GPU accelerated video transcoding of DVDs in Debian Stretch

This will be a fairly technical and step-by-step walkthrough of how to achieve speedy ripping of DVDs in Debian Stretch. The hardware acceleration will, in my case, be by a NVidia GT 710 card specifically.
  1. Add non-free repository
    1. Open up /etc/apt/sources.list
    2.  Add non-free to the respective URLs you wish to use e.g.
      deb http://http.us.debian.org/debian stable main contrib non-free
  2. libnvidia-encode1 - library used in Handbrake by nvenc
    1.  sudo apt install libnvidia-encode1
  3. libdvdcss - library used in Handbrake to read encrypted DVDs
    1. sudo apt install libdvd-pkg
    2. sudo dpkg-reconfigure libdvd-pkg
  4. HandBrake - application of choice to handle the ripping process including scanning titles and configuring codecs. 
    1. Install dependencies, the following steps are documented at https://handbrake.fr/docs/en/latest/developer/install-dependencies-debian.html 
      1. sudo apt install autoconf automake build-essential cmake git libass-dev libbz2-dev libfontconfig1-dev libfreetype6-dev libfribidi-dev libharfbuzz-dev libjansson-dev liblzma-dev libmp3lame-dev libogg-dev libopus-dev libsamplerate-dev libspeex-dev libtheora-dev libtool libtool-bin libvorbis-dev libx264-dev libxml2-dev libvpx-dev m4 make patch pkg-config python tar yasm zlib1g-dev
      2. sudo curl -L 'http://ftp.debian.org/debian/pool/main/n/nasm/nasm_2.14-1_amd64.deb' -o /var/cache/apt/archives/nasm_2.14-1_amd64.deb
      3. sudo apt-get install intltool libappindicator-dev libdbus-glib-1-dev libglib2.0-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgtk-3-dev libgudev-1.0-dev libnotify-dev libwebkitgtk-3.0-dev
      4. sudo apt-get install libva-dev libdrm-dev
      5. sudo apt-get install git
    2. Get source
      1. git clone https://github.com/HandBrake/HandBrake.git
    3. Build Handbrake (will take a while)
      1. cd HandBrake
      2. ./configure --launch-jobs=$(nproc) --launch
    4. Launch HandBrake and configure nvenc
      1. cd build/gtk/src
      2. ./ghb
      3. In Destination > Video > Video Encoder select H.264 (NVEnc)