I've been multiplexing (muxing) an existing MPEG video with its sound in an external file as AC3.
In theory, that's plain simple:
ffmpeg -i video_file.mpeg -vcodec copy -i audio_file.ac3 -acodec copy output_dvd.mpeg
The streams were mapped correctly, and also 'ffprobe output_dvd.mpeg
' said that the resulting mpeg contained both, video and audio streams:
Input #0, mpeg, from 'output_dvd.mpeg':
Duration: 02:00:43.29, start: 0.500000, bitrate: 4883 kb/s
Stream #0.0[0x1e0]: Video: mpeg2video, yuv420p, 720x576 [PAR 16:15 DAR 4:3], 9396 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0.1[0x80]: Audio: ac3, 48000 Hz, stereo, s16, 256 kb/s
...but mplayer didn't play the audio, complaining that there's no audio:
MPEG: No audio stream found -> no sound.[SOLUTION]
According to another error message mplayer wrote, I assume that ffmpeg didn't interleave audio/video correctly:
Too many video packets in the buffer: (4096 in 8354444 bytes).
Maybe you are playing a non-interleaved stream/file or the codec failed?
So I changed the muxing call of ffmpeg to let it know I wanted a DVD conform MPEG as output, by adding "-target dvd"
ffmpeg -i video_file.mpeg -i audio_file.ac3 -target dvd -vcodec copy -acodec copy output_dvd.mpeg
That did the trick.