Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > General > Audio encoding

Reply
 
Thread Tools Search this Thread Display Modes
Old 28th November 2010, 10:20   #1  |  Link
azaze1
Registered User
 
Join Date: Oct 2010
Posts: 34
eac3to gains are reversed in 2nd pass

I'm trying to compensate for the lower volume of multichannel FLAC. In doing so, I'm using the +3dB option. However, during the 2nd pass of writing... eac3to applyes the inverse negative gain which makes the whole process a wash.

It's happening when converting a TrueHD stream from Bluray, or a .thd file (already extracted from Bluray), or applying the gain to an existing .flac file.

Code:
D:\mkv.authoring\eac3to.out\hbp>eac3to hbp_audio.thd hbp_audio_3db_gain_16bit.flac +3dB -down16
TrueHD, 5.1 channels, 48kHz
Decoding with libav/ffmpeg...
Reducing depth from 64 to 16 bits...
Encoding FLAC with libFlac...
Applying 3dB gain...
Creating file "hbp_audio_3db_gain_16bit.flac"...
Clipping detected, a 2nd pass will be necessary.
libav End of stream indicated
The original audio track has a constant bit depth of 16 bits.
The processed audio track has a constant bit depth of 16 bits.
Starting 2nd pass...
Decoding with libav/ffmpeg...
Reducing depth from 64 to 16 bits...
Encoding FLAC with libFlac...
Applying 3dB gain...
Applying -3.09dB gain...
Creating file "hbp_audio_3db_gain_16bit.flac"...
The -3.09dB gain is the issue. I can't figure out what's causing this.
azaze1 is offline   Reply With Quote
Old 28th November 2010, 12:58   #2  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,569
- Seems your audio file is already to max volume allowed, you can't amplify it without distort.
Not recommended, but if you want avoid the 2nd pass you can use the parameter -no2ndpass.

- eac3to check your TruedHD, if is already 16 bits you don't need -down16

- If you make any change, like +3dB or -down16, the conversion isn't lossless, you can't recover the original audio.
Consider extract the ac3 640 Kb/s included in your BD TrueHD track instead.

- When you make any recode, and you want the max volume allowed, use the parameter -normalize (not recommended in this case).
__________________
BeHappy, AviSynth audio transcoder.
tebasuna51 is offline   Reply With Quote
Old 28th November 2010, 20:11   #3  |  Link
azaze1
Registered User
 
Join Date: Oct 2010
Posts: 34
Thanks for the reply, couple of things to note:

I added -down16 because without that... it was converting the audio to 24bit bloating the filesize from 1.5 GB to something over 4GB. I added -down16 to keep the size at 1.5GB being that the source is 16bit to begin with

Second, I definately don't want to lose quality... I've invested quite a bit in my audio setup so I always try to maintain master audio, truehd... and convert Blurays with nothing but PCM to FLAC when I create my MKVs to save space. So if adding +3dB is going to make a lossless track lossy then I'll avoid it. How is it that the original TrueHD track is simply louder though? FLAC version is considerably quieter which is what I'm trying to correct.
azaze1 is offline   Reply With Quote
Old 29th November 2010, 00:24   #4  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,569
If I use:
eac3to input.thd output.flac
always get a output.flac with less size than input.thd

I can't understand how you obtain a 4GB flac from a 1.5GB thd

The audio is bitidentical then seems you have a problem with your player if thd is louder than flac.
__________________
BeHappy, AviSynth audio transcoder.
tebasuna51 is offline   Reply With Quote
Old 29th November 2010, 03:14   #5  |  Link
azaze1
Registered User
 
Join Date: Oct 2010
Posts: 34
Actually it only chose 24bit when I added +3dB (without the -down16). With the command sample you provided (no arguments/adjustments) it came out to 16bit for me as well.

Once I tried to compensate for the quiet FLAC by adding +3dB by itself it created a 24bit FLAC file. That's what prompted me to throw in the -down16 to keep it at 16bit.
azaze1 is offline   Reply With Quote
Old 29th November 2010, 11:45   #6  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,569
Quote:
Originally Posted by azaze1 View Post
Actually it only chose 24bit when I added +3dB (without the -down16). With the command sample you provided (no arguments/adjustments) it came out to 16bit for me as well.
The best option (lossless conversion).

Quote:
Once I tried to compensate for the quiet FLAC by adding +3dB by itself it created a 24bit FLAC file. That's what prompted me to throw in the -down16 to keep it at 16bit.
When you demand +3dB the 16 bit is converted to 64 bit float to make the job more precise, after the 64 bit float can't be converted to 16 bit without lose precission and is converted to 24 bit by default by eac3to (lossy conversion).
__________________
BeHappy, AviSynth audio transcoder.
tebasuna51 is offline   Reply With Quote
Old 29th November 2010, 17:50   #7  |  Link
azaze1
Registered User
 
Join Date: Oct 2010
Posts: 34
I see, thanks again for the explanation. I've done some searching elsewhere for "quiet FLAC" and I see it's a very common complaint. Unfortunately there is no safe/lossless solution. I'm gonna have to bite the bullet and keep my PCM tracks as is at 6-7GB... yikes!
azaze1 is offline   Reply With Quote
Old 29th November 2010, 20:48   #8  |  Link
ramicio
Banned
 
Join Date: Mar 2004
Location: PA, US
Posts: 684
You could limit the tracks so you lose dynamic range (dynamic range compression.) This is what seems to be your issue, that most of the movie is quiet, and the loud parts are too loud. Why do you have to keep your PCM tracks? TrueHD or FLAC will be the exact same track as the PCM, but losslessly compressed. The quietness has nothing to do with the format you choose. Movies these days have a large dynamic range. It is quite annoying to me as well, as I like to just watch movies without waking everyone up or wanting to constantly adjust volume so I can hear dialog and not be blasted by the loud parts.
ramicio is offline   Reply With Quote
Old 29th November 2010, 22:00   #9  |  Link
azaze1
Registered User
 
Join Date: Oct 2010
Posts: 34
Well, I'll put it this way. I'm dealing in my tests with the Harry Potter, half-blood prince Bluray.

Using eac3to, I've created two audio files. One is ripping the TrueHD file straight to disk... and the other is encoding to FLAC.

Any way I slice it, the FLAC is quieter throughout the entire track as compared to the TrueHD stream. I keep on hearing references to bitperfect... exactly the same... no different... etc.

But the first 60 seconds of the track is evidence enough. The thunder on TrueHD track booms and the camera flashes when photographers take pictures of Harry Potter are LOUD and sharp. The same first 60 seconds on FLAC is no where near the same volume. I'd have to dial up my Onkyo receiver from 50.0 to about 64.0 to get the same volume.

The reduction of dynamic range sounds promising, but without providing any particular arguments... wouldn't the FLAC track represent the same dynamic range of the TrueHD? If that's the case then why would the FLAC be so quiet? Is it possible that encoding in FLAC is increasing the dynamic range or that by decoding the TrueHD is releasing some dynamic range cap that isn't being reapplied while encoding to FLAC?

Last edited by azaze1; 29th November 2010 at 22:03.
azaze1 is offline   Reply With Quote
Old 29th November 2010, 22:03   #10  |  Link
ramicio
Banned
 
Join Date: Mar 2004
Location: PA, US
Posts: 684
Do you bit-stream your TrueHD track to your receiver? If so that would be why you have different volumes because the receiver decodes the TrueHD but not the FLAC. Also are you getting 5.1 from the receiver with FLAC? Take the TrueHD and make it into WAV, then go TrueHD -> FLAC -> WAV and compare the checksums of the 2 different WAVS. They SHOULD be identical. Or open them up in an editor to see if they are visually different, which would be easy to see volume. And also, a receiver would pick up normalization and DRC info present in the TrueHD stream.

Last edited by ramicio; 29th November 2010 at 22:07.
ramicio is offline   Reply With Quote
Old 29th November 2010, 22:10   #11  |  Link
azaze1
Registered User
 
Join Date: Oct 2010
Posts: 34
Yes, I'm bitstreaming TrueHD to the receiver. Interesting... my receiver does support FLAC (Onkyo TX-NR5008) but there is no software to bitstream FLAC tracks yet (I'd be glad to be wrong here!).

Yes, receiver is getting 5.1 PCM from the FLAC track. I had wrestled quite a bit sending 5.1 to the receiver but that's all taken care of. So if it's the decoding on the HTPC end that's causing the problem then I'll have to do a fair comparison by decoding TrueHD and sending PCM to receiver and see if that matches the FLAC.
azaze1 is offline   Reply With Quote
Old 29th November 2010, 22:14   #12  |  Link
ramicio
Banned
 
Join Date: Mar 2004
Location: PA, US
Posts: 684
I have a feeling that this is just about the receiver getting the DRC and normalization information from the TrueHD track. Maybe there is a way to extract this information into something useful to apply to a FLAC or PCM track. Then it would become permanent, though, and it would not be bit-perfect to the original, but if you don't care that's all that matters. I don't think receivers supporting FLAC will ever support it through HDMI or whatever interface. This feature is meant to be used by a file system, like an SD card, or USB peripheral, or ethernet/wifi. Oh, and why are you trying to turn the TrueHD into something else lossless? Are you trying to put it into a non-compatible container?

Last edited by ramicio; 29th November 2010 at 22:21.
ramicio is offline   Reply With Quote
Old 29th November 2010, 22:25   #13  |  Link
azaze1
Registered User
 
Join Date: Oct 2010
Posts: 34
If the FLAC track has this as part of the conversion then I'd be happy waiting for ffdshow to include FLAC in it's bitstreaming capabilities assuming it's on the horizon (receivers are starting to support flac directly like mine).

Otherwise, I'd settle for applying the DRC to the FLAC as a permanent adjustment to the audio file. I don't think I want to get any windows mixers or anything like that involved unless it can be done ONLY to flac tracks.
azaze1 is offline   Reply With Quote
Old 29th November 2010, 22:31   #14  |  Link
ramicio
Banned
 
Join Date: Mar 2004
Location: PA, US
Posts: 684
Well I'm talking about applying DRC in an editor to the track, not something that adjusts volume on the fly. Don't hold your breath for FFDShow to add anything like that. They haven't even got a DTS-HD Master decoder yet. Plus who even knows if receivers can decode FLAC from a bitstream. But again, why do you need to go from TrueHD to FLAC?
ramicio is offline   Reply With Quote
Old 29th November 2010, 23:10   #15  |  Link
azaze1
Registered User
 
Join Date: Oct 2010
Posts: 34
Which editors should be considered for applying DRC to the audio ?

I'm using TrueHD and FLAC as comparison purely to make sure everything sounds the same.

I'll actually be utilizing FLAC for the 1st 5 harry potter movies where they did not include a TrueHD or DTS-HDMA track.... only PCM 5.1 in which case FLAC will become useful to save space.

The receiver i have does support FLAC but it wont really matter because there are so few Blurays with ONLY raw/pcm. This whole endeavor is again just for the archiving of the 1st 5 harry potter movies.
azaze1 is offline   Reply With Quote
Old 30th November 2010, 01:38   #16  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,569
Quote:
Originally Posted by azaze1 View Post
...
Yes, receiver is getting 5.1 PCM from the FLAC track. I had wrestled quite a bit sending 5.1 to the receiver but that's all taken care of. So if it's the decoding on the HTPC end that's causing the problem then I'll have to do a fair comparison by decoding TrueHD and sending PCM to receiver and see if that matches the FLAC.
What player and decoders are you using to send 5.1 PCM to the receiver?

Quote:
Originally Posted by ramicio View Post
I have a feeling that this is just about the receiver getting the DRC and normalization information from the TrueHD track....
But any info about DialNorm can only be used to lower the volume. And DRC lower also high volumes.
__________________
BeHappy, AviSynth audio transcoder.
tebasuna51 is offline   Reply With Quote
Old 30th November 2010, 02:12   #17  |  Link
azaze1
Registered User
 
Join Date: Oct 2010
Posts: 34
I am using MPC-HC 32bit (build from November 24th)
madFlac 1.9 set as external decoder, preferred (above ffdshow)
Reclock 1.8.7.2 as audio renderer in MPC-HC

It's adding Reclock into the mix that was required for me to get 5.1 PCM to receiver. Without that... I was only able to send 2.0 stereo .
azaze1 is offline   Reply With Quote
Old 30th November 2010, 12:23   #18  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,569
Maybe is a Reclock issue.

I can't help you about Reclock, but seems can make strong changes to bitstream sended to your receiver:
Code:
Finally it is an audio renderer with hardware or software rate adaptation in real-time, multi-channel audio,
audio timestretching (pal speedup compensation) and dynamic range compression capabilities.
--------
* added an indication in "renderers infos" box that indicate if reclock did alter the audio bitstream
(for example to resample, timestrech audio or modify dynamic range) 
--------
#  New: Software volume adjustment, supports Kernel streaming, Wasapi and Wave out
# Change: Setting volume will be performed in software with WaveOut. DSound volume will still be done 
using DSound SetVolume() API.
# Note: Adjusting the volume works with players using the DSound volume inteface, 
e.g. Media Player Classic or Zoom player.
Seems the madflac decoded output can be changed with TimeStretch, DRC and volume.
Then you don't get lossless audio anymore.
__________________
BeHappy, AviSynth audio transcoder.
tebasuna51 is offline   Reply With Quote
Old 30th November 2010, 19:48   #19  |  Link
azaze1
Registered User
 
Join Date: Oct 2010
Posts: 34
Thank you for all of the input.

I'm VERY embarrassed to say that it was SO simple. At some point many many months ago the volume bar in MPC-HC must have been dialed back to about 60-70%.

I never noticed this because XBMC launches the movies in full screen so I don't see the volume bar nor did I ever need to adjust it because I've bitstreamed EVERYTHING until this FLAC track a few days ago.

This FLAC track is the first thing that's being decoded on the HTPC where the volume level makes a difference. Mind you I used to check the speaker button in the system tray on occasion and it was always 100%. It was JUST the mpc-hc volume that was lowered. I bumped that up to 100% last night and now the FLAC is indistinguishable from the TrueHD both on sound quality and volume

Thanks again and sorry to waste everyone's time.
azaze1 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:53.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, vBulletin Solutions Inc.