FFmpeg: How to convert vertical video with black s

2019-01-21 11:26发布

问题:

How to make this by using FFmpeg?

Example without FFmpeg:
Adobe After Effects
Sony Vegas Pro

回答1:

I solved!

ffmpeg -i input.mp4 -lavfi '[0:v]scale=ih*16/9:-1,boxblur=luma_radius=min(h\,w)/20:luma_power=1:chroma_radius=min(cw\,ch)/20:chroma_power=1[bg];[bg][0:v]overlay=(W-w)/2:(H-h)/2,crop=h=iw*9/16' -vb 800K output.webm

Input: https://www.youtube.com/watch?v=17uHCHfgs60
Output: http://www.youtube.com/watch?v=CgZsDLfzrTs



回答2:

You can try overlaying the video on a blur image like this.

ffmpeg -i input_video -loop 1 -i input_image -t 10 -filter_complex "
[0:v]scale=-1:720[scaled_video];
[1:v]scale=1280:720,boxblur=50[blur_image];
[blur_image][scaled_video]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2[outv]" -c:v libx264 -aspect 1280/720 -map [outv] -map 0:a -c:a copy output_video

Input image will be looped through the duration of the output video by -loop 1. And -t 10 will limit the output video duration to 10 seconds. In this example I used 1280:720 as the output video resolution and scaled the inputs to match this ratio. 0:v refer to the input video and it will be scaled to height of 720 where width will be adjusted accordingly.

Here I used boxblur filter where there are several other like sab, smartblur and unsharp. map will get the specified processed input streams and map the to the output stream accordingly.

Hope this will help you!



回答3:

I couldn't get either of the previous solutions provided to work using ffmpeg 3.4.2 on Windows.

However this did work:

ffmpeg -i <input_file> -filter_complex "[0:v]scale=ih*16/9:-1,boxblur=luma_radius=min(h\,w)/20:luma_power=1:chroma_radius=min(cw\,ch)/20:chroma_power=1[bg];[bg][0:v]overlay=(W-w)/2:(H-h)/2,crop=h=iw*9/16" <output_file>

Don't forget to replace <input_file> and <output_file> with the appropriate file names.