3
votes

I've got a number of MKV files which are (per VLC) encoded with A/52 B (aka E-AC3) audio codecs. I would like to convert these to AAC, but I'm having trouble doing this with FFmpeg. The command I'm running is:

ffmpeg -hwaccel auto -i original_file.mkv -y -c:v copy -c:a aac output_file.mkv

The command completes without error. However, the generated file has no audio when I play it. FFmpeg's output is as follows:

ffmpeg version 4.2.2-1ubuntu1 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-3ubuntu1)
  configuration: --prefix=/usr --extra-version=1ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Guessed Channel Layout for Input Stream #0.1 : 5.1
Input #0, matroska,webm, from 'input_file.mkv':
  Metadata:
    encoder         : libebml v1.3.5 + libmatroska v1.4.8
    creation_time   : 2018-05-10T10:21:30.000000Z
  Duration: 00:42:08.15, start: 0.000000, bitrate: 3201 kb/s
    Stream #0:0: Video: h264 (High), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Metadata:
      BPS-eng         : 2559028
      DURATION-eng    : 00:42:08.151000000
      NUMBER_OF_FRAMES-eng: 60615
      NUMBER_OF_BYTES-eng: 808701337
      _STATISTICS_WRITING_APP-eng: mkvmerge v21.0.0 ('Tardigrades Will Inherit The Earth') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-05-10 10:21:30
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:1(eng): Audio: eac3, 48000 Hz, 5.1, fltp (default)
    Metadata:
      BPS-eng         : 640000
      DURATION-eng    : 00:42:08.096000000
      NUMBER_OF_FRAMES-eng: 79003
      NUMBER_OF_BYTES-eng: 202247680
      _STATISTICS_WRITING_APP-eng: mkvmerge v21.0.0 ('Tardigrades Will Inherit The Earth') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-05-10 10:21:30
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:2(eng): Subtitle: subrip
    Metadata:
      BPS-eng         : 79
      DURATION-eng    : 00:41:15.299000000
      NUMBER_OF_FRAMES-eng: 802
      NUMBER_OF_BYTES-eng: 24598
      _STATISTICS_WRITING_APP-eng: mkvmerge v21.0.0 ('Tardigrades Will Inherit The Earth') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-05-10 10:21:30
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:3(eng): Subtitle: subrip
    Metadata:
      title           : SDH
      BPS-eng         : 82
      DURATION-eng    : 00:41:15.299000000
      NUMBER_OF_FRAMES-eng: 844
      NUMBER_OF_BYTES-eng: 25598
      _STATISTICS_WRITING_APP-eng: mkvmerge v21.0.0 ('Tardigrades Will Inherit The Earth') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-05-10 10:21:30
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (eac3 (native) -> aac (native))
  Stream #0:2 -> #0:2 (subrip (srt) -> ass (ssa))
Press [q] to stop, [?] for help
[aac @ 0x55d0572a1740] Using a PCE to encode channel layout "5.1(side)"
Output #0, matroska, to 'output_file.mkv':
  Metadata:
    encoder         : Lavf58.29.100
    Stream #0:0: Video: h264 (High) (H264 / 0x34363248), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 23.98 fps, 23.98 tbr, 1k tbn, 1k tbc (default)
    Metadata:
      BPS-eng         : 2559028
      DURATION-eng    : 00:42:08.151000000
      NUMBER_OF_FRAMES-eng: 60615
      NUMBER_OF_BYTES-eng: 808701337
      _STATISTICS_WRITING_APP-eng: mkvmerge v21.0.0 ('Tardigrades Will Inherit The Earth') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-05-10 10:21:30
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:1(eng): Audio: aac (LC) ([255][0][0][0] / 0x00FF), 48000 Hz, 5.1(side), fltp, 394 kb/s (default)
    Metadata:
      BPS-eng         : 640000
      DURATION-eng    : 00:42:08.096000000
      NUMBER_OF_FRAMES-eng: 79003
      NUMBER_OF_BYTES-eng: 202247680
      _STATISTICS_WRITING_APP-eng: mkvmerge v21.0.0 ('Tardigrades Will Inherit The Earth') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-05-10 10:21:30
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      encoder         : Lavc58.54.100 aac
    Stream #0:2(eng): Subtitle: ass (ssa)
    Metadata:
      BPS-eng         : 79
      DURATION-eng    : 00:41:15.299000000
      NUMBER_OF_FRAMES-eng: 802
      NUMBER_OF_BYTES-eng: 24598
      _STATISTICS_WRITING_APP-eng: mkvmerge v21.0.0 ('Tardigrades Will Inherit The Earth') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-05-10 10:21:30
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      encoder         : Lavc58.54.100 ssa 
video:789747kB audio:121419kB subtitle:41kB other streams:0kB global headers:1kB muxing overhead: 0.142563%
[aac @ 0x55d0572a1740] Qavg: 428.063

Any ideas what I'm doing wrong here? In case it helps an ffprobe -show_streams command run on the original file shows the following:

DL.DDP5.1.H.264-NTG.mkv
ffprobe version 4.2.2-1ubuntu1 Copyright (c) 2007-2019 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-3ubuntu1)
  configuration: --prefix=/usr --extra-version=1ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Input #0, matroska,webm, from 'input_file.mkv':
  Metadata:
    encoder         : libebml v1.3.5 + libmatroska v1.4.8
    creation_time   : 2018-05-10T10:21:30.000000Z
  Duration: 00:42:08.15, start: 0.000000, bitrate: 3201 kb/s
    Stream #0:0: Video: h264 (High), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Metadata:
      BPS-eng         : 2559028
      DURATION-eng    : 00:42:08.151000000
      NUMBER_OF_FRAMES-eng: 60615
      NUMBER_OF_BYTES-eng: 808701337
      _STATISTICS_WRITING_APP-eng: mkvmerge v21.0.0 ('Tardigrades Will Inherit The Earth') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-05-10 10:21:30
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:1(eng): Audio: eac3, 48000 Hz, 6 channels, fltp (default)
    Metadata:
      BPS-eng         : 640000
      DURATION-eng    : 00:42:08.096000000
      NUMBER_OF_FRAMES-eng: 79003
      NUMBER_OF_BYTES-eng: 202247680
      _STATISTICS_WRITING_APP-eng: mkvmerge v21.0.0 ('Tardigrades Will Inherit The Earth') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-05-10 10:21:30
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:2(eng): Subtitle: subrip
    Metadata:
      BPS-eng         : 79
      DURATION-eng    : 00:41:15.299000000
      NUMBER_OF_FRAMES-eng: 802
      NUMBER_OF_BYTES-eng: 24598
      _STATISTICS_WRITING_APP-eng: mkvmerge v21.0.0 ('Tardigrades Will Inherit The Earth') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-05-10 10:21:30
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:3(eng): Subtitle: subrip
    Metadata:
      title           : SDH
      BPS-eng         : 82
      DURATION-eng    : 00:41:15.299000000
      NUMBER_OF_FRAMES-eng: 844
      NUMBER_OF_BYTES-eng: 25598
      _STATISTICS_WRITING_APP-eng: mkvmerge v21.0.0 ('Tardigrades Will Inherit The Earth') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-05-10 10:21:30
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
[STREAM]
index=0
codec_name=h264
codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
profile=High
codec_type=video
codec_time_base=1001/48000
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
width=1280
height=720
coded_width=1280
coded_height=720
has_b_frames=2
sample_aspect_ratio=1:1
display_aspect_ratio=16:9
pix_fmt=yuv420p
level=31
color_range=tv
color_space=bt709
color_transfer=bt709
color_primaries=bt709
chroma_location=left
field_order=progressive
timecode=N/A
refs=1
is_avc=true
nal_length_size=4
id=N/A
r_frame_rate=24000/1001
avg_frame_rate=24000/1001
time_base=1/1000
start_pts=0
start_time=0.000000
duration_ts=N/A
duration=N/A
bit_rate=N/A
max_bit_rate=N/A
bits_per_raw_sample=8
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:BPS-eng=2559028
TAG:DURATION-eng=00:42:08.151000000
TAG:NUMBER_OF_FRAMES-eng=60615
TAG:NUMBER_OF_BYTES-eng=808701337
TAG:_STATISTICS_WRITING_APP-eng=mkvmerge v21.0.0 ('Tardigrades Will Inherit The Earth') 64-bit
TAG:_STATISTICS_WRITING_DATE_UTC-eng=2018-05-10 10:21:30
TAG:_STATISTICS_TAGS-eng=BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
[/STREAM]
[STREAM]
index=1
codec_name=eac3
codec_long_name=ATSC A/52B (AC-3, E-AC-3)
profile=unknown
codec_type=audio
codec_time_base=1/48000
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
sample_fmt=fltp
sample_rate=48000
channels=6
channel_layout=unknown
bits_per_sample=0
dmix_mode=-1
ltrt_cmixlev=-1.000000
ltrt_surmixlev=-1.000000
loro_cmixlev=-1.000000
loro_surmixlev=-1.000000
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/1000
start_pts=0
start_time=0.000000
duration_ts=N/A
duration=N/A
bit_rate=N/A
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:language=eng
TAG:BPS-eng=640000
TAG:DURATION-eng=00:42:08.096000000
TAG:NUMBER_OF_FRAMES-eng=79003
TAG:NUMBER_OF_BYTES-eng=202247680
TAG:_STATISTICS_WRITING_APP-eng=mkvmerge v21.0.0 ('Tardigrades Will Inherit The Earth') 64-bit
TAG:_STATISTICS_WRITING_DATE_UTC-eng=2018-05-10 10:21:30
TAG:_STATISTICS_TAGS-eng=BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
[/STREAM]
[STREAM]
index=2
codec_name=subrip
codec_long_name=SubRip subtitle
profile=unknown
codec_type=subtitle
codec_time_base=0/1
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
width=N/A
height=N/A
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/1000
start_pts=0
start_time=0.000000
duration_ts=2528151
duration=2528.151000
bit_rate=N/A
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:language=eng
TAG:BPS-eng=79
TAG:DURATION-eng=00:41:15.299000000
TAG:NUMBER_OF_FRAMES-eng=802
TAG:NUMBER_OF_BYTES-eng=24598
TAG:_STATISTICS_WRITING_APP-eng=mkvmerge v21.0.0 ('Tardigrades Will Inherit The Earth') 64-bit
TAG:_STATISTICS_WRITING_DATE_UTC-eng=2018-05-10 10:21:30
TAG:_STATISTICS_TAGS-eng=BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
[/STREAM]
[STREAM]
index=3
codec_name=subrip
codec_long_name=SubRip subtitle
profile=unknown
codec_type=subtitle
codec_time_base=0/1
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
width=N/A
height=N/A
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/1000
start_pts=0
start_time=0.000000
duration_ts=2528151
duration=2528.151000
bit_rate=N/A
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:language=eng
TAG:title=SDH
TAG:BPS-eng=82
TAG:DURATION-eng=00:41:15.299000000
TAG:NUMBER_OF_FRAMES-eng=844
TAG:NUMBER_OF_BYTES-eng=25598
TAG:_STATISTICS_WRITING_APP-eng=mkvmerge v21.0.0 ('Tardigrades Will Inherit The Earth') 64-bit
TAG:_STATISTICS_WRITING_DATE_UTC-eng=2018-05-10 10:21:30
TAG:_STATISTICS_TAGS-eng=BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
[/STREAM]

1
What player/device are you trying? Are you sure your player supports 5.1 AAC audio? You can test stereo output with ffmpeg -i original_file.mkv -c copy -c:a aac -ac 2 -t 60 output_file_test.mkvllogan
I'm testing the files out in VLC and MPV, and getting the same results in each. I've never had a problem playing AAC encoded files in either player before. The whole reason for wanting to convert is that EAC3 and DTS aren't supported by the media player on my NAS, so I'm trying to convert these files before migrating them.nxl4

1 Answers

1
votes

Convert the file using Avidemux

  1. Download and install Avidemux.
  2. Open the tool and then go to File and load the video file you wanted to convert.
  3. Choose “Copy” option from the drop-down menu which can be found under “Video Output” menu on the left hand side.
  4. Next, choose AC-3 (lav) under the “Audio Output” menu.
  5. Next, choose either MKV muxer or AVI muxer or MP4 muxer (depends on whether your video file was in MKV, AVI or MP4) under the “Output format”.
  6. Under "File" Click “Save” button. Save to a folder of your choice.

That’s it! Your audio will now be converted to your TV supported audio format and your video files will play without any issues.

P.S: The Encoding time depends on your PC configuration (available free RAM memory and processor speed). And don’t worry about the video quality. Since, we’re encoding only the audio, the video quality will remain the same.