Opened 12 years ago

Closed 11 years ago

Last modified 10 years ago

#6569 closed patch (Fixed)

ac3 level is low for 5.1 source

Reported by: Mark Spieth Owned by: janneg
Priority: minor Milestone: unknown
Component: MythTV - Video Playback Version: unknown
Severity: medium Keywords:
Cc: Ticket locked: no


the ac3 gain is low for 5.1 sourced audio streams but is ok for 2.0. we have channels which have 5.1 material with 2.0 ads between. audio level changes are annoying.

patch attached to fix this.

Attachments (2)

mythtv_ac3gainfix.patch (812 bytes) - added by Mark Spieth 12 years ago.
mythtv_ac3gainfix.patch.v2 (845 bytes) - added by Bill Meek <keemllib@…> 10 years ago.
Works with trunk at 27015

Download all attachments as: .zip

Change History (13)

Changed 12 years ago by Mark Spieth

Attachment: mythtv_ac3gainfix.patch added

comment:1 Changed 12 years ago by danielk

Mark, have you tried submitting this to the ffmpeg folks?

comment:2 Changed 12 years ago by anonymous

A hardcoded gain increase can result in clipping and is not an appropriate way to address the "loud commercials" problem. This problem varies across different broadcasters/affiliates and really must be fixed at the source. This patch would cause problems on channels that do set proper levels, as well as on other ac3-bearing content, such as DVDs. Additional reading:

comment:3 Changed 12 years ago by anonymous

To attribute this problem to the broadcaster would be erroneous, AC3 5.1 volumes with ffmpeg have always been lower than other codecs, e.g. mp2 or mp3 even with the same programmes (BBC HD offers stereo mp2 alongside 5.1 AC3). This causes problems when switching between channels using differing audio formats and not just on audio stream changes on a single channel.

comment:4 Changed 12 years ago by Mark Spieth

finally had time to look into this again. the problem I had experienced was my stupid error. I'd made some different mods to my main frontend which didnt reflect the algo correctly.

The patch does work correctly for both 6ch output and 2ch downmixed output for both 2.0 and 5.1 ac3 source material.

I suspect there is a gain problem that is scaled for the number of channels in the source. thus 1/3 (-10dB) for 6ch over 2ch. (2ch being louder). This is not a downmix issue either.

The spec does not mention this though. The gain values in the table should probably be 3 and not 3.16 for this reason.

If anyone has mixed 4ch/2ch or 4ch/6ch audio material it would be interesting to test this theory. I only have access to mixed 2ch/6ch material.

comment:5 Changed 12 years ago by Mark Spieth

submitted patch to ffmpeg issue 1153

comment:6 Changed 11 years ago by stuartm

Owner: changed from Isaac Richards to janneg
Status: newassigned

comment:7 Changed 11 years ago by Mark Spieth

this is an issue with dolby technical bulletin 11.

what I have done is essentially correct but off by 1 dB. they recommend 11 dB attenuation an all non ACE/EAC3

from a bit of web searching

For receivers
featuring E-AC3, this should be consistent with Dolby Technical Bulletin 11: Requirement Updates for AC3
and E-AC3 in DVB Products [34]. Receivers featuring AC3 or E-AC3 decoding shall include the PCM Level
Control feature described therein. For example, for MPEG-1 Layer 2 audio streams that have an average
loudness of about -20 dBLeq, the receiver shall apply an attenuation of 11 dB for the digital output to
match the internal reference level.

Cant find a copy of this bulletin but the concept is there. Something to do with RFMode.

Another spec Ive seen says reduce by a further 3dB on top of the 11dB.

Thus this should be consistent around the world and not just peculiar to some implementations.

comment:8 Changed 11 years ago by robertm

Status: assignedinfoneeded


Appreciate your expertise with the Dolby stuff-- can you comment on how/whether this still applies to the new audio code with all the resampling, upmixing, etc? If so, any chance of an updated patch?

comment:9 Changed 11 years ago by robertm

Resolution: fixed
Status: infoneededclosed


I'm closing this one for now as you seem to be in touch with the audio guys regarding the current (and upcoming) audio changes that will affect or possibly render unnecessary this ticket. If this issue is uncorrected by those changes, please do feel free to reopen this ticket at any time with an update to your patch. Closing this as "fixed" as there's no real appropriate resolution otherwise.

Changed 10 years ago by Bill Meek <keemllib@…>

Attachment: mythtv_ac3gainfix.patch.v2 added

Works with trunk at 27015

comment:10 Changed 10 years ago by JYA

Resolution: fixedFixed

(In [27370]) Add options to use myth's own downmixer instead of ffmpeg's downmixer. This fix the issue with low volume audio for 5.1 AC3 stream on a stereo system. Fixes #6569

comment:11 Changed 10 years ago by JYA

(In [27395]) Backport [27370],[27375],[27377]. Fixes #6569 temporarily

Note: See TracTickets for help on using tickets.