title: Replace video with jpg in ffmpeg
body: <p>I am trying to convert an mkv with video and audio into an m4v with the same audio, but with the video replaced with a still jpg for the duration. I'm following the examples from <a href="https://trac.ffmpeg.org/wiki/Slideshow" rel="nofollow noreferrer">https://trac.ffmpeg.org/wiki/Slideshow</a> and not having any success. Every time I attempt any of these, it doesn't insert the jpg, and instead uses the original video from the mkv. I am testing the files in VLC. Any ideas what could be going wrong? I'm inclined to think the documentation itself may be outdated or wrong.</p>
  <p>Attempts following the linked examples:</p>
  <pre><code>-i input.mkv -loop 1 -i image.jpg -c:a ac3 -b:a 640K -c:v libx264 -shortest output.m4v
  
  -i input.mkv -framerate 1 -i image.jpg -c:a ac3 -b:a 640K -c:v libx264 -r 30 -pix_fmt yuv420p output.m4v
  
  -i input.mkv -framerate 1 -i image.jpg -c:a ac3 -b:a 640K -c:v libx264 -r 30 -vf format=yuv420p output.m4v
  </code></pre>
  <p>The one thing I got semi-working (based on code from another source) was <code>-i input.mkv -i image.jpg -filter_complex &quot;[1][0]scale2ref[i][v];[v][i]overlay&quot; -c:a ac3 -b:a 640K -c:v libx264 output.m4v</code> but this stretches the image out (which I don't want, I want the resultant video to have the same aspect ratio as the image without black padding on the sides).</p>
  <p>I'm kicking myself because I eventually got something along the lines of the first examples working a few days ago, but somehow didn't save my work and am back to square one. Any help is appreciated, thanks in advance.</p>