Striking volume fluctuation/pulsing artifacts when converting TrueHD 7.1 to EAC3 7.1

Plex Transcoder’s transcoding of TrueHD 7.1 to EAC3 7.1 causes some horrible volume fluctuations or pulses in certain loud-volume instances. I actually think it’s an EasyAudioEncoder issue, but I’ll explain.

I suspect this post was trying to get at the same issue.

First, here are the transcoder’s FFmpeg options/arguments that produce the issue. These options are executed by Plex’s Transcoder during any TrueHD 7.1 to EAC3 7.1 transcode:

'-codec:0' 'hevc'
'-codec:2' 'truehd_eae'
'-noaccurate_seek'
'-analyzeduration' '20000000'
'-probesize' '20000000'
'-i' '/path/to/input/file.mkv'
'-map' '0:0'
'-codec:0' 'copy'
'-filter_complex' '[0:a:0] aresample=async=1:ocl='\''7.1''\'':rematrix_maxval=60.000000dB:osr=48000[0]' \
'-map' '[0]' \
'-metadata:s:1' 'language=eng'
'-codec:1' 'eac3_eae'
'-b:1' '1280k'
'-segment_format' 'mpegts'
'-f' 'ssegment'
'-individual_header_trailer' '0'
'-segment_time' '10'
'-segment_start_number' '0'
'-segment_copyts' '1'
'-segment_time_delta' '0.0625'
'-segment_list' 'http://127.0.0.1:32400/video/:/transcode/session/osd3f39f8dsjq2b3df9i4jim/3a827eec-46a5-4f9b-bf41-7e19374d9a61/manifest?X-Plex-Http-Pipeline=infinite'
'-segment_list_type' 'csv'
'-segment_list_size' '5'
'-segment_list_separate_stream_times' '1'
'-segment_list_unfinished' '1'
'-max_delay' '5000000'
'-avoid_negative_ts' 'disabled'
'-map_metadata' '-1'
'-map_chapters' '-1'
'media-%05d.ts'
'-start_at_zero'
'-copyts'
'-vsync' 'cfr'
'-y'
'-nostats'
'-loglevel' 'quiet'
'-loglevel_plex' 'error'
'-progressurl' 'http://127.0.0.1:32400/video/:/transcode/session/osd3f39f8dsjq2b3df9i4jim/3a827eec-46a5-4f9b-bf41-7e19374d9a61/progress'

I tried to pinpoint if it was the transcoder’s fault, or maybe an option/argument out of place, so I pointed Plex Transcoder & EasyAudioEncoder at the file locally and attempted to remove certain FFmpeg options from the command to see which was the culprit. For more info on doing this locally, see here. I suspected it was the complex filter, as hinted at in the post I linked above.

Putting together my own set of options based on Plex’s, it successfully converts to EAC3 7.1 from TrueHD 7.1, yet still causes the awful volume normalization/fluctuations (it produces the same results as the previous command):

	'-c:v:0' 'hevc' \
	'-c:a:0' 'truehd_eae' \
	'-noaccurate_seek' \
	'-analyzeduration' '20000000' \
	'-probesize' '20000000' \
	'-i' '/path/to/input/file.mkv' \
	'-map' '0:v:0' \
	'-c:v:0' 'copy' \
	'-map' '0:a:0' \
	'-c:a:0' 'copy' \
	'-map' '0:a:0' \
	'-metadata:s:a:1' 'title=EAC3 7.1 from TrueHD' \
	'-metadata:s:a:1' 'language=eng' \
	'-c:a:1' 'eac3_eae' \
	'-b:a:1' '1280k' \
	'-c:s' 'copy' \
	'-start_at_zero' \
	'-copyts' \
	'-vsync' 'cfr' \
	'-avoid_negative_ts' 'disabled' \
	'/path/to/output/file.mkv'

Even when taking out the complex filter, it was still normalizing or limiting the volume harshly in certain loud sections. In a last attempt, I took out various stability/sync options, still with no luck (EAC3 7.1 created successfully, but the volume issue persists):

	'-c:v:0' 'hevc' \
	'-c:a:0' 'truehd_eae' \
	'-i' '/path/to/input/file.mkv' \
	'-map' '0:v:0' \
	'-c:v:0' 'copy' \
	'-map' '0:a:0' \
	'-c:a:0' 'copy' \
	'-map' '0:a:0' \
	'-metadata:s:a:1' 'title=EAC3 7.1 from TrueHD' \
	'-metadata:s:a:1' 'language=eng' \
	'-c:a:1' 'eac3_eae' \
	'-b:a:1' '1280k' \
	'/path/to/output/file.mkv'

I’ve also tried upping the bitrate to 5000kbps (don’t think this matters as EasyAudioEncoder seems to only encode DD+ to max 1024kbps), and removing the metadata options, with no luck.

Furthermore, I used the following non-Plex Transcoder/EasyAudioEncoder FFmpeg options to create an EAC3 5.1 track with great results (no audio fluctuations/pulses/limiting/normalization):

	-c:v:0 hevc \
	-c:a:0 truehd \
	-i /path/to/input/file.mkv \
	-map 0:v:0 \
	-c:v:0 copy \
	-map 0:a:0 \
	-c:a:0 copy \
	-map 0:a:0 \
	-metadata:s:a:1 title='EAC3 640kbps' \
	-metadata:s:a:1 language=eng \
	-c:a:1 eac3 \
	-b:a:1 640k \
	/path/to/output/file.mkv

Sample

Here is the sample file.

  • Audio track 1: Original TrueHD 7.1 at track 1 to show what the audio should sound like.
  • Audio track 2: The offending EAC3 7.1 at track 2 shows the affect Plex’s Transcoder+EasyAudioEncoder has on the audio (pulsation/fluctuation).
  • Audio track 3: The EAC3 5.1 created by FFmpeg at track 3 shows a working 5.1 non-EasyAudioEncoder decode/encode result.

First thing you’ll notice is a difference in overall volume. The EAC3 7.1 track is significantly quieter (seems there’s some limiting going on). Second, if you turn it up a little to compensate for the limiting, listen for the strange fluctuations/pulses in volume in the EAC3 7.1 at track 2 compared to the TrueHD 7.1 at track 1 and EAC3 5.1 at track 3 (no pulses).

Granted, this sample is loud, but I analyzed the TrueHD audio using level meters and it looks like it was engineered to hit peak (0.0db) without clipping (as any professionally-created audio would be), so I’m not sure why EasyAudioEncoder/Plex Transcoder thinks it’s clipping and needs to normalize/limit it.

My Conclusions

After stripping the Transcoder’s FFmpeg options down only to what was necessary, I can only assume there’s some issue in the actual audio decoding or encoding. In this case that’s EasyAudioEncoder for both decode and encode (truehd_eae to eac3_eae). Maybe it’s a bitrate issue, where EasyAudioEncoder outputs a comparatively low rate to the TrueHD source.

Or, EasyAudioEncoder has a built-in limiter with a threshold set to below 0.0db (or even lower), causing any audio that reaches the threshold to be limited and crushed, which causes the fluctuations/pulses. It happens a lot in the music industry, as well (limiting & side-chaining, and how it crushes audio dynamics at high volumes, see here for more info).

Or, something else I’m not thinking of.

Does Plex develop and updated EasyAudioEncoder? Or is it provided to Plex by another developer that could field these kinds of questions?

Tagging @alshain and @OttoKerner to see if they ever found a solution for this. Also @anon18523487 @sa2000 because you contributed to posts I’ve scoured relating to TrueHD/EAC3 7.1/EasyAudioEncoder issues. Any help would be greatly appreciated!

Server Version#: 1.24.0.4930

3 Likes

Unfortunately, I’ve never found a solution. I hope this issue will gain some more attention.

1 Like

I went over to the doom9 forums to ask about this issue because they’re extremely knowledgeable and transparent about video and audio codec topics, and I got some great responses. Check out this post, and the posts following.

In short “The problem is the DRC data included in the EAC3 stream, the 3 tracks in your MKV play at same level if the player don’t apply the Dynamic Range Compression.”, and “Then the problem in the PLEX forum is solved configuring the player to don’t apply DRC (like is always recommended, use ‘Night mode’ or similar in the AVR)”. Also, “Seems EasyAudioEncoder create DRC metadata in eac3 stream with undesired results.
But the problem can be override instructing the player to don’t apply DRC to AC3/EAC3 (the only than have these normally, DTS can have also but don’t use it).”

I believe the crux of the issue is that EasyAudioEncoder is applying some heavy-handed and undesirable DRC metedata to the stream, which causes these audible flutters.

1 Like

It would be nice to get some kind of official feedback on this. Is this even on the radar?

1 Like

I doubt it. I believe this has to do with EasyAudioEncoder and the way it processes the input, and I don’t think Plex develops EasyAudioEncoder. I’m not sure if they provide feedback to the group that does develop it, either.

EasyAudioEncoder uses MainConcept’s Dolby Digital Plus Pro SDK, statically compiled. I’m not sure if Plex itself compiles it.

I don’t know what can be done given the EAE is given to us under license to use AS-IS.

Can anyone provide me a sample & steps-to-reproduce/line item synopsis (of sorts) so Engineering understands exactly where the issue is and then take back to get resolved ?

1 Like

As in the first post, sample.

  • Audio track 1: Original TrueHD 7.1 at track 1 to show what the audio should sound like.
  • Audio track 2: The offending EAC3 7.1 at track 2 shows the affect Plex’s Transcoder and EasyAudioEncoder has on the audio (pulsation/fluctuation).
  • Audio track 3: The EAC3 5.1 created by FFmpeg at track 3 shows a working 5.1 non-EasyAudioEncoder decode/encode result.

I’m not sure how I can provide a step-by-step guide to how I arrived at this issue. I played the movie, and this is what was created by Plex’s transcoder using EAE. I’m playing the sample file on my computer when I get these issues.

Here’s some more info given to me by a user on the doom9 forums (here):

I believe EAE creates DRC metadata in the eac3 stream with undesired results. The 3 tracks in the sample play at same level with no weird fluctuation if the player doesn’t apply the Dynamic Range Compression.

File: C:\tmp\Bsid12.eac3
Size: 1302528 bytes
----------------------------------------- First Frame Info
StrmTyp .....................: 0 (0=Ind, 1=Dep, 2=AC3)
SubStreamID .................: 0 
FrameSize....................: 2292 bytes (573 Kb/s)
SampleRate ..................: 0 (48000 Hz)
NumBlksCod ..................: 3 (6 Blocks)
Audio coding mode (acmod) ...: 7 (3/2 - L, C, R, SL, SR)
Low frequency effects channel: 1 (Present)
Version (bsid) ..............: 12 (Other sintax)
Dialogue normalization ......: -31 dB
Dynamic Range gain ..........: -0.27 dB
Mixing metadata .............: 0 (Not exist)
Informational metadata ......: 0 (Not exist)
Additional Bsi ..............: 0 (Not exist)
----------------------------------------- Revised EAC3 Info
Dyn. Range min/max : -18.06/3.34 dB
Frames Tot/Ind/AC3.: 636 / 318 / 0
Bitrate average... : 1024 Kb/s
Duration ..........: 10176 ms (0 h. 0 m. 10.176 s.)
------------------------------------------------- End Info

The DRC force-attenuates the volume between -18 dB and 3 dB. The sample has high-volume with no clips. Maybe the particular part of the sample goes above 3.34 dB with no clipping, causing the gross limiting by EAE. Also, the bitrate is locked at 1024 kb/s no matter what plex transcoder is fed when trying to encode manually (though I don’t think this is part of the issue. Could be). Also, the bsid of 12 is strange to some, causing some programs like mkvtoolnix and mkvmerge to not recognize the 2nd audio track. The well know values are: 8 for Standard Syntax, 6 for Alternate Syntax and 16 for Enhanced Syntax.

1 Like

Talked to the transcoder team.

It’s agreed – DRC doesn’t seem right.

Would it be possible to get sample files which show the scope of this?
i.e. Which source codecs have the problem ?

I will be writing this up.

3 Likes

All I have is that sample I sent in my original post. Here’s what MediaInfo shows me for the sample:

General
Format                                   : Matroska
Format version                           : Version 4 / Version 2
Duration                                 : 10 s 193 ms
Overall bit rate mode                    : Variable
Overall bit rate                         : 20.3 Mb/s
Writing application                      : Lavf58.27.104
Writing library                          : Lavf58.27.104 / Lavf58.27.104
ErrorDetectionType                       : Per level 1

Video
ID                                       : 1
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Main 10@L5.1@High
Codec ID                                 : V_MPEGH/ISO/HEVC
Width                                    : 3 840 pixels
Height                                   : 1 600 pixels
Display aspect ratio                     : 2.40:1
Frame rate mode                          : Variable
Original frame rate                      : 23.976 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0 (Type 2)
Bit depth                                : 10 bits
Language                                 : English
Default                                  : Yes
Forced                                   : No
Color range                              : Limited
Color primaries                          : BT.2020
Transfer characteristics                 : SMPTE ST 2084
Matrix coefficients                      : BT.2020 non-constant
FromStats_BitRate                        : 11928097
FromStats_Duration                       : 00:00:10.181000000
FromStats_FrameCount                     : 244
FromStats_StreamSize                     : 15174031
Mastering display color primaries        : R: x=0.680000 y=0.320000, G: x=0.265000 y=0.690000, B: x=0.150000 y=0.060000, White point: x=0.312700 y=0.329000
Mastering display luminance              : min: 0.0050 cd/m2, max: 4000.0000 cd/m2
Maximum Content Light Level              : 457 cd/m2
Maximum Frame-Average Light Level        : 179 cd/m2

Audio #1
ID                                       : 2
Format                                   : Atmos / TrueHD
Codec ID                                 : A_TRUEHD
Bit rate mode                            : Variable
Maximum bit rate                         : 8 316 kb/s
Channel(s)                               : Object Based / 8 channels
Channel positions                        : Object Based / Front: L C R, Side: L R, Back: L R, LFE
Sampling rate                            :  / 48.0 kHz
Frame rate                               : 1 200.000 FPS (40 spf)
Bit depth                                : 24 bits
Compression mode                         : Lossless
Delay relative to video                  : 5 ms
Title                                    : TrueHD 7.1
Language                                 : English
Default                                  : Yes
Forced                                   : No
FromStats_BitRate                        : 6704260
FromStats_Duration                       : 00:00:10.182000000
FromStats_FrameCount                     : 12213
FromStats_StreamSize                     : 8529496

Audio #2
ID                                       : 3
Format                                   : E-AC-3
Format/Info                              : Enhanced Audio Coding 3
Format settings, Endianness              : Big
Codec ID                                 : A_EAC3
Duration                                 : 10 s 193 ms
Bit rate mode                            : Constant
Bit rate                                 : 1 024 kb/s / 573 kb/s
Channel(s)                               : 8 channels / 6 channels
Channel positions                        : Front: L C R, Side: L R, Back: L R, LFE / Front: L C R, Side: L R, LFE
Sampling rate                            : 48.0 kHz
Frame rate                               : 187.500 FPS (256 spf)
Bit depth                                : 32 bits
Compression mode                         : Lossy
Delay relative to video                  : 5 ms
Stream size                              : 1.24 MiB (5%)
Title                                    : EAC3 7.1 from TrueHD
Writing library                          : Lavc58.52.100 eac3_eae
Language                                 : English
Default                                  : Yes
Forced                                   : No
DURATION                                 : 00:00:10.181000000

Audio #3
ID                                       : 4
Format                                   : E-AC-3
Format/Info                              : Enhanced Audio Coding 3
Format settings, Endianness              : Big
Codec ID                                 : A_EAC3
Duration                                 : 10 s 193 ms
Bit rate mode                            : Constant
Bit rate                                 : 640 kb/s
Channel(s)                               : 6 channels
Channel positions                        : Front: L C R, Side: L R, LFE
Sampling rate                            : 48.0 kHz
Frame rate                               : 187.500 FPS (256 spf)
Bit depth                                : 16 bits
Compression mode                         : Lossy
Stream size                              : 796 KiB (3%)
Title                                    : EAC3 640kbps
Writing library                          : Lavc58.134.100 eac3
Language                                 : English
Default                                  : No
Forced                                   : No
FromStats_BitRate                        : 6704260
FromStats_Duration                       : 00:00:10.193000000
FromStats_FrameCount                     : 12213
FromStats_StreamSize                     : 8529496

I figure the sample file can be used as a source to test if one attempts to transcode it’s TrueHD audio track 1 to EAC3 7.1.

1 Like

Thank you. I’m sorry I missed that.

I’ve added the direct sample file link to the trouble report (which I previously opened)

2 Likes

I should say I don’t have a surround setup, everything is downmixed to 2.0 but I get this too.
I don’t have a working setup of EAE to try manually encoding and removing the DRC metadata but hopefully this sample from The Hobbit: The Desolation of Smaug help. I wouldn’t be surprised if the issue was as simple as EAE applying the wrong DRC profile (i.e. something heavier than Film Standard).
It happens a lot really badly in all 3 Hobbits and LOTRs; something about the crescendos and the bass. I can’t say I’ve ever noticed it when transcoding DTS, either core or HD-MA. It’s always TrueHD Atmos.
I transcoded the TrueHD sample to FLAC which Plex then transcoded to E-AC3 7.1 - same problem at the same points.

The sample ranges from 2h 52m 0s to 2h 55m 40s. Here are some particularly noticeable parts but you’ll hear it just by listening:
2:52:00-30
2:53:50-55
2:55:00-10
2:55:30-40

Original mediainfo:

Audio #1
ID                                       : 2
Format                                   : MLP FBA 16-ch
Format/Info                              : Meridian Lossless Packing FBA with 16-channel presentation
Commercial name                          : Dolby TrueHD with Dolby Atmos
Codec ID                                 : A_TRUEHD
Duration                                 : 3 h 6 min
Bit rate mode                            : Variable
Bit rate                                 : 3 200 kb/s
Maximum bit rate                         : 5 031 kb/s
Channel(s)                               : 8 channels
Channel layout                           : L R C LFE Ls Rs Lb Rb
Sampling rate                            : 48.0 kHz
Frame rate                               : 1 200.000 FPS (40 SPF)
Compression mode                         : Lossless
Stream size                              : 4.17 GiB (9%)
Title                                    : English TrueHD 7.1 Atmos
Language                                 : English
Default                                  : Yes
Forced                                   : No
Number of dynamic objects                : 11
Bed channel count                        : 1 channel
Bed channel configuration                : LFE
2 Likes

@zplosion

Thank you.

The issue is open with Engineering as of 15 days ago when I discussed with the transcoder team.

With the new transcoder work coming to closure, I suspect resources will free up so they can look at this issue.

2 Likes

A post was split to a new topic: Audio problems w/ neural X

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.