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 > Video Encoding > MPEG-4 Encoder GUIs

Reply
 
Thread Tools Search this Thread Display Modes
Old 17th April 2012, 10:10   #1  |  Link
pururin
Registered User
 
Join Date: Dec 2011
Posts: 54
Transcoding with megui has audio bit depth problem?

e.g. when converting 24-bit audio to flac it'll always output 16-bit flac file instead of the original bit depth.

And there's no bit depth configuration available as far as I can see.


This also makes me wonder if I convert 24-bit flac to AAC, will it do the job correctly?
Not 24-bit flac > 16-bit intermediate file > AAC

Any response would be appreciate. Thanks!
pururin is offline   Reply With Quote
Old 17th April 2012, 13:44   #2  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 5,640
Quote:
Originally Posted by pururin View Post
e.g. when converting 24-bit audio to flac it'll always output 16-bit flac file instead of the original bit depth.
What 24-bit audio input?
Put the log file.

Quote:
This also makes me wonder if I convert 24-bit flac to AAC, will it do the job correctly?
Not 24-bit flac > 16-bit intermediate file > AAC
To decode flac file MeGUI use FFAudioSource and:
flac > 32-bit intermediate file > AAC
__________________
BeHappy, AviSynth audio transcoder, in Doom9 forums. NicAudio, BassAudio, audio decoders.
tebasuna51 is offline   Reply With Quote
Old 18th April 2012, 05:08   #3  |  Link
pururin
Registered User
 
Join Date: Dec 2011
Posts: 54
Thanks tebasuna.
For the log file, I use 24-bit flac > flac for example (DTS-HD 24-bit > flac is the same).

This is some part of the log file which I think is relevant:
[Information] Log for job1 (audio, H. Purcell Sweeter than roses -flac_24.flac -> H. Purcell Sweeter than roses -flac_24_new.flac)
...
-[Information] [18/4/2555 9:04:58] Trying to open the file with NicAudio
-[Information] [18/4/2555 9:04:58] Failed opening the file with NicAudio()
-[Information] [18/4/2555 9:04:58] Trying to open the file with FFAudioSource()
-[Information] [18/4/2555 9:04:59] Successfully opened the file with FFAudioSource()
-[Information] [18/4/2555 9:04:59] Avisynth script
--[NoImage] LoadPlugin("C:\Users\Pururin\Downloads\tools\MeGUI\tools\ffms\ffms2.dll")
--[NoImage] FFAudioSource("C:\Users\Pururin\Desktop\H. Purcell Sweeter than roses -flac_24.flac")
--[NoImage] AudioBits(last)>24?ConvertAudioTo16bit(last):last
--[NoImage] return last
-[Information] [18/4/2555 9:04:59] Commandline used: -f --channel-map=none -5 - -o "{0}"
-[Information] [18/4/2555 9:04:59] Avisynth script environment opened
-[Information] [18/4/2555 9:04:59] Script loaded
-[Information] Output Decoder
--[Information] [18/4/2555 9:04:59] Channels: 2
--[Information] [18/4/2555 9:04:59] Bits per sample: 16
--[Information] [18/4/2555 9:04:59] Sample rate: 44100


May I ask few other questions? The process above is converting to 16-bit by trimming off the least 8 bits, right?

Also there's something interesting. I convert the 24-bit flac directly to AAC, then also convert the 24-bit > 16-bit flac file above to AAC using same setting.
And found out that the 24-bit>16-bit >AAC file is larger than the direct 24-bit>AAC file.
I thought it would be the opposite since 24-bit file preserves more information, why it is like that?

Last edited by pururin; 18th April 2012 at 05:11.
pururin is offline   Reply With Quote
Old 18th April 2012, 14:16   #4  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 5,640
- Of course there are a problem decoding flac-24 bit:
The FFAudioSource output 32 bit int instead 24 bit, and the line
AudioBits(last)>24?ConvertAudioTo16bit(last):last
convert the audio to 16 bit because flac don't support 32 bit

When flac-24 is converted to AAC, the line:
AudioBits(last)>24?ConvertAudioTo16bit(last):last
is not inserted because NeroAacEnc support 32 bit input

BTW, convert flac-24 to flac-24 don't have sense.
And standard MeGUI audio conversion don't support decode DTS-HD 24 bits.
Then the problem is only convert TrueHD 24 bit to FLAC
For this conversion a workaround can be use a .avs, in Audio input, like this:

LoadPlugin("D:\Programa\megui\tools\ffms\ffms2.dll")
FFAudioSource("D:\Test\TrueHD\test_24bit.thd")
ConvertAudioto24bit()

- The recommended option to convert lossless audio (DTS-MA, TrueHD) to FLAC is use eac3to.
But the GUI added to MeGUI (Tools -> HD Streams Extractor) don't support audio only files, must be inside a container (m2ts, mkv, evo,...).
If you have audio only files you can use other GUI, like UsEac3to.

- The size of a lossy aac can be different, maybe the 32 bit source is more compressible than 16 bit source.
__________________
BeHappy, AviSynth audio transcoder, in Doom9 forums. NicAudio, BassAudio, audio decoders.
tebasuna51 is offline   Reply With Quote
Old 19th April 2012, 15:59   #5  |  Link
pururin
Registered User
 
Join Date: Dec 2011
Posts: 54
Thanks a lot tebasuna, especially for the suggestion, much appreciate really.

Convert flac-24 to flac-24 sure don't have sense, haha. I used it to produce the log file at the time.


You know, I read some of your posts on doom9 (from googling in the past) and it's helped me a lot!
pururin is offline   Reply With Quote
Old 19th April 2012, 22:08   #6  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 3,978
How much is quality likely to be effected by decoding DTS to 16 bit first when converting to a lossy format such as AAC?
I tried a DTS conversion using eac3to and one using foobar2000. I'm fairly sure the foobar2000 DTS decoder decodes to 16 bit as when I convert to flac I get a 16 bit flac file while with eac3to I get a 24 bit one.

When converting the same DST file directly to AAC with both programs, the resulting file size was 281.5MB (well the foobar2000 was 51 bytes larger) so I assume there can't be much difference between the two?
hello_hello is offline   Reply With Quote
Old 20th April 2012, 09:56   #7  |  Link
pururin
Registered User
 
Join Date: Dec 2011
Posts: 54
Quote:
Originally Posted by hello_hello View Post
I'm fairly sure the foobar2000 DTS decoder decodes to 16 bit as when I convert to flac I get a 16 bit flac file while with eac3to I get a 24 bit one.
I think it's not, like in my case FFAudioSource in Megui works at 32-bit internally
which is too much for FLAC format, hence it downconverts to 16-bit beforehand.

But when it goes straight to lossy codec (no bit depth) the DTS decoder can just output 32-bit right to AAC encoder
so the results are about the same. The limit is at the end-format, not the decoder.

Also from what I've seen, good decoders usually use at least 32-bit fp decoding lossy codec.
(libav in eac3to decode DTS at 64-bit IIRC). I know that foobar player works internally at 32-bit float
while on transcoding side I don't know for sure but it's very unlikely decoding at just 16-bit.


Quote:
Originally Posted by hello_hello View Post
How much is quality likely to be effected by decoding DTS to 16 bit first when converting to a lossy format such as AAC?
Tebasuna have said that
Quote:
Originally Posted by tebasuna51 View Post
One more time, AC3/DTS standard (lossy) don't have bitdepth.

AC3/DTS files must be decoded to, at least, 24 bit to obtain the best aproach to the source, no matter the original bitdepth.
http://forum.doom9.org/showthread.ph...35#post1386435

Quote:
Originally Posted by tebasuna51 View Post
A standard ac3 file don't have bitdepth and don't preserve the data about the original bitdepth of the source.
Then always is recommended decode a ac3 file to, at least, 24 bits in order to preserve the max quality
http://forum.doom9.org/showthread.ph...37#post1543737

If the source is lossless I have studied quite a lot about 24-bit vs 16-bit and 24-bit is conclusively proven to have no effect on playback.

But as DTS has no bit depth, the higher precision the less error. Performance is not an issue these days.
It usually got decoded at 32-bit fp, sometimes 64-bit as mentioned.
And by going right down to 16-bit might not be good, especially with out proper dithering.

But then again, DTS>AAC is lossy to lossy conversion.
Maybe it won't matters much at this point as lossy>lossy conversion error overshadows those bit depth thing.

Last edited by pururin; 20th April 2012 at 11:14.
pururin is offline   Reply With Quote
Old 20th April 2012, 11:19   #8  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 3,978
Quote:
Originally Posted by pururin View Post
Maybe it's not, like in my case FFAudioSource in Megui works at 32-bit internally
which is too much for FLAC format, hence it downconverts to 16-bit beforehand.

But when it goes straight to lossy codec (no bit depth) maybe the DTS decoder can just output 32-bit to AAC encoder
so the results are about the same. The limit is at the end-format, not the decoder.

I only know that foobar player works internally at 32-bit float
but on transcoding side I don't know what foobar uses for decode DTS.
Foobar uses this plugin:
http://www.foobar2000.org/components/view/foo_input_dts
16 bit is actually mentioned but I'm too silly to understand exactly what it's referring to.
I do know when I convert DTS to wave I also get 16 bit wave files using foobar2000 and 24 bit when using eac3to, but that still doesn't mean it can't be outputting 32 bit straight to the AAC encoder. The fact that the AAC file sizes are almost identical either way seems to indicate it might be, but I'm just not sure.

Quote:
Originally Posted by pururin View Post
If the source is lossless I have studied quite a lot about 24-bit vs 16-bit and 24-bit is conclusively proven to have no effect on playback.
I wouldn't be surprised.

Quote:
Originally Posted by pururin View Post
But then again, DTS>AAC is lossy to lossy conversion.
Maybe it won't matters much at this point as lossy>lossy conversion error overshadows those bit depth thing.
Well I can't hear any difference, but then again I'm not exactly using top of the line audio gear to compare them. I was really asking more out of curiosity than anything else, but if you can decipher the information on the DTS plugin page for me I'd be interested.

Cheers.

Last edited by hello_hello; 20th April 2012 at 11:40.
hello_hello is offline   Reply With Quote
Old 20th April 2012, 15:49   #9  |  Link
pururin
Registered User
 
Join Date: Dec 2011
Posts: 54
Quote:
Originally Posted by hello_hello View Post
Foobar uses this plugin:
http://www.foobar2000.org/components/view/foo_input_dts
16 bit is actually mentioned but I'm too silly to understand exactly what it's referring to.
That's not about decoding, it's about the input formats support.
It's the DTS compressed signal in an uncompressed 16-bit 44.1/48kHz WAV format. (DTS stream in .wav file)

About the plugin (Hell... that page tells us almost nothing, haha), it based on the famous AC3Filter.
You may wanna read here https://github.com/vsu/foo_input_dts...EADME.markdown

And AC3Filter sure supports decoding at 32-bit, and it's smart enough.
(FYI the manual do says: "When decoding the filter defines decoding precision. At present 16/24/32 bit and floating-point formats are supported.")

I'm no smarter than you though. I can provide only those information.
If you want to make sure, you can pm to the author. You can find him(kode54) at Hydrogenaudio forum.
If you really wanna make sure, you can use bit-meter in audio suite like Wavelab or iZotope Ozone to check .

Quote:
Originally Posted by hello_hello View Post
Well I can't hear any difference, but then again I'm not exactly using top of the line audio gear to compare them. I was really asking more out of curiosity than anything else, but if you can decipher the information on the DTS plugin page for me I'd be interested.

Cheers.
I understand this very well, as I'm a curious one myself
That's just my speculation for pure exchange of thoughts though, In practical, I'm kind of "safety first" even when I can't hear the difference.

If I'm in the situation, I would use eac3to just to ensure best quality, of course if it's not too inconvenient.

Last edited by pururin; 20th April 2012 at 16:12.
pururin is offline   Reply With Quote
Old 20th April 2012, 21:28   #10  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 3,978
Thanks for all the info. I think I've found the answer. It's amazing how you can use a program for years and forget about settings or not pay attention to them.

Anyway.... I manually set up a flac conversion preset and still ended up with a 16 bit file even with the maximum bit depth set to 24. So then I changed the preset to "lossy" and even though I was still using flac, suddenly I was getting 24 bit flac files. Then the penny dropped.....

Back on the foobar2000 converter setup page, a bit depth box appears at the bottom whenever you select a lossless output conversion preset. It's set to "auto" for each, by default. I might inquire about it in the foobar2000 forum but it appears "auto" means it'll downconvert to 16 bit. Once I changed it from "auto" to "24 bit" I was outputting 24 bit flac files.

As a test I tried a few quick conversions to compare file sizes. I used a 16 bit wave file which I'd converted from a small DTS file as the source, then I used the DTS file as the source to run the conversions again. I converted them both to flac with the bit depth set to "auto" and then again set to "24".

16 bit wav -> 16 bit flac: 61.3MB
16 bit wav -> 24 bit flac: 61.3MB

DTS -> 16 bit flac: 61.3MB
DTS -> 24 bit flac: 163.6MB

I assume it's safe enough to assume, as the 24 bit flac file was so much larger when converting directly from DTS (and the encoding speed dropped by about half), the DTS encoder is outputting 32 bit fp, and when converting directly to flac (with the encoder set up correctly), I'm definitely outputting true 24 bit flac files? If so I guess it means I'm fine when converting directly to AAC.

I must admit I prefer using foobar2000 when I can, mainly because it's so easy to send a file to foobar2000 using the Windows right click/sendto menu, and from there it's only another right click to pick a conversion preset. Plus you can easily convert a bunch of files at a time (foobar2000 will convert as many simultaneously as there are CPU cores).

One question which does come to mind..... not that I convert to a lossless format all that often, but when doing so foobar2000 gives you a choice not to dither, to dither only if the source is lossy, or to always dither. When is it better to apply dithering and when is it better not to?

Anyway, thanks again for the info.

Last edited by hello_hello; 20th April 2012 at 21:36.
hello_hello is offline   Reply With Quote
Old 20th April 2012, 21:54   #11  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 3,978
Quote:
Originally Posted by pururin View Post
Also there's something interesting. I convert the 24-bit flac directly to AAC, then also convert the 24-bit > 16-bit flac file above to AAC using same setting.
And found out that the 24-bit>16-bit >AAC file is larger than the direct 24-bit>AAC file.
I thought it would be the opposite since 24-bit file preserves more information, why it is like that?
I thought I'd try it using my little 7 minute sample.

DTS -> 16 bit wav -> AAC: 22MB (23,147,641 bytes)
DTS -> AAC: 22MB (23,125,967 bytes)

So yeah..... for me converting directly from DTS produced a slightly smaller AAC file too.

And while I was doing that I thought a bit more about the original DTS file size (80.2MB).
I converted it to flac with eac3to just to make sure something odd hadn't happened when converting with foobar2000, but once again the flac file size was double the original (165MB).

Maybe that's why MeGUI downconverts to 16 bit when converting to flac? If you don't, maybe there's no real point to converting?

Last edited by hello_hello; 20th April 2012 at 22:21.
hello_hello is offline   Reply With Quote
Old 21st April 2012, 15:59   #12  |  Link
pururin
Registered User
 
Join Date: Dec 2011
Posts: 54
Quote:
Originally Posted by hello_hello View Post
So yeah..... for me converting directly from DTS produced a slightly smaller AAC file too.
Thanks for confirming that.

About DTS>Flac
Yeah, it seems like a known fact that this results in larger file size.
There's no point downgrading it to 16-bit Flac, except one need it in Flac format for some special reasons.

So if one does care about quality, DTS>Flac conversion is moot.
And If anyone gives more priority to disk space, they better just convert it to AAC like you do.

I think that's why foobar2000 "auto" select 16-bit output by default despite the decoder working at higher precision.


Quote:
Originally Posted by hello_hello View Post
I assume it's safe enough to assume
...I'm definitely outputting true 24 bit flac files? If so I guess it means I'm fine when converting directly to AAC.
...
When is it better to apply dithering and when is it better not to?
I agree with you.
Btw if the decoder is lame enough such that it decodes at only 16-bit, it's likely that the 24-bit file you've got is just 16-bit padded with 8 more zeroes.
If this is the case, then you can check it with eac3to whether the Flac file is really 24-bit or not. But I think it's sure enough true 24-bit.


About dithering.
1. When coming from higher bit depths at any point it should always be applied, plus noise shaping should also be used.
Except PC is too ancient or it consumes cpu too much that it's unacceptable at some point. (unlikely an issue these days)

e.g. (→ means dither) 24-flac→16-flac, 24-bit dts-hd→16-bit output , 32-bit fp lossy codec decoding→16/24-bit playback
16-bit flac > 32-bit processing(like resampling, mixer etc.)→16-bit final output, 32-bit decoding→16-bit audio file


2. If any more processing is to happen to the audio then don't use noise shaping, just apply dithering. (TPDF dithering)
e.g. 24-truehd --(dither only)--> 16-flac file > 32-bit processing(doing at high level for processing precision) --(dither+noise shaping)--> 24-bit final output

3. Don't ever use any dithering when converting to same bit depth or higher (if programs let you do), in this case it'll only add noise for no reason.


The lower you're going at, the more need to dither. But at high level(24 bit and above) such as 64>32 or 32>24 you may not need it,
unless you're in sound production doing a lot of processing to the audio. Or want to keep good medium for future production, sound engineering, etc.

However, even cutting down to 16-bit without dithering at all, it's just rounding error that most people won't be troubled much or even not notice.
Noise shaping is less important. So all in all you don't have to worry much about these.
pururin is offline   Reply With Quote
Old 21st April 2012, 17:56   #13  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 3,978
As Abed would say..... "cool, cool, cool" (if you don't watch Community, that won't make sense).

Thanks for the info again.
hello_hello 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 11:39.


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