title: ffmpeg encoding plays very fast. Audio.mp4 and Video.mp4 work, but both together don't
body: <p>In both steps 3 and 4 below, the <code>.mp4</code> plays normally. However, although I've used what seems to be the same settings in the last step (audio + video), that step does not work. The video plays more than 10 times too fast... also the audio does not play.  </p>
  
  <p>The ffmpeg messages for step 5 show that it has included audio.  </p>
  
  <pre><code>Output #0, mp3, to '/tmp/test.mp4':
      Stream #0.0: Video: libx264, yuv420p, 720x480, q=2-31, 90k tbn, 23.98 tbc
      Stream #0.1: Audio: libmp3lame, 48000 Hz, stereo, s16, 128 kb/s
  </code></pre>
  
  <p>Subsequently running <code>ffmpeg -i</code> shows no trace of the audio, but it does report on the  video... What have I missed, to get it muxed properly?...</p>
  
  <pre><code>#!/bin/bash
  
  # 1. create Audio 
  wine avs2pipe.exe audio "$src_avs" &gt;"$temp_pcm"
  
  # 2. create Video 
  wine avs2yuv.exe "$src_avs" - |
    x264 --stdin y4m --output "$temp_h264" - 2&gt;/dev/null
  
  # 3. This works.  (audio only)
  # encode `audio.mp4 
  ffmpeg -acodec pcm_s16le -f u16le -ac 2 -ar 48000 -i "$temp_pcm" \
         -acodec libmp3lame -f mp3 -ar 48000 -ab 128k  -y "$audio_mp4"
  
  # 4. This works.  (video only)
  # encode `video.mp4 
  ffmpeg -i "$temp_h264" \
         -vcodec copy -y "$video_mp4"
  
  # 5. This DOES NOT work!  It plays very fast.
  # encode `final.mp4' 
  ffmpeg -acodec pcm_s16le  -f u16le  -ac 2 -ar 48000  -i "$temp_pcm" \
         -i "$temp_h264" \
         -acodec libmp3lame -f mp3 -ar 48000 -ab 128k \
         -vcodec copy \
         -y "$final_mp4"
  </code></pre>