Inserting Video with Image Border into ffmpeg

0

1

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?

D.Money.Lee

Posted 2016-05-27T10:00:42.470

Reputation: 5

Your YouTube link is broken – Simon Sheehan – 2016-06-12T20:13:45.697

Answers

1

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.

Gyan

Posted 2016-05-27T10:00:42.470

Reputation: 21 016

Thank you so much, but help me select main_video into center backgroud_video Thank – D.Money.Lee – 2016-05-27T15:45:15.987

What's the resolution for main and BG video? – Gyan – 2016-05-27T16:47:58.423

Main_video 1280x720 and backgroud_video 1280x720 – D.Money.Lee – 2016-05-27T17:00:27.760

and main_video inside backgroud_video size will be set =50% size video original! – D.Money.Lee – 2016-05-27T17:02:53.197

See edited cmd. – Gyan – 2016-05-27T17:57:53.157

Thank man, that great support, if i want resize video main i'll edit command ? – D.Money.Lee – 2016-05-27T18:08:23.420

To resize main video, edit the scale parameters. – Gyan – 2016-05-28T05:56:35.023

Thank Mulvya you're super man, and i want question i want change corlor video_backgroud to black and white, can you help me do this – D.Money.Lee – 2016-05-28T07:53:41.320

Edited command - added hue filter. – Gyan – 2016-05-28T08:14:15.553