Back to api.video Glossary

Ffmpeg

FFmpeg

What is FFmpeg?

FFmpeg stands for Fast Forward Moving Picture Experts Group. It is a free and open source software project that offers many tools for video and audio processing. It's designed to run on a command line interface, and has many different libraries and programs to manipulate and handle video files. FFmpeg is available for use in many different programming languages. With FFMPEG, you can decode, encode, transcode, mux, demux, stream, filter and play most types of video and audio.

FFmpeg

FFmpeg commands

FFmpeg offers three main command line tools:

  • FFmpeg - FFmpeg is a powerful command-line tool used for converting audio and video formats. It can handle a wide range of multimedia files and streams. This tool is capable of performing various functions such as capturing real-time input from hardware devices (like webcams and audio interfaces) or software sources (like screen capture or stream links), extracting audio from video files, merging multiple videos, adding watermarks, and more.
  • FFplay - FFplay is a simple media player that uses the Simple DirectMedia Layer (SDL) library and FFmpeg libraries to play multimedia content. It's a straightforward tool to quickly play audio and video files from the command line. While it lacks the advanced playback features of more sophisticated media players, it's useful for testing and debugging media files directly within a command-line environment.
  • FFprobe - FFprobe a tool for displaying details about your media in text, csv, xml or json. It extracts detailed metadata and technical information from audio and video files, such as codec details, frame rate, bit rate, resolution, duration, and more. The output can be displayed in various formats, including plain text, CSV (Comma-Separated Values), XML (eXtensible Markup Language), or JSON (JavaScript Object Notation), making it easy to parse and use in scripts or other applications.

 

Did you know? The FFMPEG logo is based on the zigzag scan used in entropy encoding for images and video.

What is the FFMPEG Project?

The FFMPEG project was started by Farice Bellard under the pseudonym Gérard Lantau in 2000 and was then led by Michael Niedermayer from 2004 until 2015. Due to internal disagreements about how the project was managed, from 2011 on, FFMPEG was split into two forks – FFMPEG and libav. Both projects were nearly identical in terms of what they contained, but distributors would have to choose which to use. Today, libav is reintegrated with FFMPEG. A new release of FFMPEG is published every roughly three months.

 

Most video programs include FFMPEG as a part of the video processing pipeline (api.video included). Part of what makes FFMPEG so popular is its inclusion of codecs for the encoding and/or decoding of most audio and video file formats, allowing it to be used for transcoding of all types of media files into a single common format.

Examples with FFMPEG

Some examples in our sample applications include livestream.a.video and record.a.video. These two web applications record the camera using webRTC protocols. To stream on the web with api.video, this needs to be converted to RTMP. This is done using FFMPEG on an intermediate NodeJS server:

	var ops = [
				'-i','-',
        '-preset', 'ultrafast', '-tune', 'zerolatency', 
			  '-r', framerate, '-g', framerate*2, '-keyint_min',keyint_min, 
     				'-c:a', 'aac', '-b:a','44k', '-ar', 44100, 
			        '-f', 'flv', socket._rtmpDestination		
		
		];
	
		ffmpeg_process=spawn('ffmpeg', ops);

The operators take the incoming video stream, and using the ultrafast preset, and the zerolatency tuning, convert the video to flv (RTMP flash format), and send the file to the rtmpDestination variable.

In watermark.a.video the livestream further adds an image as a watermark:

var ops = [
				'-i', socket._watermarkUrl,
				'-i','-',
				'-preset', 'ultrafast', '-tune', 'zerolatency', 
			  '-r', framerate, '-g', framerate*2, '-keyint_min',keyint_min, 
				'-filter_complex', '[1:v][0:v] overlay=25:25',
     		'-c:a', 'aac', '-b:a','44k', '-ar', 44100, 
			  '-f', 'flv', socket._rtmpDestination		
		
		];

In this case, there are 2 inputs, the video, and the image (watermarkUrl). the filter_complex places the 0 input on top of the 1 input at x,y (25, 25).

These are just 2 small examples of the power that ffmpeg can harness with your videos.

 

api.video enables you to quickly and securely deliver on-demand and live-stream videos directly from your website, software, or app. Sign-up for a free sandbox account to try out api.video’s video API, or talk to our team to get a demo.

Related content

glossaryglossary