title: gstreamer: write both video and audo streams into a single MP4 container after concat
body: <p>Good day,</p>
  
  <p>I have two mp4 files (a.mp4 and b.mp4), each of them includes video and audio streams, and I need  to concatenate them into a single mp4 container (c.mp4) using gstreamer (this question is connected to <a href="https://stackoverflow.com/questions/37393229/gstreamer-pipeline-to-concat-two-media-containers-video-and-audio-streams/">the previous one</a>)</p>
  
  <p>In other words, the following pipeline concatenates the content of a.mp4 and b.mp4 and then outputs the result into autovideosink and alsasink:</p>
  
  <pre><code>GST_DEBUG=3 gst-launch-1.0 concat name=c2 ! videoconvert ! videorate ! autovideosink concat name=c ! audioconvert ! audiorate ! alsasink filesrc location=a.mp4 ! decodebin name=d1 ! audio/x-raw ! queue ! c. filesrc location=b.mp4 ! decodebin name=d2 ! audio/x-raw ! queue ! c. d1. ! video/x-raw ! queue ! c2. d2. ! video/x-raw ! queue ! c2.
  </code></pre>
  
  <p>Works like a charm! But instead of autovideosink and alsasink, I need to re-encode and then mux concatenated video and audio streams and write them into a single container (i.e. there should be a single "filesink location=c.mp4" in the pipeline if I understand it correctly) - this way I would receive the content of a.mp4 appended with the content of b.mp4 (a.mp4 + b.mp4 = c.mp4)</p>
  
  <p>Could someone please share a pipeline which demonstrates how to do this ?</p>