OSETC TECH

How To Install and Use FFmpeg on Fedora Linux

This post will guide you how to Install and use FFmpeg Tool on your Fedora 30 Linux. How do I install fedora from the command line using dnf command under the Fedora Linux system.

What is FFmpeg


FFmpeg is a free and open-source project consisting of a vast software suite of libraries and programs for handling video, audio, and other multimedia files and streams. At its core is the FFmpeg program itself, designed for command-line-based processing of video and audio files, and widely used for format transcoding, basic editing, video scaling, video post-production effects, and standards compliance.

ffmpeg is a very fast video and audio converter that can also grab from a live audio/video source. It can also convert between arbitrary sample rates and resize video on the fly with a high quality polyphase filter.

Step1: Adding RPMfusion Repo


FFmpeg package is not available in the default fedora repository. so you have to install another repository called RPMfusion on your fedora system for FFmpeg installation. Type the following command to configure RPMfusion repository:

$ sudo dnf -y install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
$ sudo dnf -y install https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm

Outputs:

[root@localhost ~]# sudo dnf -y install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
Last metadata expiration check: 0:40:28 ago on Fri 27 Sep 2019 05:06:10 PM CST.
rpmfusion-free-release-30.noarch.rpm 14 kB/s | 13 kB 00:00
Dependencies resolved.
================================================================================================================================================================
Package Architecture Version Repository Size
================================================================================================================================================================
Installing:
rpmfusion-free-release noarch 30-1 @commandline 13 k

Transaction Summary
================================================================================================================================================================
Install 1 Package

Total size: 13 k
Installed size: 8.7 k
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : rpmfusion-free-release-30-1.noarch 1/1
Verifying : rpmfusion-free-release-30-1.noarch 1/1

Installed:
rpmfusion-free-release-30-1.noarch

Complete!
[root@localhost ~]# sudo dnf -y install https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
RPM Fusion for Fedora 30 - Free - Updates 91 kB/s | 363 kB 00:03
RPM Fusion for Fedora 30 - Free 249 kB/s | 735 kB 00:02
rpmfusion-nonfree-release-30.noarch.rpm 15 kB/s | 14 kB 00:00
Dependencies resolved.
================================================================================================================================================================
Package Architecture Version Repository Size
================================================================================================================================================================
Installing:
rpmfusion-nonfree-release noarch 30-1 @commandline 14 k

Transaction Summary
================================================================================================================================================================
Install 1 Package

Total size: 14 k
Installed size: 8.9 k
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : rpmfusion-nonfree-release-30-1.noarch 1/1
Verifying : rpmfusion-nonfree-release-30-1.noarch 1/1

Installed:
rpmfusion-nonfree-release-30-1.noarch

Complete!

Once RPMfusion repo is added, and you can search “ffmpeg” package if it is available in RPMfusion repo, or you can also use “dnf info” command to display details about ffmpeg pacakge, type:

$ sudo dnf search ffmpeg

or

$ sudo dnf info ffmpeg

Outputs:

[root@localhost ~]# dnf search ffmpeg
RPM Fusion for Fedora 30 - Nonfree - Updates 2.8 kB/s | 51 kB 00:18
RPM Fusion for Fedora 30 - Nonfree 53 kB/s | 227 kB 00:04
Last metadata expiration check: 0:00:01 ago on Fri 27 Sep 2019 05:49:43 PM CST.
================================================================= Name Exactly Matched: ffmpeg =================================================================
ffmpeg.x86_64 : Digital VCR and streaming server
================================================================ Name & Summary Matched: ffmpeg ================================================================
ffmpeg-libs.i686 : Libraries for ffmpeg
ffmpeg-libs.x86_64 : Libraries for ffmpeg
mythffmpeg.i686 : MythTV build of FFmpeg
mythffmpeg.x86_64 : MythTV build of FFmpeg
ffmpegthumbs.x86_64 : KDE ffmpegthumbnailer service
ffmpeg-devel.i686 : Development package for ffmpeg
ffmpeg-devel.x86_64 : Development package for ffmpeg

[root@localhost ~]# dnf info ffmpeg
Last metadata expiration check: 0:03:15 ago on Fri 27 Sep 2019 05:49:43 PM CST.
Available Packages
Name : ffmpeg
Version : 4.1.4
Release : 2.fc30
Architecture : x86_64
Size : 1.3 M
Source : ffmpeg-4.1.4-2.fc30.src.rpm
Repository : rpmfusion-free-updates
Summary : Digital VCR and streaming server
URL : http://ffmpeg.org/
License : GPLv2+
Description : FFmpeg is a complete and free Internet live audio and video
: broadcasting solution for Linux/Unix. It also includes a digital
: VCR. It can encode in real time in many formats including MPEG1 audio
: and video, MPEG4, h263, ac3, asf, avi, real, mjpeg, and flash.

Step2: Installing FFmpeg


Once the RPMfusion repo has been added, and you can now to install FFmpeg tool by running the following dnf command:

$ sudo dnf install ffmpeg

Outputs:

[root@localhost ~]# dnf install ffmpeg
Last metadata expiration check: 0:05:30 ago on Fri 27 Sep 2019 05:49:43 PM CST.
Dependencies resolved.
================================================================================================================================================================
Package Architecture Version Repository Size
================================================================================================================================================================
Installing:
ffmpeg x86_64 4.1.4-2.fc30 rpmfusion-free-updates 1.3 M
Installing dependencies:
libstdc++-devel x86_64 9.2.1-1.fc30 updates 2.1 M
libvdpau x86_64 1.2-3.fc30 updates 16 k
vid.stab x86_64 1.1.0-11.20190213gitaeabc8d.fc30 updates 45 k
clang-libs x86_64 8.0.0-1.fc30 fedora 17 M
hwloc-libs x86_64 1.11.12-2.fc30 fedora 1.6 M
jack-audio-connection-kit x86_64 1.9.12-8.fc30 fedora 477 k
libaom x86_64 1.0.0-6.20180925gitd0076f5.fc30 fedora 1.3 M
libass x86_64 0.14.0-3.fc30 fedora 102 k
libconfig x86_64 1.7.2-3.fc30 fedora 66 k
libffado x86_64 2.4.1-6.fc30 fedora 826 k
libmfx x86_64 1.25-2.fc30 fedora 34 k
libva x86_64 2.4.1-1.fc30 fedora 81 k
libvmaf x86_64 1.3.9-2.20180914gita654f6f.fc30 fedora 362 k
libxml++ x86_64 2.40.1-8.fc30 fedora 92 k
ocl-icd x86_64 2.2.12-3.fc30 fedora 45 k
openal-soft x86_64 1.19.1-2.fc30 fedora 509 k
pugixml x86_64 1.9-3.fc30 fedora 99 k
zvbi x86_64 0.2.35-8.fc30 fedora 405 k
ffmpeg-libs x86_64 4.1.4-2.fc30 rpmfusion-free-updates 7.0 M
libavdevice x86_64 4.1.4-2.fc30 rpmfusion-free-updates 73 k
x264-libs x86_64 0.157-11.20190717git34c06d1.fc30 rpmfusion-free-updates 609 k
opencore-amr x86_64 0.1.5-7.fc30 rpmfusion-free 174 k
vo-amrwbenc x86_64 0.1.3-9.fc30 rpmfusion-free 74 k
x265-libs x86_64 3.0-2.fc30 rpmfusion-free 1.8 M
xvidcore x86_64 1.3.5-5.fc30 rpmfusion-free 253 k
Installing weak dependencies:
libomp x86_64 8.0.0-2.fc30 updates 308 k
compiler-rt x86_64 8.0.0-1.fc30 fedora 2.7 M
pocl x86_64 1.2-4.20190221gita0b083a1b47a738.fc30 fedora 13 M

Transaction Summary
================================================================================================================================================================
Install 29 Packages

Total download size: 52 M
Installed size: 281 M
Is this ok [y/N]:

Once FFmpeg package is installed, and you can verify the installation by running the following command:

$ dnf ffmpeg -version

Outputs:

[root@localhost ~]# dnf --version
4.2.8
Installed: dnf-0:4.2.8-2.fc30.noarch at Tue 24 Sep 2019 07:40:17 AM GMT
Built : Fedora Project at Tue 10 Sep 2019 12:16:53 PM GMT

Installed: rpm-0:4.14.2.1-5.fc30.x86_64 at Tue 24 Sep 2019 07:36:31 AM GMT
Built : Fedora Project at Thu 29 Aug 2019 10:46:16 AM GMT
[root@localhost ~]#

Step3: Using FFmpeg


If you want to get video file information, and you can pass the “-i” option to the ffmpeg command. For example, you have a video file named myvideo.mov in your Local disk, and you want to print the information about this video file, type:

$ ffmpeg -i myvideo.mov

Outputs:

[root@localhost ~]# ffmpeg -i myvideo.mov
ffmpeg version 4.1.4 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 9 (GCC)
configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --docdir=/usr/share/doc/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' --extra-ldflags='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld ' --extra-cflags=' ' --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-version3 --enable-bzlib --disable-crystalhd --enable-fontconfig --enable-frei0r --enable-gcrypt --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libcdio --enable-libdrm --enable-libjack --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libmp3lame --enable-nvenc --enable-openal --enable-opencl --enable-opengl --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzvbi --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-libmfx --enable-runtime-cpudetect
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'myvideo.mov':
Metadata:
major_brand : qt
minor_version : 537199360
compatible_brands: qt
creation_time : 2019-08-09T22:52:52.000000Z
com.apple.finalcutstudio.media.uuid: CFD51E47-E736-4435-A1F6-3049BCCB8A4F
timecode : 00:59:59:23
Duration: 00:00:56.14, start: 0.000000, bitrate: 1213 kb/s
Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 848x360, 1129 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 48k tbc (default)
Metadata:
creation_time : 2019-08-09T22:52:52.000000Z
handler_name : Apple Video Media Handler
encoder : H.264
Stream #0:1(eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
Metadata:
creation_time : 2019-08-09T22:52:52.000000Z
handler_name : Time Code Media Handler
timecode : 00:59:59:23
Stream #0:2(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 78 kb/s (default)
Metadata:
creation_time : 2019-08-09T22:52:52.000000Z
handler_name : Apple Sound Media Handler

And if you only want to display the media file information, and do not print the FFmpeg banner and other detailes, just pass the “-hide_banner” option to the above command,type:

$ ffmpeg -i myvideo.mov -hide_banner

Outputs:

[root@localhost ~]# ffmpeg -i myvideo.mov -hide_banner
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'myvideo.mov':
Metadata:
major_brand : qt
minor_version : 537199360
compatible_brands: qt
creation_time : 2019-08-09T22:52:52.000000Z
com.apple.finalcutstudio.media.uuid: CFD51E47-E736-4435-A1F6-3049BCCB8A4F
timecode : 00:59:59:23
Duration: 00:00:56.14, start: 0.000000, bitrate: 1213 kb/s
Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 848x360, 1129 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 48k tbc (default)
Metadata:
creation_time : 2019-08-09T22:52:52.000000Z
handler_name : Apple Video Media Handler
encoder : H.264
Stream #0:1(eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
Metadata:
creation_time : 2019-08-09T22:52:52.000000Z
handler_name : Time Code Media Handler
timecode : 00:59:59:23
Stream #0:2(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 78 kb/s (default)
Metadata:
creation_time : 2019-08-09T22:52:52.000000Z
handler_name : Apple Sound Media Handler
At least one output file must be specified

If you want to convert your video file to different formats, for example, convert mov file to mp4 file, just type the following command:

$ ffmpeg -i myvideo.mov myvideo.mp4 -hide_banner

Outputs:

[root@localhost ~]# ffmpeg -i myvideo.mov myvideo.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'myvideo.mov':
Metadata:
major_brand : qt
minor_version : 537199360
compatible_brands: qt
creation_time : 2019-08-09T22:52:52.000000Z
com.apple.finalcutstudio.media.uuid: CFD51E47-E736-4435-A1F6-3049BCCB8A4F
timecode : 00:59:59:23
Duration: 00:00:56.14, start: 0.000000, bitrate: 1213 kb/s
Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 848x360, 1129 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 48k tbc (default)
Metadata:
creation_time : 2019-08-09T22:52:52.000000Z
handler_name : Apple Video Media Handler
encoder : H.264
Stream #0:1(eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
Metadata:
creation_time : 2019-08-09T22:52:52.000000Z
handler_name : Time Code Media Handler
timecode : 00:59:59:23
Stream #0:2(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 78 kb/s (default)
Metadata:
creation_time : 2019-08-09T22:52:52.000000Z
handler_name : Apple Sound Media Handler
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:2 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x5649c1665080] using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX
[libx264 @ 0x5649c1665080] profile High, level 3.0, 4:2:0, 8-bit
[libx264 @ 0x5649c1665080] 264 - core 157 r2980 34c06d1 - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - http://www.videolan.org/x264.html - options: cabac=1 ref =3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip= 1 chroma_qp_offset=-2 threads=1 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_ad apt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=23 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'myvideo.mp4':
Metadata:
major_brand : qt
minor_version : 537199360
compatible_brands: qt
timecode : 00:59:59:23
com.apple.finalcutstudio.media.uuid: CFD51E47-E736-4435-A1F6-3049BCCB8A4F
encoder : Lavf58.20.100
Stream #0:0(eng): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 848x360, q=-1--1, 0.04 fps, 24k tbn, 23.98 tbc (default)
Metadata:
creation_time : 2019-08-09T22:52:52.000000Z
handler_name : Apple Video Media Handler
encoder : Lavc58.35.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
creation_time : 2019-08-09T22:52:52.000000Z
handler_name : Apple Sound Media Handler
encoder : Lavc58.35.100 aac
frame= 1346 fps= 32 q=28.0 Lsize= 6532kB time=00:00:56.14 bitrate= 953.1kbits/s speed=1.32x
video:5603kB audio:886kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.669846%
[libx264 @ 0x5649c1665080] frame I:42 Avg QP:19.25 size: 15320
[libx264 @ 0x5649c1665080] frame P:599 Avg QP:22.07 size: 5789
[libx264 @ 0x5649c1665080] frame B:705 Avg QP:24.72 size: 2306
[libx264 @ 0x5649c1665080] consecutive B-frames: 8.4% 63.9% 4.2% 23.5%
[libx264 @ 0x5649c1665080] mb I I16..4: 26.3% 46.2% 27.5%
[libx264 @ 0x5649c1665080] mb P I16..4: 7.7% 13.9% 3.8% P16..4: 39.6% 9.4% 3.6% 0.0% 0.0% skip:22.1%
[libx264 @ 0x5649c1665080] mb B I16..4: 1.4% 2.4% 1.2% B16..8: 33.4% 3.6% 0.7% direct: 3.4% skip:53.9% L0:40.0% L1:53.3% BI: 6.8%
[libx264 @ 0x5649c1665080] 8x8 transform intra:52.2% inter:68.9%
[libx264 @ 0x5649c1665080] coded y,uvDC,uvAC intra: 46.1% 64.5% 19.7% inter: 12.0% 19.9% 0.9%
[libx264 @ 0x5649c1665080] i16 v,h,dc,p: 35% 22% 22% 20%
[libx264 @ 0x5649c1665080] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 33% 17% 28% 4% 3% 4% 4% 4% 4%
[libx264 @ 0x5649c1665080] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 16% 16% 6% 6% 6% 7% 6% 6%
[libx264 @ 0x5649c1665080] i8c dc,h,v,p: 49% 18% 26% 6%
[libx264 @ 0x5649c1665080] Weighted P-Frames: Y:13.0% UV:8.5%
[libx264 @ 0x5649c1665080] ref P L0: 74.5% 10.7% 11.1% 3.4% 0.4%
[libx264 @ 0x5649c1665080] ref B L0: 93.7% 5.6% 0.7%
[libx264 @ 0x5649c1665080] ref B L1: 99.4% 0.6%
[libx264 @ 0x5649c1665080] kb/s:817.51
[aac @ 0x5649c1650100] Qavg: 389.086

[root@localhost ~]# ls myvideo.*
myvideo.mov  myvideo.mp4

If you want to get more information about FFmpeg tool, and you can get help by running the following commands:

$ man ffmpeg
$ ffmpeg -h

Conclusion


You should know that how to install and use FFmpeg Tool using dfn command in CentOS or RHEL or Ubuntu Linux system.