Multiplexing audio and video

You need the mplex command, which is part of mjpegtools.

Next example will show how to multiplex video and audio to create a DVD compatible MPEG2 file (-f 8). As an extra option this example will also delay the video 200ms with respect to the audio (-O 200ms), which is a quick way to tackle audio/video synchronization problems. Negative numbers are allowed too.

mplex -f 8 -O 200ms -o outfile.mpg infile.m2v infile.ac3

Note that the video must be a DVD compatible MPEG2 video fle and the audio must be a DVD compatible AC3 audio file.