How to install OpenH264 on Ubuntu 16.04

How to install OpenH264 on Ubuntu 16.04

The OpenH264 is a free software lilbrary for real time encoding and decoding video streams in the H.264, MPEG-4 AVC format. It is also used in WebRTC. This tutorial explains the installation process of OpenH264 in Ubuntu.

Installation procedure

To start the installation process, first add the repo in the target system and run the 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/tmp02c3x22y/secring.gpg'  created
gpg: keyring `/tmp/tmp02c3x22y/pubring.gpg'  created
gpg: requesting key D4B4972B from hkp server keyserver.ubuntu.com
gpg: /tmp/tmp02c3x22y/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 added successfully. Now update the repo in the target system.

root@linuxhelp1:~# apt-get update
Hit:1 http://in.archive.ubuntu.com/ubuntu xenial InRelease
Get:2 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
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://ppa.launchpad.net/djcj/hybrid/ubuntu xenial/main i386 Packages [15.3 kB]
Get:7 http://ppa.launchpad.net/djcj/hybrid/ubuntu xenial/main Translation-en [9,480 B]
Get:8 http://in.archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]
Fetched 364 kB in 3s (104 kB/s)
Reading package lists... Done

Install the openh264 package in the sytem using the apt-get command and press enter.

root@linuxhelp1:~# apt-get install openh264
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
gcc-5-base:i386 libstdc++6:i386
Use ' sudo apt autoremove'  to remove them.
The following additional packages will be installed:
libopenh264-3
The following NEW packages will be installed:
libopenh264-3 openh264
0 upgraded, 2 newly installed, 0 to remove and 452 not upgraded.
Need to get 358 kB of archives.
After this operation, 1,079 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://ppa.launchpad.net/djcj/hybrid/ubuntu xenial/main amd64 libopenh264-3 amd64 1.6.0-0ppa1~xenial2 [337 kB]
Get:2 http://ppa.launchpad.net/djcj/hybrid/ubuntu xenial/main amd64 openh264 amd64 1.6.0-0ppa1~xenial2 [21.0 kB]
Fetched 358 kB in 6s (59.1 kB/s)
Selecting previously unselected package libopenh264-3.
(Reading database ... 176918 files and directories currently installed.)
Preparing to unpack .../libopenh264-3_1.6.0-0ppa1~xenial2_amd64.deb ...
Unpacking libopenh264-3 (1.6.0-0ppa1~xenial2) ...
Selecting previously unselected package openh264.
Preparing to unpack .../openh264_1.6.0-0ppa1~xenial2_amd64.deb ...
Unpacking openh264 (1.6.0-0ppa1~xenial2) ...
Processing triggers for libc-bin (2.23-0ubuntu3) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up libopenh264-3 (1.6.0-0ppa1~xenial2) ...
Setting up openh264 (1.6.0-0ppa1~xenial2) ...
Processing triggers for libc-bin (2.23-0ubuntu3) ...

For using the package, enter the openh264enc command and run the command as follows. It shows the options about encoding.

root@linuxhelp1:~# openh264enc
Wels SVC Encoder Usage:
Syntax: openh264enc -h
openh264enc welsenc.cfg [options]
Supported Options:
-bfBit Stream File
-orgOriginal file, example: -org src.yuv
-swthe source width
-sh the source height
-utypeusage type
-savcsimulcast avc
-frmsNumber of total frames to be encoded
-frininput frame rate
-numtlTemporal layer number (default: 1)
-iperIntra period (default: -1) : must be a power of 2 of GOP size (or -1)
-nalsizethe Maximum NAL size. which should be larger than the each layer slicesize when slice mode equals to SM_SIZELIMITED_SLICE
-spsidEnable id adding in SPS/PPS per IDR
-cabacEntropy coding mode(0:cavlc 1:cabac
-denoisControl denoising(default: 0)
-sceneControl scene change detection (default: 0)
-bgdControl background detection (default: 0)
-aqControl adaptive quantization (default: 0)
-ltrControl long term reference (default: 0)
-ltrnumControl the number of long term reference((1-4):screen LTR,(1-2):video LTR
-threadIdc0: auto(dynamic imp. internal encoder)  1: multiple threads imp. disabled  >  1: count number of threads
-loadbalancing0: turn off loadbalancing between slices when multi-threading available  1: (default value) turn on loadbalancing between slices when multi-threading available
-deblockIdcLoop filter idc (0: on, 1: off,
-alphaOffset AlphaOffset(-6..+6): valid range
-betaOffsetBetaOffset (-6..+6): valid range
-rcrate control mode: 0-quality mode  1-bitrate mode  2-bitrate limited mode  -1-rc off
-tarbOverall target bitrate
-maxbrTotalOverall max bitrate
-maxqpMaximum Qp
-minqpMinimum Qp
-numlNumber Of Layers: Must exist with layer_cfg file and the number of input layer_cfg file must equal to the value set by this command
The options below are layer-based: (need to be set with layer id)
-lconfig(Layer) (spatial layer configure file)
-drec(Layer) (reconstruction file) example: -drec 0 rec.yuv.Setting the reconstruction file, this will only functioning when dumping reconstruction is enabled
-dw(Layer) (output width)
-dh(Layer) (output height)
-frout(Layer) (output frame rate)
-lqp(Layer) (base quality layer qp : must work with -ldeltaqp or -lqparr)
-ltarb(Layer) (spatial layer target bitrate)
-lmaxb(Layer) (spatial layer max bitrate)
-slcmd(Layer) (spatial layer slice mode): pls refer to layerX.cfg for details ( -slcnum: set target slice num  -slcsize: set target slice size constraint   -slcmbnum: set the first slice mb num under some slice modes)
-trace(Level)

To know about the options relating to decoding, run the following command.

root@linuxhelp1:~# openh264dec
Syntax: openh264dec welsdec.cfg
openh264dec welsdec.264 out.yuv
openh264dec welsdec.264

For removing the package, enter the apt get remove command and press y to continue.

root@linuxhelp1:~# apt-get remove openh264 -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
gcc-5-base:i386 libopenh264-3 libstdc++6:i386
Use ' sudo apt autoremove'  to remove them.
The following packages will be REMOVED:
openh264
0 upgraded, 0 newly installed, 1 to remove and 452 not upgraded.
After this operation, 103 kB disk space will be freed.
(Reading database ... 176940 files and directories currently installed.)
Removing openh264 (1.6.0-0ppa1~xenial2) ...
Processing triggers for man-db (2.7.5-1) ...

Wasn' t that an easy installation? The OpenH264 is widely used for encoding and decoding video streams.

Tag : OpenH264
Comment
thungo
Feb 25 2018
Unable to locate package openh264?! please advise how to fix it.
Add a comment
FAQ
Q
How to initiate the OpenH264 application in Linux?
A
We can initiate the OpenH264 application by providing "openh264enc" in the command line.
Q
Does this OpenH264 provide support for WebRTC?
A
OpenH264 provide support for WebRTC.
Q
How to resolve the following, "Unable to locate package openh264"
A
PPA has been changed check for the latest version of OpenH264 and uses ppa:djcj/tools should be used instead of ppa:djcj/hybrid.
Q
What for this OpenH264 is used?
A
The OpenH264 is widely used for encoding and decoding video streams.
Q
How to manage scene change in OpenH264?
A
To manage scene change in OpenH264 use this option "-sceneControl"