FFmpeg:如何将水平视频16:9转换为垂直视频9:16,且上下两侧背景模糊 [英] FFmpeg: How to convert horizontal video 16:9 to vertical video 9:16, with blurred background on top and bottom sides
本文介绍了FFmpeg:如何将水平视频16:9转换为垂直视频9:16,且上下两侧背景模糊的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道有一个帖子可以做相反的事情: FFmpeg:如何将带有黑色边的垂直视频转换为具有模糊背景边的视频16:9
I know there is a post to do the contrary: FFmpeg: How to convert vertical video with black sides, to video 16:9, with blurred background sides
但是我不知道如何用ffmpeg做到这一点
but i can't figure out how to do this with ffmpeg
这是输入:
这是预期的结果(背景视频应以相同的宽高比缩放,裁剪为9/16并模糊):
and here is the expected result (the background video should be zoomed with the same aspect ratio, cropped to 9/16 and blurred) :
感谢您的帮助!
推荐答案
我改编了Mulvya提出的解决方案
I adapted solution proposed by Mulvya
这是最终结果:
ffmpeg -i input.mp4 -lavfi "[0:v]scale=256/81*iw:256/81*ih,boxblur=luma_radius=min(h\,w)/40:luma_power=3:chroma_radius=min(cw\,ch)/40:chroma_power=1[bg];[bg][0:v]overlay=(W-w)/2:(H-h)/2,setsar=1,crop=w=iw*81/256" output.mp4
这篇关于FFmpeg:如何将水平视频16:9转换为垂直视频9:16,且上下两侧背景模糊的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文