# Eac3to/How to Use
## Software needed to run eac3to

Taking the most out of eac3to involves using several external filters. These can be audio decoders and encoders or media splitters and muxers. As eac3to puts quality on top, it uses the best audio decoders available, but since most of them are commercial software, there also freeware alternatives (usually of lower sound quality though). Depending on what is the user's goal more or less of the filters below are needed. Evaluation of them is based on the comprehensive testing of the Doom9 forum members.

### Audio Decoders

AC3 decoding can be achieved through:
* Nero 7 (version 7.8.5.0 or newer, Nero 8 won't work) accompanied with Nero Blu-ray / HD DVD plugin (commercial software)
* libav / ffmpeg decoder (freeware, ships with eac3to package)
* Nero7 uses Dolby's reference code and therefore should offer better sound quality over Libav / ffmpeg.
* As a result Nero7 is the default decoder for AC3 format.
* However, EAC3To's Nero 7 EAC3/AC3 Decoder is INCAPABLE of removing Dynamic Range Compression (DRC) and is generally considered the worst of the two options!
E-AC3 decoding can be achieved through:
* Nero 7 (version 7.8.5.0 or newer, Nero 8 won't work) accompanied with Nero Blu-ray / HD DVD plugin (commercial software)
* Libav / ffmpeg decoder (freeware, ships with eac3to package)
* Nero7 uses Dolby's reference code and therefore should offer better sound quality over Libav / ffmpeg.
* Libav / ffmpeg would be the only one that can decode 7.1 channel audio tracks (this feature is not yet implemented though, as the decoder is still under development).
* Nero7 is the default decoder for E-AC3 format.
TrueHD decoding can be achieved through:
* Nero 7 (version 7.8.5.0 or newer, Nero 8 won't work) accompanied with Nero Blu-ray / HD DVD plugin (commercial software)
* Libav / ffmpeg decoder (freeware, ships with eac3to package)
* Both decode bit perfect. Nero7 is limited to 5.1 while Libav / ffmpeg can output up to 7.1 channels. However Libav is unable to decode files with mixed sampling rates (i.e. 96 kHz for Lf-Rf-C and 48 kHz for LFE-Ls-Rs).
* Libav / ffmpeg is chosen as the default decoder for TrueHD.
DTS decoding can be achieved through:
* Nero 7 (version 7.8.5.0 or newer, Nero 8 won't work) accompanied with Nero Blu-ray / HD DVD plugin (commercial software)
* Libav / ffmpeg decoder (freeware, ships with eac3to package)
* "Sonic Cinemaster Audio Decoder 4.3" DirectShow filter (commercial software)
* ArcSoft TotalMedia Theatre (commercial software)
* Nero7 and Libav / ffmpeg are limited to 5.1 channel decoding.
* Sonic may or may not output 6.1 channels depending on the source track.
* ArcSoft doesn't have any limitation, therefore it is the default decoder used.
DTS-HD decoding can be achieved through:
* "Sonic Cinemaster Audio Decoder 4.3" DirectShow filter (commercial software)
* ArcSoft TotalMedia Theatre (commercial software)
* Both decode bit-perfect. Sonic is limited to 5.1 or 6.1 channels depending on the source track, while ArcSoft can output up to 7.1 channels.
* As a result ArcSoft is the default decoder for DTS-HD.
FLAC decoding can be achieved through the official Free Lossless Audio Codec (ships with eac3to package)

### Audio Encoders

* For AC3 encoding Aften - A/52 Audio Encoder is needed. (freeware, ships with eac3to package)
* For DTS encoding SurCode DVD DTS (version 1.0.21 or newer) is needed. (commercial software)
* For FLAC encoding Free Lossless Audio Codec is needed. (freeware, ships with eac3to package)
* For AAC encoding Nero AAC Encoder is needed. (freeware, no longer available - only as external download)

### Splitters and Muxers

* For Matroska muxing, Haali Matroska Muxer is needed (it's part of Haali Media Splitter package).

## Command Line Syntax

There are basically 3 ways to use eac3to depending on the input file(s): 1. audio or video file, 2. Container file or 3. Disc folder.

### Using audio or video files as input

In this category we deal with inputs like simple audio files (AC3, TrueHD, DTS-HD, WAV, etc.) or simple video files (e.g. raw H.264, VC-1 or MPEG-2 streams). In this case the command line will look like this:
eac3to input.file+input.file.2 output.file -options
* input.file ~ It's the file to be processed. eac3to can accept various audio formats like RAW, (L)PCM, WAV (PCM only), W64 (like WAV without the 4 GB limit), RF64 (like W64), AC3, E-AC3, DTS, DTS-ES, DTS-96/24, DTS-HD Hi-Res, DTS-HD Master Audio, MLP, TrueHD, TrueHD/AC3, FLAC, video formats like VC-1, H.264, MPEG-2.
* +input.file.2 ~ Multiple input files (of the same format) are accepted. This is useful when the input file is split among several parts. Use the + symbol to add more.
* output.file ~ This is the output file that eac3to will create. It could be an audio format like RAW, (L)PCM, WAV (PCM only), WAVs (multiple mono WAV files, PCM only), W64, RF64, AC3, DTS, FLAC, video format like VC-1, H.264, MPEG-2 or Matroska (MKV) container. eac3to can also output audio (only) data to stdout for further processing by other applications.
* -options ~ Here you can set the options that tell eac3to how to operate. Not all of them are applicable to all input / output formats. If none set, the default is used when necessary. When using an audio or video file as input, the following options are available:
| Switch | Input file must be | Output file must be | Use to... |
| -192, -224, -384, -448, -640 | any audio format | AC3 | set a bitrate of 192..448 (default for stereo)..640 (default for 5.1) kb/s for AC3 encoding |
| -768, -1536 | any audio format | DTS | set a bitrate of "768" or "1536" (default value) kbps for DTS encoding |
| -core | DTS-HD or TrueHD | DTS or AC3 | extract the DTS core of a DTS-HD track or the AC3 core of a TrueHD track |
| ±100ms | any audio format | any audio format | apply a positive or negative delay |
| -edit=0:00:00.000,0ms | any audio format | any audio format | loops or removes audio data at the specified runtime |
| -silence/-loop | any audio format | any audio format | forces usage of silence (or looping) for audio edits |
| +3dB, -3dB | any audio format | any audio format | apply an arbitrary positive or negative audio gain (volume change) |
| -normalize | any audio format | any audio format | gain output to 0 dB (2 pass) |
| -0,1,2,3,4,5 | any audio format | any audio format | remap channels to the specified order |
| -mono | any audio format | any audio format | decode only Center channel (Left if stereo) |
| -double7 | any 6.1 audio track | any audio format | upmix 6.1 to 7.1 (duplicate Back Center) |
| -down6 | any 6.1 or 7.1 audio track | any audio format | downmix 7 or 8 channels to 6 channels |
| -downDpl | any audio format | any audio format | downmix multichannel audio to stereo (Dolby Pro Logic II) |
| -downStereo | any audio format | any audio format | downmix multichannel audio to stereo (Simple) |
| -phaseShift | any multichannel audio format | any audio format | shift phase of surround channels(when doing stereo downmix) |
| -mixlfe | any .1 audio format | any audio format | mix LFE in (when doing stereo downmixing, see here) |
| -down16 | any audio format | any audio format | downconvert decoded audio data to 14..23 bit |
| -full | any audio format | any audio format | outputs audio as 64-bit floating point PCM |
| -simple | any audio format | WAV | use simple header instead WAVE_FORMAT_EXTENSIBLE |
| -99mb | any format | any format | stop conversion after reach x MB of input file |
| -changeTo24.000 | any format | any format | change source fps to "23.976", "24.000", "25.000", ... |
| -23.976/... | any format | any format | define source fps to be "23.976", "24.000", "25.000", ... |
| -slowdown | any format | any format | reverse PAL speedup (25.000 -> 24.000/1.001 fps) |
| -speedup | any format | any format | apply PAL speedup (24.000/1.001 -> 25.000 fps) |
| -resampleTo48000 | any audio format | any audio format | resample audio to "44100" Hz, "48000" Hz, "88200" Hz or "96000" Hz |
| -r8brain | any audio format | any audio format | Use r8brain to resample instead default SSRC |
| -quality=0.35 | any audio format | M4A / MP4 | Nero AAC encoding quality (0.00=lowest; 1.00=highest) (default: 0.5) |
| -decodeHdcd | HDCD source | any audio format | decodes HDCD source track (usually 16 -> 20 bit) |
| -8 | LPCM / RAW | any audio format | PCM / RAW file has 1..8 channels |
| -8 | DTS / DTS-HD | any audio format | requests that the ArcSoft decoders output 2, 6, 7, or 8 channels of audio, using the decoder's internal mixing |
| -16 / -24 | LPCM / RAW | any audio format | PCM / RAW file is "16" or "24" bit |
| -little / -big | LPCM / RAW | any audio format | PCM / RAW file is "little" or "big" endian |
| -48000 | LPCM / RAW | any audio format | PCM / RAW file is "44100" Hz, "48000" Hz, "88200" Hz, "96000" Hz or "192000" Hz |
| -override | LPCM / RAW | any audio format | forcefully override LPCM / RAW auto detection with manual values |
| -sonic / -nero / -libav / -arcsoft | any compressed audio format | any audio format | force the use of a specific decoder (not recommended) |
| -keepDialnorm | AC3, E-AC3, TrueHD, MLP ??? | any audio format | disable dialog normalization removal (not recommended) |
| -no2ndpass | | | turns off 2nd pass processing |
| -logdts | DTS | | display detailed info about DTS track |
| -dontPatchDts | | | disable 16bit->24bit patching. 16-bit DTS-HD tracks will be dithered from 24 bit to 16 bit by decoder |
| -keepPulldown | VC-1, H.264, MPEG-2 | same as input or MKV | disable removal of pulldown for MPEG2, h264 and VC-1 tracks (not recommended) |
| -skip2 | VC-1, H.264 ??? | same as input ??? or MKV | skips the first 1..99 VC-1 sequence headers |
| -seekToIFrames | H.264 | MKV | make all H.264 / AVC "I" frames seekable |
| -check | EVO, M2TS, TS | none | checks if the source EVO, M2TS, TS file is clean |
| -test | | | checks if the external filters are installed & working properly |
| -progressnumbers | | | outputs one new line to the command window for every progress (for GUIs). |
| -lowPriority | | | moves processing to background/idle priority |
| -shutdown | | | automatically shutdown the PC after processing is done |
| -log="filename.txt" | | | Writes output log to specified filename |
Examples
* Convert an AC3 track to a 384 kbps AC3 one, using Nero AC3 decoder (default) and Aften AC3 encoder:
    eac3to input.ac3 output.ac3 -384
* Convert an E-AC3 track to a 1536 kbps DTS one, using Nero E-AC3 decoder (default) and Surcode DTS encoder:
    eac3to input.eac3 output.dts
* Convert a DTS-HD Master Audio track to a FLAC one, using ArcSoft DTS-HD decoder (default) and FLAC encoder:
    eac3to input.dtshd output.flac
* Convert a DTS track to a AC3 one, using libav encoder:
    eac3to input.dts output.ac3 -libav
* Convert a TrueHD track to a 640 kbps AC3 one, using Nero TrueHD decoder (non default) and Aften AC3 encoder:
    eac3to input.thd output.ac3 -nero
* Decode a 24 bit 96 kHz MLP track using MLP libav / ffmpeg decoder (default), downsample it to 16 bit 44.1 kHz and output data to stdout (e.g. for encoding to MP3, ACC or OGG format):
    eac3to input.mlp output.stdout -down16 -resampleTo44100
* Extract the DTS core of a DTS-HD track:
    eac3to input.dtshd output.dts -core
* Extract the AC3 core of a TrueHD track:
    eac3to input.thd output.ac3 -core
* Delay an E-AC3 track by +178ms:
    eac3to input.eac3 output.eac3 +178ms
* Reverse PAL speedup to an E-AC3 track and convert it to a 192 kbps AC3 one, using Nero E-AC3 decoder (default) and Aften AC3 encoder:
    eac3to input.eac3 output.ac3 -slowdown -192
* Convert a 16 bit 48 kHz 5.1 LPCM track to 6 mono WAV tracks, when eac3to detects the LPCM track parameters automatically:
    eac3to input.pcm output.wavs
* Convert a 16 bit 48 kHz 5.1 LPCM track to 6 mono WAV tracks, when eac3to can't figure out the LPCM track parameters (manual setting is necessary):
    eac3to input.pcm output.wavs -override -16 -48000 -6 -little
* Convert a Blu-ray 7.1 PCM track to a 5.1 640 kbps AC3 one, using Aften AC3 encoder:
    eac3to input.pcm output.ac3 -down6
* Multiplex a VC-1 video stream to MKV container while removing the pulldown flags (default behavior):
    eac3to input.vc1 output.mkv
* Multiplex an H.264 video stream to MKV container while keeping the pulldown flags:
    eac3to input.h264 output.mkv -keeppulldown

### Using container files as input

These files contain one or more audio and video streams (tracks). By setting such file as input, eac3to can list all streams inside and give numbers (stream/track number) to each one. This way the user can explicitly set which stream wants to process. eac3to command line will look like this:
eac3to input.file+input.file.2 trackno: output.file -options trackno: output.file -options
* input.file ~ Container inputs can only be in EVO, M2TS, TS and VOB format.
* +input.file.2 ~ Multiple input files (of the same format) are accepted. This is useful when the input file is split among several parts (e.g. a set of 2 main movie EVO files in a HD DVD or 2 or more M2TS parts of a seamless branching Blu-ray Disc). Use the + symbol to add more. With Blu-ray Disc we can use also like input the .mpls files in PLAYLIST folder.
* output.file ~ This is the output file that eac3to will create. It could be an audio format like RAW, (L)PCM, WAV (PCM only), WAVs (multiple mono WAV files, PCM only), W64, RF64, AC3, DTS, FLAC, video format like VC-1, H.264, MPEG-2 or Matroska (MKV) container. eac3to can also output audio (only) data to stdout for further processing by other applications.
* trackno: ~ It applies only to container source files and refers to the tracks/streams inside them.
* -options ~ Here you can set the options that tell eac3to how to operate. Not all of them are applicable to all input / output formats. If none set, the default is used when necessary.
The logic behind this is simple: Using the various streams inside the container as source, eac3to can output one or more of them to their original or not format. Here rises the question: How can i choose the stream i want? This can be done using the stream/track numbers (e.g. 3: ). The output files can be from all audio and video formats that have been used in the previous case. All options listed in the previously plus the following can be used when we are dealing with container inputs:
| Switch | Input file must be | Output file must be | Use to... |
| -demux | EVO, VOB, M2TS, TS (any container) | not applicable | demux main (1st) video track and all audio tracks |
To get an idea how the stream/track list looks like when we feed eac3to with container files will use the 2 main movie EVO files of an HD DVD. Running eac3to FEATURE_1.EVO+FEATURE_2.EVO we get:
Here we are informed of all video, audio and subtitle stream inside our source files. To process one of them we just have to add the appropriate number before the output file, like this: eac3to eac3to FEATURE_1.EVO+FEATURE_2.EVO 3: audio.dts
In the following examples various containers are used as source and we have already obtain the stream numbers.
* Demux 1st video track and all audio tracks of a set of two HD DVD EVO files:
    eac3to feature1.evo+feature2.evo -demux
* Demux the H.264 video stream [id 2] of a blu-ray M2TS file:
    eac3to 00001.m2ts 2: video.h264
* Demux the VC-1 video stream [id 2], TrueHD audio track [id 3] and E-AC3 audio track [id 5] of a 3 part seamless branching Blu-ray movie (files 00001.m2ts, 00002.m2ts and 00003.m2ts) to the specified directories:
    eac3to 00001.m2ts+00002.m2ts+00003.m2ts 2: c:\folder\video.vc1 3: c:\folder\audio1.thd 5: d:\folder1\folder2\audio2.eac3
* Convert 1st video track of an EVO file to MKV, convert all lossless audio tracks to FLAC and demux all compressed audio tracks at once:
    eac3to input.evo output.mkv
* Convert an HD DVD video stream [id 2] (set of two EVO files) to MKV and also convert a DTS-HD audio track [id 4] to a FLAC one:
    eac3to feature1.evo+feature2.evo 2: video.mkv 4: audio.flac
* Convert an HD DVD VC-1 video stream [id 3] (set of two EVO files) to MKV while skipping the first 3 erroneous sequence headers, convert a TrueHD audio track [id 4] to a FLAC one while downconverting it from 24 bit to 16 bit and convert an E-AC3 audio track [id 5] to a 768 kbps DTS one using libav / ffmpeg E-AC3 decoder (non default):
    eac3to feature1.evo+feature2.evo 3: video.mkv -skip3 4: audio1.flac -down16 5: audio2.dts -768 -libav

### Using complete disc structure as input

This is the most exciting possibility of eac3to and requires complete disc structure, like HD DVD or Blu-ray Disc. Why is exciting? Because we get the correct playback order of the numerous M2TS parts (seamless branching Blu-ray Discs) automatically. Also we get additional info like chapters and subtitle and audio track languages.
It takes 3 steps: 1. Read the root folder of the disc. This way you get a list of all available titles/playlists in the disc. 2. Select the appropriate title/playlist. This actually means you select the actual files (containers) to process. 3. Convert/edit and output the streams inside the container to a different format.
As examples we 'll use an HD DVD (Galapagos) and a Blu-ray Disc (Rambo IV), both ripped to the hard disc.
STEP 1: By typing eac3to "G:\Galapagos HD DVD 1080p VC-1 DD 2.0" the title playlist of the disc is generated.
STEP 2: By adding the title number you want, the above command changes to eac3to "G:\Galapagos HD DVD 1080p VC-1 DD 2.0" 3) and the stream/track list of the specific title is generated.
STEP 3: Finally, choose the tracks that are going to be processed and output like this:eac3to "G:\Galapagos HD DVD 1080p VC-1 DD 2.0" 3) 2: galapagos.ep2.chapters.txt 3: galapagos.ep2.mkv 4: galapagos.ep2.ac3 5: galapagos.ep2.sup
Now, let's try the Blu-ray disc. This is a seamless branching disc and reveals eac3to's power:
STEP 1: By typing eac3to "F:\Rambo IV 2008 Blu-ray 1080p H.264 DTS-HD MA 7.1" the title playlist of the disc is generated.
STEP 2: By adding the title number you want, the above command changes to eac3to "F:\Rambo IV 2008 Blu-ray 1080p H.264 DTS-HD MA 7.1" 1) and the stream/track list of the specific title is generated (note: not always the title with the longer runtime is the main movie).
STEP 3: Finally, choose the tracks that are going to be processed and output like this: eac3to "F:\Rambo IV 2008 Blu-ray 1080p H.264 DTS-HD MA 7.1" 1) 1: c:\rambo\rambo.chapters.txt 2: c:\rambo\rambo.mkv 4: c:\rambo\rambo.flac 4: c:\rambo\rambo.dts -core 5: c:\rambo\rambo.comm.ac3

## Recommended & Not Recommended Conversions

This is some basic advice on what audio conversion should and shouldn't be done. Generally, dealing with movie audio requires 4 things to have in mind:
* What is the original (source) format?
* How much space do you have to consume?
* How will the audio be transmitted to the receiver/speakers?
* Do you own an expensive high fidelity home cinema system?
Usually, people convert lossless audio tracks to FLAC, high bitrate lossy tracks (e.g. 1536 kbit/s E-AC3 and DTS-HD Hi Res) to 640 kbit/s AC3 or 1536 kbit/s DTS, and lower bitrate lossy tracks to 448 kbit/s AC3 audio or 768 kbit/s DTS. Of course, when both lossless and lossy audio tracks are available for a movie, it is recommended that the lossless track should be used as the source file for the new audio creation. Another thing to have in mind is whether the audio will be passed through HDMI, S/PDIF, or analog connection. AC3 & DTS can be transmitted through S/PDIF, unlike FLAC, which makes them very popular.