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 18th May 2007, 13:45   #1  |  Link
madshi
Registered Developer
 
Join Date: Sep 2006
Posts: 8,858
eac3to - audio conversion tool

http://madshi.net/eac3to.zip

Code:
eac3to v3.31, freeware by madshi.net

- can show information about audio, video, VOB/EVO/(M2)TS and MKV files
- can decode and encode various audio formats
- can remove dialog normalization from AC3, E-AC3, DTS and TrueHD tracks
- can extract AC3 stream from Blu-Ray TrueHD/AC3 tracks
- can extract TrueHD stream from Blu-Ray TrueHD/AC3 tracks
- can extract DTS core from DTS-HD tracks
- can remove DTS zero padding and repair outdated DTS-ES headers
- can apply positive or negative audio delays
- can reduce bitdepth of decoded audio data by using TPDF dithering
- can resample decoded audio data (using SSRC or r8brain)
- can apply/reverse PAL speedup on decoded audio data (SSRC/r8brain)
- can demux video / audio tracks of EVO/VOB/(M2)TS and MKV sources
- can list available titles of Blu-Ray and HD DVD discs
- can extract Blu-Ray and HD DVD chapter information and subtitles
- can mux MPEG2, VC-1 and h264 video tracks to Matroska
- can remove pulldown flags from MPEG2, VC-1 and h264 video tracks

eac3to sourcefile[+sourcefile2] [trackno:] [destfile|stdout] [-options]

Examples:
eac3to source.pcm destination.flac
eac3to source.thd destination.flac destination.ac3
eac3to blurayMovieFolder movie.mkv
eac3to source.evo 1: chapters.txt 2: video.mkv 3: audio.flac 5: subtitle.sup
eac3to feature_1.evo+feature_2.evo movie.mkv

Options:
-448               use e.g. "192", "448" or "640" kbps for AC3 encoding
-768               use "768" or "1536" kbps for DTS encoding
-core              extract the DTS core of a DTS-HD track
+/-100ms           apply a positive or negative audio delay
+/-3dB             apply a positive or negative audio gain (volume change)
-0,1,2,3,4,5       remap the channels to the specified order
-edit=0:00:00,0ms  loops or removes audio data at the specified runtime
-silence/-loop     forces usage of silence (or looping) for audio edits
-down6             downmix 7 or 8 channels to 6 channels
-downDpl           downmix multi channel audio to Dolby Pro Logic II
-downStereo        downmix multi channel audio to simple Stereo
-phaseShift        shift phase (when doing stereo downmixing, see "down2")
-mixlfe            mix LFE in (when doing stereo downmixing, see "down2")
-down16            downconvert decoded audio data to 14..23 bit
-slowdown          convert 25.000 and 24.000 content to 23.976 fps
-speedup           convert 23.976 and 24.000 content to 25.000 fps
-23.976/...        define source fps to be "23.976", "24.000", "25.000", ...
-changeTo24.000    change source fps to "23.976", "24.000", "25.000", ...
-resampleTo48000   resample audio to "44100", "48000" or "96000" Hz
-r8brain           use r8brain resampler instead of SSRC
-quality=0.50      Nero AAC encoding quality (0.00 = lowest; 1.00 = highest)
-8                 define PCM file to be "1".."8" channels
-16                define PCM file to be "16" or "24" bit
-little            define PCM file to be "little" or "big" endian
-96000             define PCM file to be 44100, 48000, 96000 or 192000 Hz
-override          forcefully overrides PCM auto detection with manual values
-sonic/nero/...    force the use of a specific decoder (not recommended)
-keepDialnorm      disables dialog normalization removal (not recommended)
-decodeHdcd        decodes HDCD source track (usually 16 -> 20 bit)
-demux             demuxes 1st video track and all audio and subtitle tracks
-stripPulldown     strips the pulldown from MPEG2 video tracks
-keepPulldown      disable removal of pulldown for MPEG2, h264 and VC-1 tracks
-seekToIFrames     make all h264/AVC "I" frames seekable
-check             checks if the source EVO/(M2)TS file is clean.
-test              checks if the external filters are installed & working
-lowPriority       moves processing to background/idle priority
-shutdown          automatically shutdown the PC after processing is done

Supported source formats:
(1) RAW, (L)PCM
(2) WAV (PCM, DTS and AC3), W64, RF64
(3) AC3, E-AC3
(4) DTS, DTS-ES, DTS-96/24, DTS-HD Hi-Res, DTS-HD Master Audio
(5) MP1, MP2, MP3 audio
(6) AAC audio
(7) MLP, TrueHD, TrueHD/AC3
(8) FLAC
(9) EVO/VOB/(M2)TS and MKV

Decoded audio data can be stored as / encoded to:
(1) RAW, (L)PCM
(2) WAV (PCM only), W64, RF64, AGM
(3) WAVs (multiple mono WAV files, PCM only)
(4) AC3
(5) DTS
(6) AAC
(7) FLAC

For best AAC decoding you need:
(1) Nero 7 (Nero 8 won't work!)

For DTS encoding you need:
(1) SurCode DVD DTS - version 1.0.21 or newer

For AAC encoding you need:
(1) Nero AAC Encoder

For video muxing you need:
(1) Haali Matroska Muxer
wiki:

Not written by me, not finished yet, but definitely worth a look:

http://en.wikibooks.org/wiki/Eac3to

bug tracker:

http://eac3to.bugs.madshi.net

GUIs:

If you prefer a graphical user interface, here are three choices (not written by me):

Eac3to and More GUI:
http://forum.doom9.org/showthread.php?t=135095

HD DVD/Blu-Ray Stream Extractor:
http://forum.doom9.org/showthread.php?t=141829

Clown BD:
http://forum.slysoft.com/showthread.php?t=25818

eac3to µGUI:
http://www.homecinema-hd.com/index.p...gui&lang=en_US

links:

arcsoft: http://www.arcsoft.com
dcadec: https://github.com/foo86/dcadec
nero: http://www.nero.com
sonic: http://www.sonic.com
dts: http://www.surcode.com
libav: http://www.mplayerhq.hu
aften: http://win32builds.sourceforge.net/aften/index.html
flac: http://sourceforge.net/project/showf...ckage_id=12675
r8brain: http://www.voxengo.com/product/r8brain
haali: http://haali.cs.msu.ru/mkv
mkvtoolnix: http://www.bunkus.org/videotools/mkvtoolnix

WARNING:

Nero 8 won't work for eac3to cause Nero 8 doesn't allow its DirectShow filters to be used from outside of Nero ShowTime. Nero 9 is currently not supported, either. So please use/install Nero 7 if you want to use Nero DirectShow filters in eac3to.

background information:

Please note that there are three common problems with "properly" decoding compressed audio tracks. The first problem has to do with that the purpose of a media player is different than the purpose of people like us who want to reencode audio tracks. A media player may want to adjust volume levels to specific parameters and circumstances. We reencoders absolutely want to avoid any processing on the precious audio data. This is a conflict which can not always be solved. The three known problems are:

(1) Some decoders apply DRC (Dynamic Range Compression). Stupidly Dolby's license requests that DRC must be applied, unless your decoder has an option to turn it on/off. Only then the decoder is allowed to not apply DRC. The purpose of DRC is to limit the dynamic range of an audio track, mainly to not annoy neighbours or to accomodate to noisy living room conditions. For our purposes DRC is catastrophic.
(2) Some decoders forcefully downconvert to 16bit, or raise volume for unknown reasons or do other stupid stuff.
(3) Some decoders don't make use of the full available information, but just extract and decode the "core" of the compressed audio data, which obviously results in less than optimal audio quality.

evaluation of available decoders:

The Sonic (E-)AC3 decoder forcefully applies DRC. As a result I do not recommend to use the Sonic (E-)AC3 decoder. The current version of the Sonic TrueHD decoder doesn't work properly at all. The Sonic DTS decoder is good for DTS, DTS-ES, DTS-96/24, DTS-HD Master Audio and DTS-HD High Resolution tracks. It's quite slow, though and it decodes DTS-HD 7.1 tracks only as 5.1. Most DTS-ES and DTS-HD Master Audio 6.1 tracks are fully decoded as 6.1, though. The Nero TrueHD decoder is working perfectly fine, but is limited to 5.1 channels. The Nero (E-)AC3 works fine for most audio tracks, but sometimes DRC is still enabled, so it's not really recommended. The Nero DTS decoder ignores the additional DTS-HD information and only decodes the DTS core. The Cyberlink decoders always only output 16bit and can't be used outside of PowerDVD. So they currently do not make a lot of sense for eac3to. The libav/ffmpeg (E-)AC3 decoder works really well, but don't support 7.1 decoding yet. The libav/ffmpeg DTS decoder works well, too, but currently ignores the additional DTS-HD information, so especially DTS-HD Master Audio can't be decoded in full quality. The libav/ffmpeg TrueHD decoder works perfectly fine including full 7.1 decoding. The ArcSoft DTS decoder works well for DTS and DTS-HD decoding, but decodes many 7.1 tracks either incorrectly or with forced processing/mixing. It does support every format and channel configuration, though. The ArcSoft TrueHD and ArcSoft (E-)AC3 decoders are currently not supported by eac3to. The dcadec decoder works great for all kinds of DTS formats and channel configurations, except LBR/XSA (low bitrate) content is not properly supported yet.

default decoders used by eac3to:

AAC: Nero
MP1, MP2, MP3: libav/ffmpg
(E-)AC3: libav/ffmpeg
TrueHD: libav/ffmpeg
DTS(-HD): dcaDec
DTS-LBR/XSA: ArcSoft

making the ArcSoft DTS decoder work in eac3to:

Sometimes the ArcSoft DTS decoder doesn't work even after you've installed the full retail software. This can usually be fixed by manually adding the ArcSoft "Bin" folder (e.g. "C:\Program Files\Common Files\ArcSoft\Bin") to your environment path. If you don't know how to do this, google "environment path".

Don't ask for pirated versions of ArcSoft, Nero, Sonic and Surcode. You should buy those.

EDIT (2016-02-13) by tebasuna51:
In addition to eac3to audio outputs: PCM, AC3 (libAften), DTS (Surcode), AAC (NeroAacEnc M4A) and FLAC (libFLAC), you can use the eac3to stdout to pipe PCM to any encoder than support stdin.

Generic syntax:

eac3to INPUT stdout.wav [-EAC3TO_PARAMETERS] | ENCODER PARAMETERS - OUTPUT

Where:
- INPUT, ENCODER and OUTPUT must be in quotted full paths if aren't at same folder than eac3to.
- INPUT can be any supported audio file or a track from a supported container: "D\tmp\input.mkv" 2:
- PARAMETERS can be any supported encoder parameters.
- The order of: PARAMETERS - OUTPUT, can be different for some encoders. See examples below.

You can use also Aften.exe, NeroAacEnc.exe and Flac.exe encoders to override eac3to defaults.
Also you can use other soft to filter output: eac3to INPUT stdout.wav | sox ... | encoder ...
Some tested examples:

eac3to INPUT stdout.wav | Lame -V 2 - output.mp3
eac3to INPUT stdout.wav | TwoLame -b 192 - output.mp2 (Twolame v0.3.10b)
eac3to INPUT stdout.wav | ffdcaenc -i - -o output.dts -l -b 1509.75
eac3to INPUT stdout.wav | OggEnc2 -q 3 --ignorelength -o output.ogg -
eac3to INPUT stdout.wav | opusenc --ignorelength --bitrate 128 - output.opus
eac3to INPUT stdout.wav | qaac -V 99 --ignorelength --adts --no-delay -o output.aac -
eac3to INPUT stdout.wav | fhgaacenc --vbr 5 --ignorelength - output.m4a
eac3to INPUT stdout.wav | NeroAacEnc -br 192000 -he -ignorelength -if - -of output.m4a
eac3to INPUT stdout.wav | Flac -5 --ignore-chunk-sizes -o output.flac -
eac3to INPUT stdout.wav | Aften -b 640 -pad 0 -readtoeof 1 -exps 32 -s 1 - output.ac3
eac3to INPUT stdout.w64 | ffmpeg -i - -c:a ac3 -b:a 640k -center_mixlev 0.707 output.ac3

Note than last ffmpeg example require PCM data with w64 header, the other encoders support wav data greater than 4GB with special parameter -ignorelength or equivalent.
Of course ffmpeg can be used for other supported audio output format.

Last edited by tebasuna51; 13th February 2016 at 13:12. Reason: Add info
madshi is offline   Reply With Quote
Old 18th May 2007, 14:39   #2  |  Link
twan69666
Registered User
 
Join Date: Mar 2007
Location: East Lansing, MI
Posts: 34
Awesome, we've needed a separte thread for a while. Cant wait to play with some TrueHD tracks! Thanks for all the hard work Madshi
twan69666 is offline   Reply With Quote
Old 18th May 2007, 14:58   #3  |  Link
Darth Pinous
Registered User
 
Darth Pinous's Avatar
 
Join Date: Feb 2007
Location: In a galaxy far, far away
Posts: 51
Thanks for the tool.

It's good to know that it's finally possible to convert TrueHD.
As I've been playing around with Nero these past days, could you tell what sort of working graph permit the decoding of TrueHD ?
Is it Nero Splitter -> Nero Audio Decoder 2 ?
Do you need to specify anything in the Nero Audio Decoder 2 options ?
Darth Pinous is offline   Reply With Quote
Old 18th May 2007, 15:05   #4  |  Link
madshi
Registered Developer
 
Join Date: Sep 2006
Posts: 8,858
I'm using this graph:

"Nero File Source (Async) -> Nero Splitter -> Nero Audio Decoder 2 -> Dump"

You need to rename GraphEdt.exe to Recode.exe, otherwise the filters won't connect. I didn't change anything in the audio decoder settings. Make sure you have the "Remix" mode set to "None", though, otherwise the audio decoder might mess around with the audio data.
madshi is offline   Reply With Quote
Old 18th May 2007, 15:35   #5  |  Link
Kurtnoise
Swallowed in the Sea
 
Kurtnoise's Avatar
 
Join Date: Oct 2002
Location: Aix-en-Provence, France
Posts: 5,182
Why the Nero filters are needed ? The Haali Media Splitter is not appropriate for this task ?
Kurtnoise is offline   Reply With Quote
Old 18th May 2007, 15:57   #6  |  Link
madshi
Registered Developer
 
Join Date: Sep 2006
Posts: 8,858
The Haali Media Splitter doesn't "export" the TrueHD track. And even if it did, we'd still need the Nero Audio Decoder for TrueHD decoding. Haali's Media Splitter isn't decoding, of course, it's only splitting.

One thing I just found out is confusing me quite a lot:

The TrueHD track I was testing (Vendetta) is supposed to be 48kHz 16bit. The Nero Audio Decoder always outputs 24bit. Ok, so I thought I could simply convert that to 16bit without any loss. However, I've just checked: If I convert the 24bit Nero output to 16bit and then back to 24bit, the result is different to the original. It seems that there's more than 16bit real information in the Nero output. But the TrueHD track is only 16bit! I don't quite understand this. My only explanation would be that the Nero audio decoder does some processing on the decoded data, e.g. volume adjustment or something like that. That's kind of bad, though, since that means that converting to 16bit may end up harming the audio quality. But keeping 24bit *significantly* increases the final FLAC file size. Arghh.......
madshi is offline   Reply With Quote
Old 18th May 2007, 16:26   #7  |  Link
zgx
Registered User
 
Join Date: Feb 2007
Posts: 94
Awesome work with TrueHD!

We just need to figure out the 24/16 bit thingy. As you say you don't want to harm the audio but at the same time you don't want your FLAC files to be larger then they need to be.

zgx is offline   Reply With Quote
Old 18th May 2007, 16:46   #8  |  Link
Rectal Prolapse
Registered User
 
Join Date: Mar 2005
Posts: 429
Perhaps this can be modified to work with Blu-ray m2ts files, at least for Blu-ray TrueHD tracks?

Anyways - great work!
Rectal Prolapse is offline   Reply With Quote
Old 18th May 2007, 18:04   #9  |  Link
Neo Fagin
Mmmmmmmmangoscam!
 
Neo Fagin's Avatar
 
Join Date: Sep 2006
Posts: 51
Unfortunately, 64k 1.0 eac3 (Dog Day Afternoon) is still unsupported when using Sonic. Is this a limitation of Sonic's decoder?
Neo Fagin is offline   Reply With Quote
Old 18th May 2007, 18:18   #10  |  Link
madshi
Registered Developer
 
Join Date: Sep 2006
Posts: 8,858
Mono files are not supported by eac3to, simply because I don't have such a file for testing. If you can send me the first 5MB of an eac3 mono file, I can probably add support for that, I guess.

About m2ts: Probably Nero supports that, too. But again I need a sample file. If you can get me a m2ts file with only TrueHD in it and no video (e.g. by using the Transport Stream Remuxer), 5MB should be enough.
madshi is offline   Reply With Quote
Old 18th May 2007, 18:40   #11  |  Link
Rectal Prolapse
Registered User
 
Join Date: Mar 2005
Posts: 429
madshi, do you know if TrueHD is decoded in Stereo only or multichannel? Damn, I should have asked before I bought the decoder pack.
Rectal Prolapse is offline   Reply With Quote
Old 18th May 2007, 19:07   #12  |  Link
madshi
Registered Developer
 
Join Date: Sep 2006
Posts: 8,858
Definitely in multichannel. All 5.1 channels have valid information in them. Even more so than I'd like... (see problem I explained above with 24 -> 16 -> 24 conversion)
madshi is offline   Reply With Quote
Old 18th May 2007, 20:27   #13  |  Link
Neo Fagin
Mmmmmmmmangoscam!
 
Neo Fagin's Avatar
 
Join Date: Sep 2006
Posts: 51
Quote:
Originally Posted by madshi View Post
Mono files are not supported by eac3to, simply because I don't have such a file for testing. If you can send me the first 5MB of an eac3 mono file, I can probably add support for that, I guess.
http://www.sendspace.com/file/5ahu3b

a 5MB sample of a mono file
Neo Fagin is offline   Reply With Quote
Old 18th May 2007, 20:29   #14  |  Link
Rectal Prolapse
Registered User
 
Join Date: Mar 2005
Posts: 429
Thanks madshi! I just realized that when I look at filter properties (in GraphEdit) it always says the audio is 2 channel PCM, even when it isn't.
Rectal Prolapse is offline   Reply With Quote
Old 18th May 2007, 20:37   #15  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 5,189
Quote:
Originally Posted by madshi View Post
The TrueHD track I was testing (Vendetta) is supposed to be 48kHz 16bit.
For what 16 bit?

BitDepth have no sense with encoded audio in frequency domain.
In the document 'Digital Audio Compression Standard (AC-3, E-AC-3) Revision B' say:
"8.2.1.1 Input Word Length
The AC-3 encoder accepts audio in the form of PCM words. The internal dynamic range of AC-3 allows input wordlengths of up to 24 bits to be useful."

Then if a input of 24 bits is appropriate for ac3 encoder also the output can be 24 bits.

Edit: and Aften accept 24 bits input without problem.

Last edited by tebasuna51; 18th May 2007 at 20:44.
tebasuna51 is offline   Reply With Quote
Old 18th May 2007, 21:41   #16  |  Link
madshi
Registered Developer
 
Join Date: Sep 2006
Posts: 8,858
Quote:
Originally Posted by tebasuna51 View Post
For what 16 bit?

BitDepth have no sense with encoded audio in frequency domain.
In the document 'Digital Audio Compression Standard (AC-3, E-AC-3) Revision B' say:
"8.2.1.1 Input Word Length
The AC-3 encoder accepts audio in the form of PCM words. The internal dynamic range of AC-3 allows input wordlengths of up to 24 bits to be useful."

Then if a input of 24 bits is appropriate for ac3 encoder also the output can be 24 bits.

Edit: and Aften accept 24 bits input without problem.
You are correct - but only when talking about (E-)AC3. Things are totally different with TrueHD. TrueHD is a lossless codec. That means, it takes 16bit, 20bit or 24bit input data and does *NOT* convert that into frequency domain (doing that wouldn't be lossless), but simply compresses the audio data similar to how ZIP works. So if you feed e.g. a 16bit track into the TrueHD encoder and if you then feed the encoded data into a TrueHD decoder, you should get a perfect 1:1 copy of the original data out of the decoder.
madshi is offline   Reply With Quote
Old 18th May 2007, 22:00   #17  |  Link
shon3i
BluRay Maniac
 
shon3i's Avatar
 
Join Date: Dec 2005
Posts: 2,426
Any chance to implement stdout, so we can use in BeHappy or other 3rd party app as decoder?
shon3i is offline   Reply With Quote
Old 18th May 2007, 22:17   #18  |  Link
madshi
Registered Developer
 
Join Date: Sep 2006
Posts: 8,858
Quote:
Originally Posted by Neo Fagin View Post
http://www.sendspace.com/file/5ahu3b

a 5MB sample of a mono file
Here's version 1.6 with mono E-AC3 support:

http://madshi.net/eac3to.zip

Please note that Sonic's audio decoder crashes with mono E-AC3 files. Nero's audio Decoder works fine, though. So eac3to automatically switches to Nero, if you feed it a mono file. I think for E-AC3 decoding you don't need the HD-DVD/Blu-Ray plugin, btw. That plugin is only needed for TrueHD decoding, if I'm not mistaken.
madshi is offline   Reply With Quote
Old 18th May 2007, 22:23   #19  |  Link
madshi
Registered Developer
 
Join Date: Sep 2006
Posts: 8,858
Quote:
Originally Posted by shon3i View Post
Any chance to implement stdout, so we can use in BeHappy or other 3rd party app as decoder?
Which format would I have to output to stdout to make BeHappy happy? Raw or Wav? Or something else? What you can do right now is to ask eac3to to decode to a WAV file. You can then use this WAV file in BeHappy. The main problem is that eac3to doesn't directly receive the data from the decoders. Instead eac3to asks the decoders to dump the output into a file (and there's no way for me to change that). So the raw decoded data must be written to a file first, anyway. No way around that. Of course, once that raw file is written, eac3to could open and read it and feed it into stdout. Or eac3to could first ask Sox.exe to convert the raw file into a wav and feed *that* file to stdout. But I'm wondering how much would be won by doing that.
madshi is offline   Reply With Quote
Old 18th May 2007, 22:50   #20  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 5,189
@madshi
Sorry by my previous post, I was thinking in ac3 of course.

@shon3i
For BeHappy we need AviSynth plugin decoders, stdout is useless.
But maybe we can open graph filter files (.grf) with DirectShowSource().
tebasuna51 is offline   Reply With Quote
Reply

Tags
eac3to

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 12:42.


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