Answers.Body: <p>Rather old question, but responding FBO whomever stumbles upon this in the future (besides me; lol)....</p>
  <p>Your issue was the fact you set total average bit rate to 192kbps, not per channel. Presuming ffmpeg's default AC-3 encoder, if you simply set the sample rate to 48kbps (which you did in your example above), you'd be encoding at 1,536kbps for all channels. That is because the only bit depth that codec supports is 32 bits per sample.</p>
  <p>32 bit depth x 48,000 sampling frequency = 1,536,000 bits per second</p>
  <p>If you had simply omitted this portion of your command line you should have gotten that bit rate:</p>
  <pre><code>-b:a 192k
  </code></pre>
  <p>That is because what you did there was limit the average bit rate to 192kbps, which is why you ended up with poor quality sound in your target file. At 6 channels (5+1), you're looking at 32 kbps per channel (192 / 6 = 32).</p>
  <p>To attain your goal of 192 kbps per channel, you should have limited the output to 6 x 192 or 1,152 kbps, like this:</p>
  <pre><code>-b:a 1152k
  </code></pre>
  <p>Cheers. :-)</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-09-13T01:00:00.747Z
Answers.LastActivityDate: 2021-09-13T01:00:00.747Z
Answers.UserDisplayName: MrPotatoHead
Body: <p>I have PCM Wave source files that are 5.1 surround. My goal is to convert this to EAC3 at 192k per Apple recommendations.</p>
  
  <p>Here is the MediaInfo of my source media:</p>
  
  <pre><code>General
  Complete name                            : X:\******WAVE\5.1_PCM.wav
  Format                                   : Wave
  File size                                : 2.38 GiB
  Duration                                 : 49 min 3 s
  Overall bit rate mode                    : Constant
  Overall bit rate                         : 6 949 kb/s
  Producer                                 : Pro Tools
  Encoded date                             : 2019-03-00 17:03:25
  Producer_Reference                       : 15uZdJ9Ng2naaaGk
  
  Audio
  Format                                   : PCM
  Format settings                          : Little / Signed
  Codec ID                                 : 00000001-0000-0010-8000-00AA00389B71
  Duration                                 : 49 min 3 s
  Bit rate mode                            : Constant
  Bit rate                                 : 6 912 kb/s
  Channel(s)                               : 6 channels
  Channel layout                           : L R C LFE Lb Rb
  Sampling rate                            : 48.0 kHz
  Bit depth                                : 24 bits
  Stream size                              : 2.37 GiB (99%)
  </code></pre>
  
  <p>I'm encoding this with ffmpeg by using very simply:</p>
  
  <pre><code>ffmpeg -i IN.wav -c:a eac3 -b:a 192k -ar 48k OUT.mp4
  </code></pre>
  
  <p>Here is the MediaInfo of the output:</p>
  
  <pre><code>General
  Complete name                            : X:\******\6ch_eac3.mp4
  Format                                   : MPEG-4
  Format profile                           : Base Media
  Codec ID                                 : isom (isom/iso2/mp41)
  File size                                : 67.4 MiB
  Duration                                 : 49 min 3 s
  Overall bit rate mode                    : Constant
  Overall bit rate                         : 192 kb/s
  Recorded date                            : 2019-03-0
  Writing application                      : Lavf58.20.100
  
  Audio
  ID                                       : 1
  Format                                   : E-AC-3
  Format/Info                              : Enhanced AC-3
  Commercial name                          : Dolby Digital Plus
  Codec ID                                 : ec-3
  Duration                                 : 49 min 3 s
  Bit rate mode                            : Constant
  Bit rate                                 : 192 kb/s
  Channel(s)                               : 6 channels
  Channel layout                           : L R C LFE Ls Rs
  Sampling rate                            : 48.0 kHz
  Frame rate                               : 31.250 FPS (1536 SPF)
  Bit depth                                : 16 bits
  Compression mode                         : Lossy
  Stream size                              : 67.4 MiB (100%)
  Service kind                             : Complete Main
  Default                                  : Yes
  Alternate group                          : 1
  </code></pre>
  
  <p>The thing is the output quality is really bad. It sounds extremely compressed, judging by my ear it sounds like about 32kbps.
  My theory is that the output is for some reason 192k divided by 6 channels, each channel being 32kbps and the whole audio track is 192k overall. To my knowledge, that's not how its supposed to work and it should sound like the equivalent of 192k for each channel in one bitstream.</p>
  
  <p>I also encoded the same source file using Telestream Vantage, here is the MediaInfo which is extremely similar to the ffmpeg output above:</p>
  
  <pre><code>General
  Complete name                            : X:\******\WAVE\Internet_192k_6ch_telestream.mp4
  Format                                   : MPEG-4
  Format profile                           : Base Media / Version 2
  Codec ID                                 : mp42 (mp42/isom)
  File size                                : 69.0 MiB
  Duration                                 : 49 min 3 s
  Overall bit rate mode                    : Constant
  Overall bit rate                         : 197 kb/s
  Encoded date                             : UTC 2019-08-01 15:30:58
  Tagged date                              : UTC 2019-08-01 15:30:58
  
  Audio
  ID                                       : 1
  Format                                   : E-AC-3
  Format/Info                              : Enhanced AC-3
  Commercial name                          : Dolby Digital Plus
  Codec ID                                 : ec-3
  Duration                                 : 49 min 3 s
  Source duration                          : 49 min 3 s
  Bit rate mode                            : Constant
  Bit rate                                 : 192 kb/s
  Channel(s)                               : 6 channels
  Channel layout                           : L R C LFE Ls Rs
  Sampling rate                            : 48.0 kHz
  Frame rate                               : 31.250 FPS (1536 SPF)
  Bit depth                                : 16 bits
  Compression mode                         : Lossy
  Stream size                              : 67.4 MiB (98%)
  Source stream size                       : 67.4 MiB (98%)
  Service kind                             : Complete Main
  Encoded date                             : UTC 2019-08-01 15:30:58
  Tagged date                              : UTC 2019-08-01 15:30:58
  </code></pre>
  
  <p>This file sounds fantastic, like true 192k with about the same filesize as the ffmpeg encode.</p>
  
  <p>So clearly I am doing something wrong with mapping or bitstream or something.</p>
  
  <p>Here is the full ffmpeg log:</p>
  
  <pre><code>N:\_TOOLS\ffmpeg\ffmpeg-4.1.3-win64-static\bin&gt;ffmpeg -i X:\02_BROADCAST\5.1_PCM
  .wav -c:a eac3 -b:a 192k -ar 48k X:\02_BROADCAST\6ch_eac3.mp4
  ffmpeg version 4.1.3 Copyright (c) 2000-2019 the FFmpeg developers
    built with gcc 8.3.1 (GCC) 20190414
    configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfi
  g --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-lib
  freetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amr
  wb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --
  enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-l
  ibwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --
  enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --en
  able-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --en
  able-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --e
  nable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enab
  le-avisynth
    libavutil      56. 22.100 / 56. 22.100
    libavcodec     58. 35.100 / 58. 35.100
    libavformat    58. 20.100 / 58. 20.100
    libavdevice    58.  5.100 / 58.  5.100
    libavfilter     7. 40.101 /  7. 40.101
    libswscale      5.  3.100 /  5.  3.100
    libswresample   3.  3.100 /  3.  3.100
    libpostproc    55.  3.100 / 55.  3.100
  Input #0, wav, from 'X:\02_BROADCAST\5.1_PCM.wav':
    Metadata:
      encoded_by      : Pro Tools
      originator_reference: 15uZdJ9Ng2naaaGk
      date            : 2019-03-0
      creation_time   : 17:03:25
      time_reference  : 172828656
    Duration: 00:49:03.23, bitrate: 6948 kb/s
      Stream #0:0: Audio: pcm_s24le ([1][0][0][0] / 0x0001), 48000 Hz, 5.1, s32 (2
  4 bit), 6912 kb/s
  Stream mapping:
    Stream #0:0 -&gt; #0:0 (pcm_s24le (native) -&gt; eac3 (native))
  Press [q] to stop, [?] for help
  Output #0, mp4, to 'X:\02_BROADCAST\6ch_eac3.mp4':
    Metadata:
      encoded_by      : Pro Tools
      originator_reference: 15uZdJ9Ng2naaaGk
      date            : 2019-03-0
      time_reference  : 172828656
      encoder         : Lavf58.20.100
      Stream #0:0: Audio: eac3 (ec-3 / 0x332D6365), 48000 Hz, 5.1, fltp (24 bit),
  192 kb/s
      Metadata:
        encoder         : Lavc58.35.100 eac3
  size=   68983kB time=00:49:03.22 bitrate= 192.0kbits/s speed=73.3x
  video:0kB audio:68982kB subtitle:0kB other streams:0kB global headers:0kB muxing
   overhead: 0.001441%
  
  N:\_TOOLS\ffmpeg\ffmpeg-4.1.3-win64-static\bin&gt;
  </code></pre>
  
  <p>Anyone know what I am running into?</p>
  
  <p>As a note this is concerned with video production because this EAC3 is going into a DASH wrapper with video immediately after this encode.</p>
  
  <p>Edit: Something I just realized on this and tested is that the audio quality that I hear when using ffmpeg to encode to ac3 and then to encode to eac3 is the same. But as eac3 is almost twice as efficient as ac3, I would expect the eac3 encode to be much higher quality and sound less compressed. Case in point is that the Telestream Vantage encode is much higher quality than an ac3 at the same bitrate. Is this a fault of of the ffmpeg encoder that is used for eac3?</p>
  
Tags: <ffmpeg><audio><audio-quality><quality>
Title: FFMPEG - 5.1 EAC3 encode output quality
UserDisplayName: Naqros
ThreadText: # FFMPEG - 5.1 EAC3 encode output quality
  
  (Asked by: username_0 on 2019-08-02)
  
  I have PCM Wave source files that are 5.1 surround. My goal is to convert this to EAC3 at 192k per Apple recommendations.
  
  Here is the MediaInfo of my source media:
  
  ```
  General
  Complete name                            : X:\******WAVE\5.1_PCM.wav
  Format                                   : Wave
  File size                                : 2.38 GiB
  Duration                                 : 49 min 3 s
  Overall bit rate mode                    : Constant
  Overall bit rate                         : 6 949 kb/s
  Producer                                 : Pro Tools
  Encoded date                             : 2019-03-00 17:03:25
  Producer_Reference                       : 15uZdJ9Ng2naaaGk
  
  Audio
  Format                                   : PCM
  Format settings                          : Little / Signed
  Codec ID                                 : 00000001-0000-0010-8000-00AA00389B71
  Duration                                 : 49 min 3 s
  Bit rate mode                            : Constant
  Bit rate                                 : 6 912 kb/s
  Channel(s)                               : 6 channels
  Channel layout                           : L R C LFE Lb Rb
  Sampling rate                            : 48.0 kHz
  Bit depth                                : 24 bits
  Stream size                              : 2.37 GiB (99%)
  
  ```
  
  I'm encoding this with ffmpeg by using very simply:
  
  ```
  ffmpeg -i IN.wav -c:a eac3 -b:a 192k -ar 48k OUT.mp4
  
  ```
  
  Here is the MediaInfo of the output:
  
  ```
  General
  Complete name                            : X:\******\6ch_eac3.mp4
  Format                                   : MPEG-4
  Format profile                           : Base Media
  Codec ID                                 : isom (isom/iso2/mp41)
  File size                                : 67.4 MiB
  Duration                                 : 49 min 3 s
  Overall bit rate mode                    : Constant
  Overall bit rate                         : 192 kb/s
  Recorded date                            : 2019-03-0
  Writing application                      : Lavf58.20.100
  
  Audio
  ID                                       : 1
  Format                                   : E-AC-3
  Format/Info                              : Enhanced AC-3
  Commercial name                          : Dolby Digital Plus
  Codec ID                                 : ec-3
  Duration                                 : 49 min 3 s
  Bit rate mode                            : Constant
  Bit rate                                 : 192 kb/s
  Channel(s)                               : 6 channels
  Channel layout                           : L R C LFE Ls Rs
  Sampling rate                            : 48.0 kHz
  Frame rate                               : 31.250 FPS (1536 SPF)
  Bit depth                                : 16 bits
  Compression mode                         : Lossy
  Stream size                              : 67.4 MiB (100%)
  Service kind                             : Complete Main
  Default                                  : Yes
  Alternate group                          : 1
  
  ```
  
  The thing is the output quality is really bad. It sounds extremely compressed, judging by my ear it sounds like about 32kbps.
  My theory is that the output is for some reason 192k divided by 6 channels, each channel being 32kbps and the whole audio track is 192k overall. To my knowledge, that's not how its supposed to work and it should sound like the equivalent of 192k for each channel in one bitstream.
  
  I also encoded the same source file using Telestream Vantage, here is the MediaInfo which is extremely similar to the ffmpeg output above:
  
  ```
  General
  Complete name                            : X:\******\WAVE\Internet_192k_6ch_telestream.mp4
  Format                                   : MPEG-4
  Format profile                           : Base Media / Version 2
  Codec ID                                 : mp42 (mp42/isom)
  File size                                : 69.0 MiB
  Duration                                 : 49 min 3 s
  Overall bit rate mode                    : Constant
  Overall bit rate                         : 197 kb/s
  Encoded date                             : UTC 2019-08-01 15:30:58
  Tagged date                              : UTC 2019-08-01 15:30:58
  
  Audio
  ID                                       : 1
  Format                                   : E-AC-3
  Format/Info                              : Enhanced AC-3
  Commercial name                          : Dolby Digital Plus
  Codec ID                                 : ec-3
  Duration                                 : 49 min 3 s
  Source duration                          : 49 min 3 s
  Bit rate mode                            : Constant
  Bit rate                                 : 192 kb/s
  Channel(s)                               : 6 channels
  Channel layout                           : L R C LFE Ls Rs
  Sampling rate                            : 48.0 kHz
  Frame rate                               : 31.250 FPS (1536 SPF)
  Bit depth                                : 16 bits
  Compression mode                         : Lossy
  Stream size                              : 67.4 MiB (98%)
  Source stream size                       : 67.4 MiB (98%)
  Service kind                             : Complete Main
  Encoded date                             : UTC 2019-08-01 15:30:58
  Tagged date                              : UTC 2019-08-01 15:30:58
  
  ```
  
  This file sounds fantastic, like true 192k with about the same filesize as the ffmpeg encode.
  
  So clearly I am doing something wrong with mapping or bitstream or something.
  
  Here is the full ffmpeg log:
  
  ```
  N:\_TOOLS\ffmpeg\ffmpeg-4.1.3-win64-static\bin>ffmpeg -i X:\02_BROADCAST\5.1_PCM
  .wav -c:a eac3 -b:a 192k -ar 48k X:\02_BROADCAST\6ch_eac3.mp4
  ffmpeg version 4.1.3 Copyright (c) 2000-2019 the FFmpeg developers
    built with gcc 8.3.1 (GCC) 20190414
    configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfi
  g --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-lib
  freetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amr
  wb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --
  enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-l
  ibwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --
  enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --en
  able-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --en
  able-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --e
  nable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enab
  le-avisynth
    libavutil      56. 22.100 / 56. 22.100
    libavcodec     58. 35.100 / 58. 35.100
    libavformat    58. 20.100 / 58. 20.100
    libavdevice    58.  5.100 / 58.  5.100
    libavfilter     7. 40.101 /  7. 40.101
    libswscale      5.  3.100 /  5.  3.100
    libswresample   3.  3.100 /  3.  3.100
    libpostproc    55.  3.100 / 55.  3.100
  Input #0, wav, from 'X:\02_BROADCAST\5.1_PCM.wav':
    Metadata:
      encoded_by      : Pro Tools
      originator_reference: 15uZdJ9Ng2naaaGk
      date            : 2019-03-0
      creation_time   : 17:03:25
      time_reference  : 172828656
    Duration: 00:49:03.23, bitrate: 6948 kb/s
      Stream #0:0: Audio: pcm_s24le ([1][0][0][0] / 0x0001), 48000 Hz, 5.1, s32 (2
  4 bit), 6912 kb/s
  Stream mapping:
    Stream #0:0 -> #0:0 (pcm_s24le (native) -> eac3 (native))
  Press [q] to stop, [?] for help
  Output #0, mp4, to 'X:\02_BROADCAST\6ch_eac3.mp4':
    Metadata:
      encoded_by      : Pro Tools
      originator_reference: 15uZdJ9Ng2naaaGk
      date            : 2019-03-0
      time_reference  : 172828656
      encoder         : Lavf58.20.100
      Stream #0:0: Audio: eac3 (ec-3 / 0x332D6365), 48000 Hz, 5.1, fltp (24 bit),
  192 kb/s
      Metadata:
        encoder         : Lavc58.35.100 eac3
  size=   68983kB time=00:49:03.22 bitrate= 192.0kbits/s speed=73.3x
  video:0kB audio:68982kB subtitle:0kB other streams:0kB global headers:0kB muxing
   overhead: 0.001441%
  
  N:\_TOOLS\ffmpeg\ffmpeg-4.1.3-win64-static\bin>
  
  ```
  
  Anyone know what I am running into?
  
  As a note this is concerned with video production because this EAC3 is going into a DASH wrapper with video immediately after this encode.
  
  Edit: Something I just realized on this and tested is that the audio quality that I hear when using ffmpeg to encode to ac3 and then to encode to eac3 is the same. But as eac3 is almost twice as efficient as ac3, I would expect the eac3 encode to be much higher quality and sound less compressed. Case in point is that the Telestream Vantage encode is much higher quality than an ac3 at the same bitrate. Is this a fault of of the ffmpeg encoder that is used for eac3?
  
  **Tags:** ffmpeg, audio, audio-quality, quality
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-09-13. Score: 0
  
  Rather old question, but responding FBO whomever stumbles upon this in the future (besides me; lol)....
  
  Your issue was the fact you set total average bit rate to 192kbps, not per channel. Presuming ffmpeg's default AC-3 encoder, if you simply set the sample rate to 48kbps (which you did in your example above), you'd be encoding at 1,536kbps for all channels. That is because the only bit depth that codec supports is 32 bits per sample.
  
  32 bit depth x 48,000 sampling frequency = 1,536,000 bits per second
  
  If you had simply omitted this portion of your command line you should have gotten that bit rate:
  
  ```
  -b:a 192k
  
  ```
  
  That is because what you did there was limit the average bit rate to 192kbps, which is why you ended up with poor quality sound in your target file. At 6 channels (5+1), you're looking at 32 kbps per channel (192 / 6 = 32).
  
  To attain your goal of 192 kbps per channel, you should have limited the output to 6 x 192 or 1,152 kbps, like this:
  
  ```
  -b:a 1152k
  
  ```
  
  Cheers. :-)
  
  
  ---
  
  