CREATING A 5.1 SURROUND SOUND DVD AUDIO TRACK USING THE LINUX OPERATING SYSTEM

Author: Rick Harris
Location: Adelaide, Australia
Email: rickfharris@yahoo.com.au

This howto is intended to complement and be read in conjunction with the "AUTHORING PC MEDIA TO DVD" howto located here -> http://mightylegends.zapto.org/dvd/dvdauthor_howto.html

Tools needed:
Extract and create the audio channels
Transcode the original media file (.avi, .mpg, etc..) to create the files matrix.m2v and matrix.ac3.

Convert matrix.ac3 to a WAV file:
ffmpeg -i matrix.ac3 matrix.wav

Extract the left and right channels:
sox -V matrix.wav -r 48000 -c1 left.wav avg -l sox -V matrix.wav -r 48000 -c1 right.wav avg -r

Create the centre channel by mixing both left/right channels into one:
sox -V -m left.wav right.wav -r 48000 -c1 centre.wav

Create the LFE(Low Frequency Effect) or Sub/Bass channel:
sox -V -v 0.5 centre.wav lfe.wav lowp 150

Mix the channels together and convert to AC3
Merge the six channels into one multi-channel WAV file and convert to a multi-channel AC3 audio file
In the following line, the left.wav and right.wav sound files have been re-used for the rear channels.
The order is important (left, center, right, left_rear, right_rear, lfe):
sox -V -M left.wav centre.wav right.wav left.wav right.wav lfe.wav -t raw - | \ ffmpeg -y -f s16le -ar 48000 -ac 6 -i - -ab 384k matrix_final.ac3
  • In earlier versions of FFmpeg, the option to specify audio bitrate is different. Depending on the version of FFmpeg installed you may need to specify '-ab 384' instead of '-ab 384k'.

Here is a script using the above commands to automate things a little.
It takes pretty much any audio file as the first argument and spits out a 5.1/multi-channel AC3 audio file ready for mplexing -> http://mightylegends.zapto.org/dvd/stereo2surround.sh

Credits
All those developers who have worked on SoX over the years
The FFmpeg team

All done!
Return to the original howto and use the new multi-channel 'matrix_final.ac3' file in your mplex line.