Merge & convert AC3 5.1 in Mp3 Stereo lame
I consider that we have 3 AC3 files :
- Sample1.ac3
- Sample2.ac3
- Sample3.ac3
Merge files
We want to merge these 3 files. Simply use the cat command :
cat *.ac3 > All.ac3
#normally *.ac3 tell “Sample1.ac3 Sample2.ac3 Sample3.ac3” properly sorted. If you have a doubt, you will be allowed to use the full sentence.
cat Sample1.ac3 Sample2.ac3 Sample3.ac3 > All.ac3
The 3 files merged in one All.ac3.
Decode AC3 file
Lame doesn’t be able to read AC3 files, so we must convert them. a52dec is a decoder of ac3 file to a lot of format (oss, ossdolby, oss4, oss6, wav, wavdolby, aif, aifdolby, peak, peakdolby, null, null4, null6, float).
Here, we use “wav” type output. The program decodes specified file to stdout and we must use operator ‘>’ like that :
a52dec -o wav All.ac3 > All.wav
This command downmix the 5.1 stream into full stereo stream (with channel level adjustment (-3, 0, + 3dB for instance) based on output mode). You can disable this with add a ‘-a’, use man for the rest.