[英]FFMpeg to resize any video to fit 1080x1920 vertical, without cropping, instead by shrinking and adding blurred borders?
I found some posts explaining how to turn any video horizontal by adding blurred borders using FFMpeg, but I want to convert videos to vertical 1080x1920.我发现一些帖子解释了如何通过使用 FFMpeg 添加模糊边框来将任何视频水平转换,但我想将视频转换为垂直 1080x1920。 I don't want it to enlarge the video, nor crop if a dimension is bigger than either 1080 or 1920 dimension.
如果尺寸大于 1080 或 1920 尺寸,我不希望它放大视频,也不裁剪。 Instead, I want it to shrink the video until it fits fully inside 1080x1920, and then I want it to add blurred borders to the empty areas.
相反,我希望它缩小视频直到它完全适合 1080x1920,然后我希望它为空白区域添加模糊的边界。
This is the snippet I found, but when I tried reversing the numbers, it actually cropped the video.这是我找到的片段,但是当我尝试反转数字时,它实际上裁剪了视频。
ffmpeg -I input.mp4 -lavfi "[0:v]scale=1920*2:1080*2,boxblur=luma_radius=min(h\,w)/20:luma_power=1:chroma_radius=min(cw\,ch)/20:chroma_power=1[bg];[0:v]scale=-1:1080[ov];[bg][ov]overlay=(Ww)/2:(Hh)/2,crop=w=1920:h=1080" output.mp4
Simple method:简单方法:
ffmpeg -i input.mp4 -filter_complex "[0:v]boxblur=40,scale=1080x1920,setsar=1[bg];[0:v]scale=1080:1920:force_original_aspect_ratio=decrease[fg];[bg][fg]overlay=y=(H-h)/2" -c:a copy output.mp4
"Simple" because it forces the background to 1080x1920 and ignores aspect ratio. “简单”,因为它强制背景为 1080x1920 并忽略纵横比。 So the background it will looked stretched, but it is blurred so much nobody will care or notice.
所以它的背景看起来会被拉长,但它是如此模糊,没有人会关心或注意到。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.