How to Get Rid of DTS/AC3 Audio using ffmpeg on Linux to Play MKV Files on iOS or Android

I encountered the problem on iPhone that MKV video files with AC3 are played with no sound. The OPlayer reports to me that “According to DTS patent, DTS is forbidden to play , None of the media player on iPhone/iPad can play DTS”.

However, the video file can be played in MPlayer on Linux just well. Checking MPlayer’s output:

##########################################################################
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
[ac3 @ 0x7ff826946dc0]Channel layout '5.1(side)' with 6 channels does not match specified number of channels 2: ignoring specified channel layout
AUDIO: 48000 Hz, 2 ch, floatle, 640.0 kbit/20.83% (ratio: 80000->384000)
Selected audio codec: [ffac3] afm: ffmpeg (FFmpeg AC-3)
##########################################################################

Here, “Selected audio codec: [ffac3] afm: ffmpeg (FFmpeg AC-3)” indicates that the audio is encoded in AC-3.

That’s unpleasant. Let’s fix it. If you would like to convert many such files and would like to have a script to convert them on Linux, you may use the ffmpeg tool.

The command is as follows for one file:

$ ffmpeg -i your_video.mkv -vcodec copy -acodec libmp3lame your_video_noac3.mkv

After the file is converted, let’s play it again in MPlayer. The output shows

##########################################################################
Opening audio decoder: [mpg123] MPEG 1.0/2.0/2.5 layers I, II, III
AUDIO: 48000 Hz, 2 ch, s16le, 128.0 kbit/8.33% (ratio: 16000->192000)
Selected audio codec: [mpg123] afm: mpg123 (MPEG 1.0/2.0/2.5 layers I, II, III)
##########################################################################

Now, the audio codec is mpg123 (mp3). Most players on iOS and Android can play the audio now.

Note: you can find some other methods for Windows and VLC users manually.

Leave a Reply

Your email address will not be published. Required fields are marked *