How to install x264 on Ubuntu 16.04

How to install x264 on Ubuntu 16.04

The x264 is a video encoder developed by VideoLAN for encoding video streams into H.264/MPEG AVC format. It provides a command line interface as well as an API. This tutorial covers the installation procedure of x264 on Ubuntu 16.04.

Installation procedure

To start the installation procedure, add the repo and run the following command.

root@linuxhelp1:~# add-apt-repository ppa:djcj/hybrid
Hybrid is a multi platform (Linux/Mac OS X/Windows) Qt based frontend for a bunch of other tools which can convert nearly every input to x264/x265/Xvid/VP9/... + ac3/ogg/mp3/aac/flac inside an mp4/m2ts/mkv/webm/mov/avi container, a Blu-ray or an AVCHD structure.
http://www.selur.de/
http://forum.selur.de/topic612-hybrid-tools-ubuntu-packages.html
More info: https://launchpad.net/~djcj/+archive/ubuntu/hybrid
Press [ENTER] to continue or ctrl-c to cancel adding it
gpg: keyring `/tmp/tmpkpkpbjv6/secring.gpg'  created
gpg: keyring `/tmp/tmpkpkpbjv6/pubring.gpg'  created
gpg: requesting key D4B4972B from hkp server keyserver.ubuntu.com
gpg: /tmp/tmpkpkpbjv6/trustdb.gpg: trustdb created
gpg: key D4B4972B: public key " Launchpad PPA for djcj"  imported
gpg: Total number processed: 1
gpg:imported: 1(RSA: 1)
OK

The repository is successfully added. Now update the repo using the apt-get update command.

root@linuxhelp1:~# apt-get update
Get:1 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Hit:2 http://in.archive.ubuntu.com/ubuntu xenial InRelease
Get:3 http://ppa.launchpad.net/djcj/hybrid/ubuntu xenial InRelease [17.5 kB]
Get:4 http://in.archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]
Get:5 http://ppa.launchpad.net/djcj/hybrid/ubuntu xenial/main amd64 Packages [15.3 kB]
Get:6 http://in.archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]
Get:7 http://security.ubuntu.com/ubuntu xenial-security/main amd64 DEP-11 Metadata [54.2 kB]
Get:8 http://ppa.launchpad.net/djcj/hybrid/ubuntu xenial/main i386 Packages [15.3 kB]
Get:9 http://ppa.launchpad.net/djcj/hybrid/ubuntu xenial/main Translation-en [9,480 B]
Get:10 http://in.archive.ubuntu.com/ubuntu xenial-updates/main amd64 DEP-11 Metadata [288 kB]
Get:11 http://security.ubuntu.com/ubuntu xenial-security/main DEP-11 64x64 Icons [44.0 kB]
Get:12 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 DEP-11 Metadata [32.2 kB]
Get:13 http://security.ubuntu.com/ubuntu xenial-security/universe DEP-11 64x64 Icons [37.0 kB]
Get:14 http://in.archive.ubuntu.com/ubuntu xenial-updates/main DEP-11 64x64 Icons [186 kB]
Get:15 http://in.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 DEP-11 Metadata [160 kB]
Get:16 http://in.archive.ubuntu.com/ubuntu xenial-updates/universe DEP-11 64x64 Icons [188 kB]
Get:17 http://in.archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 DEP-11 Metadata [2,520 B]
Get:18 http://in.archive.ubuntu.com/ubuntu xenial-backports/main amd64 DEP-11 Metadata [3,324 B]
Fetched 1,359 kB in 17s (77.4 kB/s)
AppStream cache update completed, but some metadata was ignored due to errors.
Reading package lists... Done

Install the x264 package and press y to continue with the installation procedure.

root@linuxhelp1:~# apt-get install x264 -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
x264
0 upgraded, 1 newly installed, 0 to remove and 475 not upgraded.
Need to get 7,101 kB of archives.
After this operation, 24.3 MB of additional disk space will be used.
Get:1 http://ppa.launchpad.net/djcj/hybrid/ubuntu xenial/main amd64 x264 amd64 2:0.148.2744+ppa1-1~xenial [7,101 kB]
Fetched 7,101 kB in 2min 0s (59.0 kB/s)
Selecting previously unselected package x264.
(Reading database ... 176594 files and directories currently installed.)
Preparing to unpack .../x264_2%3a0.148.2744+ppa1-1~xenial_amd64.deb ...
Unpacking x264 (2:0.148.2744+ppa1-1~xenial) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up x264 (2:0.148.2744+ppa1-1~xenial) ...

For using the application, type the package name and run the below command. A list of options will appear that can be used in x264.

root@linuxhelp1:~# x264 --help
x264 core:148 r2744 b97ae06
Syntax: x264 [options] -o outfile infile
Infile can be raw (in which case resolution is required),
or YUV4MPEG (*.y4m),
or Avisynth if compiled with support (yes).
or libav* formats if compiled with lavf support (yes) or ffms support (no).
Outfile type is selected by filename:
.264 ->  Raw bytestream
.mkv ->  Matroska
.flv ->  Flash Video
.mp4 ->  MP4 if compiled with GPAC or L-SMASH support (gpac)
Output bit depth: 8 (configured at compile time)
Options:
-h, --helpList basic options
--longhelpList more options
--fullhelpList all options
Example usage:
Constant quality mode:
x264 --crf 24 -o < output>  < input> 
.
.
.
Input/Output:
-o, --output < string> Specify output file
--sar width:heightSpecify Sample Aspect Ratio
--fps < float|rational> Specify framerate
--seek < integer> First frame to encode
--frames < integer> Maximum number of frames to encode
--level < string> Specify level (as defined by Annex A)
--quietQuiet Mode
Filtering:
--vf, --video-filter < filter0> /< filter1> /... Apply video filtering to the input file
Filter options may be specified in < filter> :< option> =< value>  format.
Available filters:
crop:left,top,right,bottom
resize:[width,height][,sar][,fittobox][,csp][,method]
select_every:step,offset1[,...]

To remove the package, execute the following command and press y to continue with the uninstallation process.

root@linuxhelp1:~# apt-get remove x264 -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
x264
0 upgraded, 0 newly installed, 1 to remove and 475 not upgraded.
After this operation, 24.3 MB disk space will be freed.
(Reading database ... 176624 files and directories currently installed.)
Removing x264 (2:0.148.2744+ppa1-1~xenial) ...
Processing triggers for man-db (2.7.5-1) ...

Isn' t that an easy installation process? The x264 supports cabac and cavlc and also multiple reference frames.

Tag : x264
FAQ
Q
Is x264 free software?
A
yes, x264 is a free application.
Q
Is x264 available for windows?
A
yes, x264 is available for windows.
Q
is x264 available for MAC?
A
yes, x264 is available for MAC Os.
Q
where do I get binary files for x264 tool?
A
To get binary files for x264 see the following link http://download.videolan.org/pub/x264/binaries/
Q
What is x264 software?
A
The x264 is a video encoder developed by VideoLAN for encoding video streams into H.264/MPEG AVC format.