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屋!
查看全文