title: ffmpeg: concat videos and images
body: <p>I have 2 videos (same resolution, same encoding) files that I want to concat and I want to insert some text for 3 seconds between them, as a splitter. I'm doing this with ffmpeg on Windows.</p>
  
  <p>Optional ideas that I would be interested in:</p>
  
  <ul>
  <li>avoid reencoding the video in the process</li>
  <li>having a fade in / fade out at the intersection of each part</li>
  </ul>
  
  <p>For now, I made the text as an image (but I am open to other suggestions). Let's say I have:</p>
  
  <ul>
  <li>video1.mp4: 6:33</li>
  <li>splitter.png (same resolution as video1.mp4)</li>
  <li>video2.mp4: 16:44</li>
  </ul>
  
  <p>I have tried a few things, but I always end up with the same problem: the video is 23:20 (video1 + 3 seconds + video2), but the 3 seconds gap is just the last video1 frame frozen instead of my image/text...</p>
  
  <p>Any Idea what I did wrong or how I should achieve this?</p>
  
  <p>Here is what I tried so far:</p>
  
  <h3>Method 1: image to video</h3>
  
  <p>Turn the image into a 3 seconds mp4 film, then concat (demuxer) it with the others:</p>
  
  <pre><code>ffmpeg -loop 1 -f image2 -i splitter.png -r 30 -t 3 splitter.mp4
  ffmpeg -f concat -i input.txt -codec copy output.mp4
  </code></pre>
  
  <p>Where the <code>input.txt</code> looks like:</p>
  
  <pre><code>file 'E:\video1.mp4'
  file 'E:\splitter.mp4'
  file 'E:\video2.mp4'
  </code></pre>
  
  <p>The content of <code>splitter.png</code> is visible in the <code>splitter.mp4</code>, but not in the <code>output.mp4</code>. Also I'm not entirely sure the splitter.mp4 respects the exact same encoding as the 2 videos, and I don't know how to verify that.</p>
  
  <h3>Method 2: insert image frames</h3>
  
  <p>Directly run the concat (demuxer) 90 times (30fps -> 3 seconds) on the image</p>
  
  <pre><code>ffmpeg -f concat -i input.txt -codec copy output.mp4
  </code></pre>
  
  <p>Where the <code>input.txt</code> looks like:</p>
  
  <pre><code>file 'E:\video1.mp4'
  file 'E:\splitter.png'
  ...
  file 'E:\splitter.png'
  file 'E:\video2.mp4'
  </code></pre>
  
  <h3>Edit: possible solution?</h3>
  
  <p>Since all I'm doing is screencasting, I might as well screencast my splitter image. This way I would be sure of the audio &amp; video encoding and wouldn't have any problem merging and it wouldn't need any reencoding... I know it might sound dumb, but it would probably do the trick...</p>
  
  <p>Note: I didn't have try it, since I already worked through Openshot.</p>