title: FFmpeg - Overlay one video onto another video?
body: <blockquote>
    <p>I understand that this is a very open ended question. I have done some initial reading into <a href="https://www.ffmpeg.org" rel="noreferrer">FFmpeg</a>, but now require some guidance.</p>
  </blockquote>
  
  <h3>Problem</h3>
  
  <ul>
  <li>I have a video <code>input.mov</code>.</li>
  <li>I would like to overlay another video on top of <code>overlay.wov</code>.</li>
  <li>The result should be a single video (<code>output.mov</code>).</li>
  </ul>
  
  <h3>Notes</h3>
  
  <ul>
  <li>Done some initial reading into <a href="https://www.ffmpeg.org" rel="noreferrer">FFmpeg</a> and read <a href="https://stackoverflow.com/questions/23698372/ffmpeg-overlay-video-on-top-of-another-video">this question</a>.</li>
  </ul>
  
  <p>Thanks - C.</p>
  
  <h3>Edits</h3>
  
  <ol>
  <li>Backend is Go/Ruby. Open to using a new language.</li>
  <li>The audio from the first video should be kept.</li>
  <li>Setting the interval at which the overlay starts would be great.</li>
  </ol>
  
  <h3>Current Solution</h3>
  
  <pre><code>ffmpeg -i input.mov -i overlay.mov -filter_complex "[0:0][1:0]overlay[out]" -shortest -map [out] -map 0:1 -pix_fmt yuv420p -c:a copy -c:v libx264 -crf 18  output.mov
  </code></pre>
  
  <p>This nearly works, however:</p>
  
  <ul>
  <li>Overlay is cut short even though the two videos (<code>input.mov</code> &amp; <code>overlay.mov</code>) are the same length.</li>
  <li>I cannot start the overlay at any interval apart from <code>0:00</code>.</li>
  </ul>