How to install FFMPEG on CentOS 7/RHEL 7

0
489

FFMPEG

FFMPEG stands for fast forward motion pictures expert group. It is a free software project released under GNU General public license. FFMPEG is a cross platform application, which is available for all Linux flavor’s, Windows and Macintosh. It can be used to record, convert and stream audio and video.
In this article, we will learn about the installation of FFMPEG on CentOS 7.
First, install epel repository as follows

#yum -y install epel-release

Now install nux desktop repo

#rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
Retrieving http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
warning: /var/tmp/rpm-tmp.XaDA8O: Header V4 RSA/SHA1 Signature, key ID 85c6cd8a: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:nux-dextop-release-0-5.el7.nux   ################################# [100%]

ffmpeg, ffmpeg-devel installation

#yum -y install ffmpeg ffmpeg-devel
Loaded plugins: fastestmirror, langpacks
Resolving Dependencies
--> Running transaction check
---> Package ffmpeg.x86_64 0:2.6.8-3.el7.nux will be installed
---> Package libvdpau.x86_64 0:1.1-2.el7 will be installed
---> Package faac.x86_64 0:1.28-6.0.el7.nux will be installed
---> Package libass.x86_64 0:0.13.4-1.el7 will be installed
--> Processing Dependency: libfribidi.so.0()(64bit) for package: libass-0.13.4-1.el7.x86_64
---> Package libva.x86_64 0:1.2.1-3.el7 will be installed
---> Package schroedinger.x86_64 0:1.0.11-4.el7 will be installed
---> Package soxr.x86_64 0:0.1.2-1.el7 will be installed
---> Package x265-libs.x86_64 0:1.9-1.el7.nux will be installed
---> Package xvidcore.x86_64 0:1.3.2-5.el7.nux will be installed
--> Running transaction check
---> Package fribidi.x86_64 0:0.19.4-6.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================
 Package                     Arch                  Version                                            Repository                 Size
======================================================================================================================================
Installing:
 ffmpeg                      x86_64                2.6.8-3.el7.nux                                    nux-dextop                1.5 M
 ffmpeg-devel                x86_64                2.6.8-3.el7.nux                                    nux-dextop                287 k
Installing for dependencies:
 SDL                         x86_64                1.2.15-14.el7                                      base                      204 k
 faac                        x86_64                1.28-6.0.el7.nux                                   nux-dextop                269 k
 fdk-aac                     x86_64                0.1.4-1                                            nux-dextop                375 k
 ffmpeg-libs                 x86_64                2.6.8-3.el7.nux                                    nux-dextop                5.0 M
 fribidi                     x86_64                0.19.4-6.el7                                       base                       63 k
 lame-libs                   x86_64                3.99.5-2.el7                                       nux-dextop                339 k
 libass                      x86_64                0.13.4-1.el7                                       epel                       92 k
 libavdevice                 x86_64                2.6.8-3.el7.nux                                    nux-dextop                 71 k
 libdc1394                   x86_64                2.2.2-3.el7                                        epel                      121 k
 libva                       x86_64                1.2.1-3.el7                                        epel                       68 k
 libvdpau                    x86_64                1.1-2.el7                                          base                       32 k
 openal-soft                 x86_64                1.16.0-3.el7                                       epel                      282 k
 schroedinger                x86_64                1.0.11-4.el7                                       epel                      291 k
 soxr                        x86_64                0.1.2-1.el7                                        epel                       77 k
 x264-libs                   x86_64                0.142-11.20141221git6a301b6.el7.nux                nux-dextop                570 k
 x265-libs                   x86_64                1.9-1.el7.nux                                      nux-dextop                1.5 M
 xvidcore                    x86_64                1.3.2-5.el7.nux                                    nux-dextop                258 k

Transaction Summary
======================================================================================================================================
Install  2 Packages (+17 Dependent packages)

Total download size: 11 M
Installed size: 40 M
Downloading packages:
(1/19): SDL-1.2.15-14.el7.x86_64.rpm                                                                           | 204 kB  00:00:05
warning: /var/cache/yum/x86_64/7/nux-dextop/packages/faac-1.28-6.0.el7.nux.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 85c6cd8a: NOKEY
Public key for faac-1.28-6.0.el7.nux.x86_64.rpm is not installed
(2/19): faac-1.28-6.0.el7.nux.x86_64.rpm                                                                       | 269 kB  00:00:05
(3/19): fdk-aac-0.1.4-1.x86_64.rpm                                                                             | 375 kB  00:00:08
(4/19): fribidi-0.19.4-6.el7.x86_64.rpm                                                                        |  63 kB  00:00:04
(5/19): ffmpeg-devel-2.6.8-3.el7.nux.x86_64.rpm                                                                | 287 kB  00:00:09
(6/19): lame-libs-3.99.5-2.el7.x86_64.rpm                                                                      | 339 kB  00:00:04
(7/19): libass-0.13.4-1.el7.x86_64.rpm                                                                         |  92 kB  00:00:05
(8/19): libavdevice-2.6.8-3.el7.nux.x86_64.rpm                                                                 |  71 kB  00:00:01
(9/19): ffmpeg-2.6.8-3.el7.nux.x86_64.rpm                                                                      | 1.5 MB  00:00:21
(10/19): libvdpau-1.1-2.el7.x86_64.rpm                                                                         |  32 kB  00:00:01
(11/19): libdc1394-2.2.2-3.el7.x86_64.rpm                                                                      | 121 kB  00:00:03
(12/19): libva-1.2.1-3.el7.x86_64.rpm                                                                          |  68 kB  00:00:03
(13/19): openal-soft-1.16.0-3.el7.x86_64.rpm                                                                   | 282 kB  00:00:03
(14/19): soxr-0.1.2-1.el7.x86_64.rpm                                                                           |  77 kB  00:00:02
(15/19): schroedinger-1.0.11-4.el7.x86_64.rpm                                                                  | 291 kB  00:00:04
(16/19): x264-libs-0.142-11.20141221git6a301b6.el7.nux.x86_64.rpm                                              | 570 kB  00:00:14
(17/19): xvidcore-1.3.2-5.el7.nux.x86_64.rpm                                                                   | 258 kB  00:00:06
(18/19): x265-libs-1.9-1.el7.nux.x86_64.rpm                                                                    | 1.5 MB  00:00:27
(19/19): ffmpeg-libs-2.6.8-3.el7.nux.x86_64.rpm                                                                | 5.0 MB  00:01:10
--------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                 146 kB/s |  11 MB  00:01:19
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-nux.ro
Importing GPG key 0x85C6CD8A:
 Userid     : "Nux.Ro (rpm builder) <rpm@li.nux.ro>"
 Fingerprint: 561c 96bd 2f7f dc2a db5a fd46 e98b fbe7 85c6 cd8a
 Package    : nux-dextop-release-0-5.el7.nux.noarch (installed)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-nux.ro
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : SDL-1.2.15-14.el7.x86_64                                                                                          1/19
  Installing : x265-libs-1.9-1.el7.nux.x86_64                                                                                    2/19
  Installing : fdk-aac-0.1.4-1.x86_64                                                                                            3/19
  Installing : xvidcore-1.3.2-5.el7.nux.x86_64                                                                                   4/19
  Installing : faac-1.28-6.0.el7.nux.x86_64                                                                                      5/19
  Installing : lame-libs-3.99.5-2.el7.x86_64                                                                                     6/19
  Installing : soxr-0.1.2-1.el7.x86_64                                                                                           7/19
  Installing : fribidi-0.19.4-6.el7.x86_64                                                                                       8/19
  Installing : libass-0.13.4-1.el7.x86_64                                                                                        9/19
  Installing : x264-libs-0.142-11.20141221git6a301b6.el7.nux.x86_64                                                             10/19
  Installing : libvdpau-1.1-2.el7.x86_64                                                                                        11/19
  Installing : libdc1394-2.2.2-3.el7.x86_64                                                                                     12/19
  Installing : libva-1.2.1-3.el7.x86_64                                                                                         13/19
  Installing : schroedinger-1.0.11-4.el7.x86_64                                                                                 14/19
  Installing : ffmpeg-libs-2.6.8-3.el7.nux.x86_64                                                                               15/19
  Installing : openal-soft-1.16.0-3.el7.x86_64                                                                                  16/19
  Installing : libavdevice-2.6.8-3.el7.nux.x86_64                                                                               17/19
  Installing : ffmpeg-devel-2.6.8-3.el7.nux.x86_64                                                                              18/19
  Installing : ffmpeg-2.6.8-3.el7.nux.x86_64                                                                                    19/19
  Verifying  : openal-soft-1.16.0-3.el7.x86_64                                                                                   1/19
  Verifying  : schroedinger-1.0.11-4.el7.x86_64                                                                                  2/19
  Verifying  : libva-1.2.1-3.el7.x86_64                                                                                          3/19
  Verifying  : libdc1394-2.2.2-3.el7.x86_64                                                                                      4/19
  Verifying  : ffmpeg-devel-2.6.8-3.el7.nux.x86_64                                                                               5/19
  Verifying  : libvdpau-1.1-2.el7.x86_64                                                                                         6/19
  Verifying  : x264-libs-0.142-11.20141221git6a301b6.el7.nux.x86_64                                                              7/19
  Verifying  : fribidi-0.19.4-6.el7.x86_64                                                                                       8/19
  Verifying  : SDL-1.2.15-14.el7.x86_64                                                                                          9/19
  Verifying  : soxr-0.1.2-1.el7.x86_64                                                                                          10/19
  Verifying  : lame-libs-3.99.5-2.el7.x86_64                                                                                    11/19
  Verifying  : faac-1.28-6.0.el7.nux.x86_64                                                                                     12/19
  Verifying  : ffmpeg-libs-2.6.8-3.el7.nux.x86_64                                                                               13/19
  Verifying  : xvidcore-1.3.2-5.el7.nux.x86_64                                                                                  14/19
  Verifying  : libavdevice-2.6.8-3.el7.nux.x86_64                                                                               15/19
  Verifying  : fdk-aac-0.1.4-1.x86_64                                                                                           16/19
  Verifying  : ffmpeg-2.6.8-3.el7.nux.x86_64                                                                                    17/19
  Verifying  : x265-libs-1.9-1.el7.nux.x86_64                                                                                   18/19
  Verifying  : libass-0.13.4-1.el7.x86_64                                                                                       19/19

Installed:
  ffmpeg.x86_64 0:2.6.8-3.el7.nux                                ffmpeg-devel.x86_64 0:2.6.8-3.el7.nux

Dependency Installed:
  SDL.x86_64 0:1.2.15-14.el7            faac.x86_64 0:1.28-6.0.el7.nux        fdk-aac.x86_64 0:0.1.4-1
  ffmpeg-libs.x86_64 0:2.6.8-3.el7.nux  fribidi.x86_64 0:0.19.4-6.el7         lame-libs.x86_64 0:3.99.5-2.el7
  libass.x86_64 0:0.13.4-1.el7          libavdevice.x86_64 0:2.6.8-3.el7.nux  libdc1394.x86_64 0:2.2.2-3.el7
  libva.x86_64 0:1.2.1-3.el7            libvdpau.x86_64 0:1.1-2.el7           openal-soft.x86_64 0:1.16.0-3.el7
  schroedinger.x86_64 0:1.0.11-4.el7    soxr.x86_64 0:0.1.2-1.el7             x264-libs.x86_64 0:0.142-11.20141221git6a301b6.el7.nux
  x265-libs.x86_64 0:1.9-1.el7.nux      xvidcore.x86_64 0:1.3.2-5.el7.nux

Complete!

Check FFmpeg version by using FFmpeg command

#ffmpeg

Man page of FFmpeg

#man ffmpeg

ffmpeg command examples

We can get the information audio/video file by using ffmpeg command as follows

#ffmpeg -i video_file.avi

We can split the video into images

#ffmpeg -i video_file.mpg image%d.jpg

We can also convert bunch of images into video as follows

#ffmpeg -f image2 -i image%d.jpg video_file.mpg

We can convert avi into gif uncompressed format

#ffmpeg -i input_video.avi output_image.gif

We can extract audio from a video by using the following command

#ffmpeg -i input_video_file.mp4 -vn -ar 44100 -ac 2 -ab -192k -f mp3 audio_file.mp3

We can mix audio with video by using the following command

#ffmpeg -i audio_file.mp3 -I video_input.avi video_output.mpg

After converting completes, test the quality of video and audio files by using ffplay command

#ffplay video_file.mpg
#ffplay audio_file.mp3

Convert mp3 to ogg format

#ffmpeg -i input_file.mp3 -c:a libvobis -q:a 4 output_file.ogg

Enjoy all the FFmpeg features,  if you want to join this discussion, feel free to leave a comment!