Personal tools

AC3Filter tools

From AC3Filter
Revision as of 12:31, 6 April 2013 by Valex (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

AC3Filter tools is a set of command-line tools for manipulating audio files. It includes AC3 encoder and decoder, SPDIF format converter, parametric filter, graphic equalizer and more.



Command-line parameters in Unicode

Now tools support command-line parameters in unicode. To utilize this feature in Windows batch files you may use the following method.

Create a batch file in UTF-8 encoding without BOM. Windows notepad cannot do this! Use Notepad++ or similar program:

UTF-8 batch file.png

At the start of the file place the string 'chcp 65001'. This will instruct the interpreter that file is UTF-8 encoded. Example of the batch file:

chcp 65001
valdec.exe -i "English - Русский - Français - العربية - 中文.ac3"

If you forgot to remove BOM (or used Windows notepad), you will see an error like:

d:\ac3filter\work\tools>я╗┐valdec.exe -i "English - ╨а╤Г╤Б╤Б╨║╨╕╨╣
- Fran├зais - ╪з┘Д╪╣╪▒╪и┘К╪й - ф╕нцЦЗ.ac3"
The system cannot find the path specified.

This may be confusing because it looks like interpreter cannot find valdec.exe itself. But you may see 'я╗┐' at the beginning of the command; it is BOM, that is considered as a part of the file name.


Simple AC3 encoder tool. It takes a WAV file at input and makes AC3 file. WAV file must have PCM format (16/24/32bit and floating point formats are supported). Multi-channel WAV files are supported (for example, files generated by valdec utility, see below).

Example: encode input.wav file into output.ac3 with 448kbps bitrate

 > ac3enc input.wav output.ac3 -br:448000


Bitstream converter utility. This utility converts files between numerous MPA/AC3/DTS stream types: SPDIF padded, 8/14/16bit big/low endian. By default, it converts any stream type to the most common byte stream.

Example: detect and print actual file format:

 > bsconvert file.dts

Example: convert AC3/WAV file (multi-channel AudioCD format) to usual AC3 file:

 > bsconvert track1.wav track1.ac3

Example: convert DTS file to 14bit format:

 > bsconvert input.dts output.dts 14le


Simple graphic equalizer.

Example: Attenuate frequencies below 100Hz by 6dB, gain the band with the center at 200Hz by 3dB and leave everything after 500Hz unchanged.

 > equalizer a.wav b.wav -f1:100 -g1:-6 -f2:200 -g2:3 -f3:500


Simple parametric filter.

Example: Band-pass filter from 100Hz to 8kHz with transition width of 100Hz. Attenuate all other frequencies (0-50Hz and 8050Hz to nyquist frequency) by 100dB.

 > filter in.wav out.wav -bandpass -f:100 -f2:8000 -df:100 -a:100

Example: Low-pass half of the total bandwidth with 1% transition bandwidth. Note, that in normalized form nyquist frequency is 0.5 (not 1.0!), so half of the bandwidth is 0.25 and 1% of the bandwidth is 0.005. For 48kHz input, this means low-pass filter with 12kHz cutoff frequency and 240Hz transition band width.

 > filter in.wav out.wav -lowpass -f:0.25 -df:0.005


Just gain the wave.


 > gain a.wav b.wav -gain:-10


MPEG Program stream demuxer. This utility allows to extract individual streams from MPEG file.

Example: print file information to know what streams the file contains:

>mpeg_demux.exe test.mpg
MPEG Program Stream demuxer
This utility is a part of AC3Filter project (
Copyright (c) 2007 by Alexander Vigovsky
Found stream bf (Private stream 2)
Found stream e0 (MPEG Video stream)
Found stream c0 (MPEG Audio stream)
Found stream c1 (MPEG Audio stream)
Found stream bd (Private stream 1)
Found substream 82 (AC3 Audio substream)
Found substream 83 (AC3 Audio substream)
Found substream 84 (AC3 Audio substream)
Found substream 8d (DTS Audio substream)
Found substream a6 (LPCM Audio substream)

File in this example contains 1 video stream and 7 audio streams of different formats.

Example: extract sub-stream 83 from a file:

 > mpeg_demux test.mpg -d test.ac3 -ss:83


Noise generator. You can playback some noise or generate a WAV file with noise. It supports PCM 16/24/32 bit or PCM float formats. It can generate multi-channel noise.

Example: generate 10 seconds of 6 channel 32bit noise:

 > noise 10000 -spk:6 -fmt:2 -w noise.wav


Sample rate conversion utility. You can specify transition band width and attenuation level.

Example: Resample to 48kHz

 > resample a.wav b.wav -rate:48000

Example: High-quality resample (sensible only for at least 24bit files)

 > resample a.wav b.wav -rate:48000 -a:150 -q:0.999 -r:48000

Example: Fast resample

 > resample a.wav b.wav -rate:48000 -a:80 -q:0.80 -r:48000


This utility encapsulates AC3/DTS/MPEG Audio stream into SPDIF stream according to IEC 61937 standard.

Example: Convert an AC3 file to a WAV file to write multi-channel AudioCD

 > spdifer track1.ac3 track1.wav -wav


This utility just swaps swaps byte order in a file. Bytes 0 1 2 3 ... are reordered as 1 0 3 2 ...


 > swab input output


Multi-functional file player, decoder and processor. This utility may be used for:

Example: Detect and print file details and playback it:

E:\samples\ac3>valdec test.ac3 -i
File: test.ac3
Size: 15020032
Length: 4:28
Frames: 8381
Frame interval: 1792
Bitrate: 448kbps

Stream format: AC3 3/2.1 (5.1) 48000Hz
Bitstream type: byte stream
Frame size: 1792
Samples: 1536
Bitrate: 448kbps
SPDIF stream type: 0x1
Frame interval: 1792
Actual bitrate: 448kbps
Opening audio output PCM16 3/2.1 (5.1) 48000...
 1.9% Frs: 176    Err: 0 Time:   0:03.187 Level: -30 dB FPS: 55   CPU: 0.0%

Example: Decode a file into multi-channel 24bit WAV file with +10dB gain:

 > valdec test.ac3 -wav file.wav -spk:0 -fmt:1 -gain:10


Finds the difference between 2 audio files. Calculates amplitude difference and RMS difference. Can compare files of different types, like PCM16 and PCM Float (number of channels and sample rate must match). Can write the difference into the difference file. May check maximum difference for automated testing.

Example: Comapre a.wav and b.wav and write the difference into c.wav

 > wavdiff a.wav b.wav -diff c.wav