Handbrake-cli on Centos

First, let install the prerequisites as if needed:

yum groupinstall 'Development Tools' 
yum groupinstall 'Development Libraries' # Ignore for CentOS 6.5
yum install fribidi-devel gtk+ yasm webkitgtk-devel gstreamer-devel gstreamer-plugins-base-devel bzip2-devel
yum install libgudev1-devel libnotify-devel libass-devel libsamplerate-devel libogg-devel libtheora-devel libvorbis-devel

Download the latest version from Handbrake website and build it without GTK support (no gui)

cd /usr/local/src/
wget -O HandBrake-0.10.2.tar.bz2 http://handbrake.fr/rotation.php?file=HandBrake-0.10.2.tar.bz2
tar -jxvf HandBrake-0.10.2.tar.bz2
cd HandBrake-0.10.2
./configure --launch --disable-gtk
cp build/HandBrakeCLI /usr/local/bin/

the configure command launched will build Handbrake without gui, only cli.

From there, you can start Handbrake in command line, you can follow some example of command usage using the preset present:
https://trac.handbrake.fr/wiki/BuiltInPresets#normal

Here is a quick bash that would do it for you:

 

#!/bin/bash

echo "installing packages"
yum -y groupinstall 'Development Tools' 
yum -y groupinstall 'Development Libraries'
yum -y install fribidi-devel gtk+ yasm webkitgtk-devel gstreamer-devel gstreamer-plugins-base-devel bzip2-devel
yum -y install libgudev1-devel libnotify-devel libass-devel libsamplerate-devel libogg-devel libtheora-devel libvorbis-devel

touch /etc/yum.repos.d/dag.repo
echo "[dag]" >> /etc/yum.repos.d/dag.repo
echo "name=DAG RPM Repository" >> /etc/yum.repos.d/dag.repo
echo "baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag" >> /etc/yum.repos.d/dag.repo 
echo "gpgcheck=1" >> /etc/yum.repos.d/dag.repo
echo "enabled=1" >> /etc/yum.repos.d/dag.repo

rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt


yum -y install ffmpeg*

rm -f /etc/yum.repos.d/dag.repo


echo "requirement installed"
echo ""
echo "will download the source"
cd /usr/local/src/
wget -O HandBrake-0.10.2.tar.bz2 http://handbrake.fr/rotation.php?file=HandBrake-0.10.2.tar.bz2
tar -jxvf HandBrake-0.10.2.tar.bz2
cd HandBrake-0.10.2
echo "recompile it. please wait. might take a while"
./configure --launch --disable-gtk --force
cp /usr/local/src/HandBrake-0.10.2/build/HandBrakeCLI /usr/local/bin/
echo "done"

Leave a Reply