AdvancedDigital Inc. Broadcasting and IPTV Experts

Digital Video Broadcasting and IPTV

A blog by AdvancedDigital Inc.

Introduction to FFMPEG for Broadcast Engineers

April 7, 2014

In this article we would like to introduce the reader to the great software called FFMPEG.

FFMPEG is a free, open source, command line program that can greatly assist anyone doing work related to development, testing, or integration of digital video and/or IPTV. Anyone working in these fields should absolutely have it as part of their toolset.

It can be downloaded from, and is available for most platforms, including Windows, OSX, and Linux.

FFMPEG carries an enormous set of features, here are some of the most common ones:

  • Encoder – supports encoding into such standards as H.264, MPEG-4, MPEG-2, and many others. Many audio encoding formats are available as well.
  • Transcoder – convert from one standard to another. For example, you can create an MPEG-4 video file from an MPEG-2 file.
  • Decoder – decode and play video files
  • IP Streamer
  • DVB Analyser
  • Many more features are described in the documentation here. At AdvancedDigital FFMPEG is an invaluable tool and is used extensively when developing and testing our products.

Here are some examples on how we utilize FFMPEG for common day-to-day operations.

Creating Transport Stream (TS) files

The broadcasting industry has embraced Transport Streams as a container format for digital video/audio. TS files are commonly used in IPTV applications, and as input to digital modulators (such as our TVB597 or DTU-215).

Here is a quick way to create TS files from your H.264 or MPEG-2 files.

ffmpeg -i input.avi -vcodec copy -acodec copy -f mpegts output-file.ts

The above command will convert input.avi into a Transport Stream file called output-file.ts.

The -vcodec copy -acodec copy part instructs ffmpeg to use the same video and audio codec as in the original file (input.avi), no transcoding will be done. It is important to note that DVB standards such as DVB-T, 8VSB, and DVB-S only support MPEG-2 as the encoding standard (H.264/MPEG-4 is not officially supported).

Convert (transcode) an H.264 file into an MPEG-2 file

FFMPEG lets you transcode both the audio and video from one format to another. Have an H.264 file and need to convert it to MPEG-2 TS? Many DVB standards only support MPEG-2, while the post-production world has switched to more efficient formats such as H.264/MPEG-4.

Here is how to use FFMPEG for the H.264 to MPEG-2 conversion:

ffmpeg -i input.avi -vcodec mpeg2video -acodec mp2 -b:v 10M -b:a 192k -muxrate 10M -f mpegts output.ts

Let’s go over these command line options:

-i input.avi this is our H.264 file that we wish to convert to MPEG-2

-vcodec mpeg2video set video encoding codec to mpeg2

-acodec mp2 set audio encoding codec to mpeg2

-b:v 10M set video bitrate to 10 Mbps

-b:a 192k set audio bitrate to 192 Kb

-muxrate 10M make sure the combined audio and video stream is 10 Mbps

-f mpegts output.ts create a Transport Stream called output.ts

Convert a MPEG-2 file into an H.264 file

Converting from MPEG-2 to H.264 is even easier. Here is one way to do it:

ffmpeg -i output.ts -vcodec h264 -acodec mp3 output.avi

This will convert any supported file into h264 video with mp3 audio.

Get a List of all the supported codecs

As previously mentioned FFMPEG supports many video/audio codecs. To get a full list enter: ffmpeg–formats

Stream an H.264 file over UDP/RTP

FFMPEG can be used to easily stream a file over UDP/RTP. We manufacture and sell various IP based receivers, such as our ADV-6000. With FFMPEG we can send various files to the ADV-6000 for testing and development purposes.

ffmpeg -re -i input.ts -vcodec copy -acodec copy -f mpegts "udp://"

This will stream the file input.ts over UDP to a receiver with IP address of lisitening for incoming streams on port 5000.

Streaming to a multicast address is also possible. Simply replace the IP address above with a multicast address.

Stream an H.264 file over RTMP/RTSP/HTTP/FTP/HLS/many many more…

FFMPEG supports many streaming output protocols. This makes is an ideal tool for testing and development. Need to test video streaming to an iPhone? FFMPEG makes it possible using HLS streaming. Need to test your CDN? No problem, send an RTMP stream.

To see the list of supported protocols and their usage you can visit:


The features and commands described above do not even begin to scratch the surface of the full capabilities of FFMPEG. To get a full scope of the of the features and their use I highly suggest reading the documentation.

We hope you’ve found this introduction useful. Please leave any questions in the comments.


AdvancedDigital Inc. offers equipment and services for the digital video broadcasting industry.

Recent Blog Posts

Follow @advanceddgtl