Simple DTS to AC3 using FFmpeg

Many people ask if they can convert the audio (usually DTS, DTS-HD or Dolby TrueHD) of their .mkv file to AC3 audio (Dolby Digital) without extracting the audio, converting the audio to AC3 and then muxing the audio back to .mkv. There is a much simpler way by using FFmpeg. You can download compiled FFmpeg from (Compiled builds for Windows). Selecting the Static build is recommended.

Using the following command, all the tracks (video, subtitles, chapters etc.) are copied to a new .mkv file unaltered except the audio track, which is converted to AC3. Please note that FFmpeg supports only 5.1 channels for AC3 conversion at the moment.

C:\ffmpeg\bin\ffmpeg.exe -i myvideofile.mkv -map 0 -vcodec copy -scodec copy -acodec ac3 -b:a 640k myvideofilewithAC3.mkv

c:\ffmpeg\ is where you have extracted the FFmpeg build – myvideofile.mkv is the name of the video file you want the audio converted to AC3 – myvideofilewithAC3.mkv is the name of the new video file with the converted audio. The bit rate I use for AC3 is 640kb/s (the maximum for AC3). If you have compatibility problems with your standalone media player, you can use a lower bit rate such as 448kb/s (DVD Movies) or 384kb/s (used in iTunes movies) by changing the value in -b:a 640k to 448k or 384k.

You can also create a command batch file for a batch audio conversion to AC3. Open notepad, type the following command and save it as dts2ac3batch.cmd. Then simply copy this batch file to a folder with one or more .mkv files that you need the audio converted and run it (double-click).

FOR %%f IN (*.mkv) DO C:\ffmpeg\bin\ffmpeg.exe -i “%%f” -map 0 -vcodec copy -scodec copy -acodec ac3 -b:a 640k “%%~nf”-AC3.mkv

Each new converted file will have a -AC3 appended at the end of the file name, eg. for myvideofile.mkv, a new file with the name myvideofile-AC3.mkv will be created.

But wait, you’ll say, all these commands and copying the batch file makes my head spin, I want something easier. Well, we can be more creative, change the first command a little bit and save it to Desktop as dts2ac3.cmd using notepad again.

C:\ffmpeg\bin\ffmpeg.exe -i %1 -map 0 -vcodec copy -scodec copy -acodec ac3 -b:a 640k “%~d1%~p1%~n1”-AC3.mkv

Now simply drag the .mkv file you want the audio converted and voila a new converted file with the -AC3 appended at the end of the file name will be created at the same folder as the original file. You can even add more commands to the batch file, for example delete the original file after the conversion.

Sorry for writing this guide quickly. When I find time, I will update it with perhaps some visuals and better explanations.

Happy screenings!