user12145: I have one video (400x300) and an image (1280x300).
pls show me how can i put this image behind the video like that:
i've try, but not working T-T


user1760: Use the overlay filter
This will overlay the video on top of the image:
ffmpeg -loop 1 -i image.png -i video.mp4 -filter_complex "overlay=(W-w)/2:shortest=1" output.mp4

If you need to resize the video then add the scale filter:
ffmpeg -loop 1 -i image.png -i video.mp4 -filter_complex "[1:v]scale=400:-1[fg];[0:v][fg]overlay=(W-w)/2:(H-h)/2:shortest=1" output.mp4

You can use pad filter instead of an image
If you just want to add black padding you don't need an image and can use the pad filter.
ffmpeg -i video.mp4 -filter_complex "pad=1280:0:(ow-iw)/2" output.mp4

Using the player to do it instead
You could add the padding upon playback so you don't even need to re-encode:
ffplay -vf "pad=1280:0:(ow-iw)/2" input.mp4


12145: <p>I have one video (400x300) and an image (1280x300).
pls show me how can i put this image behind the video like that:
i've try, but not working T-T</p>

<p><a href="https://i.stack.imgur.com/w7PB5.png" rel="noreferrer"><img src="https://i.stack.imgur.com/w7PB5.png" alt="enter image description here"></a></p>
 1760: <h1>Use the <a href="https://ffmpeg.org/ffmpeg-filters.html#overlay" rel="noreferrer">overlay filter</a></h1>

<p>This will overlay the video on top of the image:</p>

<pre><code>ffmpeg -loop 1 -i image.png -i video.mp4 -filter_complex "overlay=(W-w)/2:shortest=1" output.mp4
</code></pre>

<p>If you need to resize the video then add the <a href="http://ffmpeg.org/ffmpeg-filters.html#scale" rel="noreferrer">scale filter</a>:</p>

<pre><code>ffmpeg -loop 1 -i image.png -i video.mp4 -filter_complex "[1:v]scale=400:-1[fg];[0:v][fg]overlay=(W-w)/2:(H-h)/2:shortest=1" output.mp4
</code></pre>

<h1>You can use pad filter instead of an image</h1>

<p>If you just want to add black padding you don't need an image and can use the <a href="https://ffmpeg.org/ffmpeg-filters.html#pad" rel="noreferrer">pad filter</a>.</p>

<pre><code>ffmpeg -i video.mp4 -filter_complex "pad=1280:0:(ow-iw)/2" output.mp4
</code></pre>

<h1>Using the player to do it instead</h1>

<p>You could add the padding upon playback so you don't even need to re-encode:</p>

<pre><code>ffplay -vf "pad=1280:0:(ow-iw)/2" input.mp4
</code></pre>
