I have using code:

ffmpeg.exe -i 111.mp4 -vf "movie=1111.mp4[inner]; [in][inner] overlay=shortest=1:x=480:y=240 [out]" -c:v libx264 completed.mkv

Insert main_video into backgroud_Video but I can not seem to add a border image into this video.

An example of what I am aiming to do can be found here on YouTube.

Is there any way to do this using ffmpeg?

  • Your YouTube link is broken – Simon Sheehan Jun 12 '16 at 20:13

Use the pad filter.

ffmpeg -i main.mp4 \
       -vf "movie=bg.mp4,hue=s=0[bg];[in]scale=iw/2:-1,pad=iw+20:ih+20:10:10:color=yellow[m]; \
           [bg][m]overlay=shortest=1:x=(W-w)/2:y=(H-h)/2[out]" -c:v libx264 completed.mkv

This creates a 10-pixel yellow border around the smaller video. iw+20 and ih+20 create a padded canvas which is 20 pixels bigger than the video. Then the video is placed at (10,10) from the top-left in the canvas, thus creating a uniform 10 pixel border, whose color is set to yellow.

  • Thank you so much, but help me select main_video into center backgroud_video Thank – D.Money.Lee May 27 '16 at 15:45
  • What's the resolution for main and BG video? – Gyan May 27 '16 at 16:47
  • Main_video 1280x720 and backgroud_video 1280x720 – D.Money.Lee May 27 '16 at 17:00
  • and main_video inside backgroud_video size will be set =50% size video original! – D.Money.Lee May 27 '16 at 17:02
  • See edited cmd. – Gyan May 27 '16 at 17:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.