How to Convert 5.1 Audio to E-AC-3 with FFmpeg

This guide provides a quick and practical walkthrough on how to convert a multi-channel 5.1 audio stream to Dolby Digital Plus (E-AC-3) using the FFmpeg command-line utility. You will find the precise commands required to execute the conversion, configure the proper channel layout, and set the optimal bitrate for high-quality surround sound playback on supported home theater systems.

The Basic Conversion Command

To convert an existing audio stream inside a video file to Dolby Digital Plus while keeping the original video stream untouched, use the native FFmpeg eac3 encoder. Run the following command in your terminal:

ffmpeg -i input.mkv -c:v copy -c:a eac3 -b:a 448k output.mkv

Command Breakdown:


Ensuring 5.1 Channel Layout (6 Channels)

If your input file has more channels (such as 7.1) or you want to explicitly force FFmpeg to output a 5.1 channel layout, use the -ac flag to define the channel count:

ffmpeg -i input.mkv -c:v copy -c:a eac3 -ac 6 -b:a 640k output.mkv

Extracting 5.1 Audio to a Standalone E-AC-3 File

If you want to extract the 5.1 audio track from a video file and save it as a standalone audio file, discard the video stream by using the -vn flag:

ffmpeg -i input.mkv -vn -c:a eac3 -ac 6 -b:a 448k output.eac3