Javatpoint Logo
Javatpoint Logo

Install FFmpeg Ubuntu

What is FFmpeg?

FFmpeg is an open-source and free software project composed of a suite of programs and libraries to handle audio, video, and other multimedia streams and files. At its core is a command-line tool itself, i.e., ffmpeg, designed to process audio and video files. It's widely used for video scaling, basic editing (concatenation and trimming), format transcoding, video post-production standards, and effects compliance (ITU, SMPTE).

Also, FFmpeg includes some other tools like ffplay, which is a normal media player, and ffprobe, which is a tool of command-line to show media information. Between added libraries are libavcodec, a video/audio codec library used by several free and commercial software products, libavformat, a video/audio demux library, and container mux, and libavfilter, a library to enhance and edit filters from a Gstreamer-like filtergraph.

It is a segment of the workflow of several other software projects and all libraries are a core segment of software media players like VLC and it has been added in core processing for BiliBili and YouTube. Decoders and encoders for several video and audio file formats are added, making it very helpful for the transcoding of uncommon and common media files. FFmpeg is released under the GPL-2.0 or later or LGPL-2.1 or later, relying on which option is enabled.

History of FFmpeg

This project was begun by Fabrice Bellard in 2000 and was directed by Michael Niedermayer from 2004 to 2015. Also, a few developers of FFmpeg were a part of the project of MPlayer.

The project name is derived by the MPEG video standards group, well-synced with "FF" which stands for "Fast Forward". Its logo applies a zigzag pattern that displays how the video codec of MPEG manages entropy encoding.

Two employees of Google announced that 1000+ bugs had been solved in FFmpeg during the past two years by fuzz testing in 2014 January 10.

A command-line program, i.e., ffserver, a long-time element of FFmpeg, was deleted in 2018 January. Previously, the developers had deprecated this program citing much maintenance efforts because of its internal application programming interfaces usage.

The project releases a new version every three months. While published versions are present for download from the website. The developers of FFmpeg suggest that users use the software using the source with the current build from the source code GIT version control system.

History of Codec

Two formats of video coding with related codecs and one format of the container have been developed in the FFmpeg project. These two codecs of video are the lossless FFV1, and the lossy Snow and lossless codec. Snow development has been delayed, while its format of bit-stream hasn't been yet finalized, making it experimental from 2011. The format of the multimedia container, which is known as NUT, is not being developed actively but is still organized.

The developers of FFmpeg, David Conrad, Ronald Bultje, Fiona Glazer, announced the decoder of ffvp8 in 2010 summer. They decided through testing that ffvp8 was quick as compared to the libvpx decoder of Google. Beginning with the 0.6 version, FFmpeg also supported VP8 and WebM.

Components of FFmpeg

Tools of Command-line

  • ffmpeg is a tool of command-line that can convert video or audio formats. Also, it can encode and capture in real-time from several software and hardware sources like a TV capture card.
  • ffprobe is a tool of command-line to show media information (JSON, XML, CSV, and text).
  • ffplay is a normal media player that is utilizing the FFmpeg libraries and SDL.

Libraries of FFmpeg

  • libswresample is a library including the routines of audio resampling.
  • libavresample is a library including the routines of audio resampling using the Libav project, which is the same as libswresample through ffmpeg.
  • libavcodec is a library including every native video/audio decoder and encoder of FFmpeg. Most codecs were created from scratch for ensuring high code reusability and best performance.
  • libavformat is a library including muxers and demuxers for video/audio container formats.
  • libavutil can be described as a helper library including several routines common to distinct FFmpeg This library contains the Base64 decoder/encoder, LZO decompressor, ciphers, and hash functions.
  • libpostproc is a library including previous 263 based routines of video postprocessing.
  • libswscale is a library including routines of video pixel format/colorspace and image scaling conversion.
  • libavfilter is the replacement for vhook which permits the audio/video to be examined or modified between the encoder and decoder. All filters have been ported from several projects including Avisynth and MPlayer.
  • libavdevice is a library including video/audio IO from external and internal devices.

Supported hardware of FFmpeg

CPUs

FFmpeg envelopes software implementations of audio and video decompressing and compressing algorithms. These could be compiled and executed on diverse sets of instruction. Several widespread sets of instruction are offered by FFmpeg, including MIPS, SPARC, DEC Alpha, ARM, PPC PowerPC and, x86 (x86-64 and IA-32).

Unique purpose hardware

There is a range of application-specific integrated circuits (short for ASIC) for video/audio decompression and compression. These can completely or partially e offload the computation process through the host CPU. Rather than a full implementation of the algorithms, the API is only needed to use like an ASIC.

Apply with the FFmpeg utility

The acceleration decoding of the internal hardware is activated from the option, i.e., -hwaccel. Normally, it begins decoding, but when a decodable stream is found in hardware, the decoder creates every significant processing for that hardware, hence accelerating the process of decoding.

Hardware acceleration would be skipped and it will be still decoded in software, whereas when no decodable streams are found (as happens on an unsupported profile for codec). The option, i.e., -hwaccel_device is used when the hardware needs a specific device for functioning especially if there are various graphic cards are exist.

Supported formats and codecs

Image formats

FFmpeg provides its support for a few uncommon and several common image formats. The image format, i.e., PGMYUV is a homebrew version of the binary (P5) PGM Netpbm format. Also, it supports PPM and PGM 16-bit depth formats, and the binary (P7) PAM format without or with alpha channel, depth 16 bit or 8 bit for pix_fmts rgb64be, rgba, ya8, rgb48be, rgb24, gray16be, gray, monob.

Muxers

The resulting formats (many container formats and other ways to create result streams) in FFmpeg are known as "muxers". Some of the muxers which are supported by FFmpeg are listed below:

  • AIFF
  • AVI and input through AviSynth as well
  • ASF
  • BFI
  • FLV
  • CAF
  • GIF
  • HLS (stands for HTTP Live Streaming)
  • GXF (stands for General eXchange Format)
  • IFF
  • Matroska (with WebM)
  • ISO base media file format (with MP4, 3GP, and QuickTime)
  • Maxis XA
  • MPEG program stream
  • MPEG-DASH
  • MPEG transport stream (with AVCHD)
  • MSN Webcam stream
  • MXF (stands for Material eXchange Format)
  • Ogg
  • NUT
  • RL2
  • OMA
  • A segment to create segmented video streams
  • WTV
  • TXD
  • Smooth Streaming

Pixel formats

FFmpeg provides its support for several pixel formats. A few of these formats are supported as many input formats only. It doesn't support Log RGB, RGBE, CYMK, AI44, IMC1-IMC4, and other formats. Also, it doesn't yet support ARGB 2:10:10:10, 1:5:5:5, or other formats of BMP bitfield that aren't used commonly.

Supported Protocols of FFmpeg

Open standards

  • IETF RFCs:
    • UDP-Lite
    • UDP
    • TCP
    • TLS
    • SRTP
    • SDP
    • SCTP
    • RTSP
    • RTP
    • HTTPS
    • HTTP
    • HLS
    • Gopher
    • FTP
  • IETF I-Ds:
    • SFTP (by libssh)
  • SRT Alliance standard:
    • SRT (by libsrt)
  • OASIS standards:
    • AMQP 0-9-1 (by librabbitmq)
  • CENELEC:
    • SAT>IP
  • Microsoft OSP:
    • MMS on HTTP (MS-WMSP)
    • MMS on HTTP (MS-MMSP)
    • SMB/CIFS (by libsmbclient)

De facto standards

  • RIST (librist)
  • ZeroMQ (by libzmq)
  • RealMedia RDT/RTSP
  • Adobe RTMP, RTMPS, RTMPE, and RTMPTE
  • Icecast protocol
  • RTSP on TLS

Supported interfaces and media

FFmpeg supports the below devices by external libraries:

Physical interfaces

  • IEEE1394 (also called FireWire; by libraw1394 and libdc1394; only input)
  • Brooktree video capture chip (by bktr driver; only input)
  • DeckLink
  • IEC 61883 (by libiec61883; only input)

Media

  • Compact disc (by libcdio; only input)

Audio IO

  • Open Sound System (short for OSS)
  • Advanced Linux Sound Architecture (short for ALSA)
  • PulseAudio
  • OpenAL (only input)
  • Sndio
  • JACK Audio Connection Kit (JACK; only input)
  • Core Audio (macOS)
  • AudioToolbox (only output)
  • AVFoundation (only input)

Video IO

  • Android Camera (only input)
  • Windows DirectShow
  • Video for Windows (only input)
  • Video4Linux2

Screen output and capture

  • Kernel Mode Setting (by libdrm; only input)
  • X video extension (XV; by Xlib; only output)
  • X Window System (X11; by XCB; only input)
  • Graphics Device Interface (GDI; only input)
  • Linux framebuffer (fbdev)
  • OpenGL (only output)
  • Simple DirectMedia Layer 2 (only output)

Others

  • ASCII art (by libcaca; only output)

Supported Filter of FFmpeg

FFmpeg supports the following filters:

Audio

  • Resampling
  • Stop/Pass filters
    • Butterworth Band-stop filter (bandreject)
    • Butterworth Band-pass filter (bandpass)
    • All-pass filter (allpass)
    • High-pass filter (highpass)
    • Low-pass filter (lowpass)
  • Arbitrary Infinite Impulse Response Filter (afir)
  • Arbitrary Finite Impulse Response Filter (aiir)
  • Equalizer
    • Biquad filter
    • FIR Equalizer
    • Xbox 360 rqulizer
    • High Shelving filter
    • Low Shelving filter
    • Chebyshev/Butterworth Type1/Type2 Multiband Equalizer
    • Peak Equalizer

Video

  • Transformations
    • Transposition (transpose)
    • Rotation (rotate)
    • Padding (pad)
    • Scaling (scale)
    • Fading (fade)
    • Cropping (cropdetect, crop)
  • Others:
    • Perspective correction
    • OpenCV filtering
    • Lens correction
  • Temporal editing
    • Trimming (trim)
    • Looping (loop)
    • Framerate (framerate, fps)
  • Filtering
    • Blurring (smartblur, sab, avgblur, gblur, boxblur)
    • Convolution filters
    • Unsharp masking
    • Prewitt filter
    • Sobel filter
    • Edge detection
    • Convolution

Supported test patterns

  • EBU color bars (pal100bars and pal75bars)
  • SMPTE color bars (smptehdbars and smptebars)

Supported LUT formats

  • Pandora m3d
  • DaVinci Resolve dat
  • Adobe After Effects 3dl
  • Iridas Cube
  • cineSpace LUT format

Applications of FFmpeg

Legal aspects

FFmpeg includes 100+ codecs, almost all of which apply compression methods of one type or another. several such compression methods might be subject to legal claims corresponding to software patents. These claims might be enforceable in some countries such as the United States which have achieved software patents but are examined void or unenforceable in some European Union member countries.

Patents for several older codecs, like all MPEG-2 and MPEG-1 codecs and AC3, have concluded. FFmpeg is licensed upon the LGPL license, however, if a specific FFmpeg build is connected against a GPL library, then the whole binary is licensed upon the GPL.

Projects with FFmpeg

FFmpeg is applied by FFmpeglnterop, OpenMAX IL, Perian, and Gstreamer FFmpeg plug-in for expanding the decoding and encoding capabilities of the corresponding multimedia platform.

FFmpeg is applied by software like MPC-HC, VirtualDub fork, VirtualDub2, YouTube, HandBrake, Blender, Kodi, Plex, Cinelerra-GG video editor, Shotcut, xine, and VLC media player. It manages audio and video playback media in Google Chrome and the Firefox Linux version. For FFmpeg, graphical user interface front-ends have been integrated, with XMedia Recode.

As a part of the Mars 2020 mission of NASA, FFmpeg is applied by Perseverance rover over Mars for video and Image compression before being transferred back to earth.

How we can install FFmpeg in Ubuntu?

FFmpeg is an open-source and free tool of command-line to transcode multimedia files. It includes a group of shared video and audio libraries like libavutil, libavformat, and libavcodec. We can convert between several video and audio formats, resize videos, and set sample rates with FFmpeg.

It is a very famous software project, which is a group of libraries and programs that are used for handling video and audio file conversion, recording other files of multimedia, and streams as well. It's a toolbox present in the command line for converting, streaming, and manipulating multimedia content.

In this article, we will explain how we can install FFmpeg in the 20.04 version of Ubuntu.

Installation Process

There are several days for installing FFmpeg in the 20.04 version of Ubuntu, like installing it using the official package repository of Ubuntu, using the source, and using the snap store.

The most convenient and easiest way for installing the stable FFmpeg version is to install it using the package manager of APT.

We are going to install the 4.2.4 version of and FFmpeg and it's available on the APT package repository of Ubuntu.

1. We need to first update the APT cache repository of the system for installing it. The command is mentioned below to update the system:


Install FFmpeg Ubuntu

2. After updating the APT cache repository of the system, we can install the FFmpeg software with the help of a command which is mentioned below:


Install FFmpeg Ubuntu

3. It might ask to take extra disk space for the installation process, we need to type "y" and click on the Enter button.

4. FFmpeg is now installed on our 20.04 LTS version of Ubuntu.

5. The next thing we should do is to check the FFmpeg version with the help of the command after approving its installation. The command is mentioned below:


Install FFmpeg Ubuntu

Print/see Decoders and Encoders

We need to enter the following command in the terminal window to print/see decoders and encoders available in FFmpeg:


Install FFmpeg Ubuntu

Install FFmpeg Ubuntu

FFmpeg is perfectly working and installed on our system. Let's try some other tasks such as extracting the information of the file, audio using a video file, and converting an audio or video file to other formats.

Extracting the File Info

We can use the following command in the terminal Window for or getting every information of any media file in the 20.04 LTS version of the Ubuntu system with FFmpeg:

Make sure to substitute the "audio_file_mp3" with our video or audio file name. We can obtain the information of a video file with the help of the same command which is mentioned above.

Extracting Audio using a Video File

We can use the following command in the terminal window for extracting the audio using any video file with ffmpeg:

We can obtain the audio using any video file with the help of the above command. We need to substitute the "video_file_mp4" with the name of our video file, and later give the name of a new audio file that we are about to extract.

Converting any Media File to Other Formats

If we wish to convert our video or audio file to another format of our requirement, we can do so by entering the following command in the terminal window. For instance, to convert a video (MP4 format), WEBM format, let's say.

It is how we can convert our media files to other file formats.

The command would be similar to the above to convert an audio file to any other format. We need to first give the name of the file to which we wish to convert and after that give the new name of that file with the file format.







Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA