简体   繁体   English

FFMpeg 调整任何视频的大小以适应 1080x1920 垂直,无需裁剪,而是通过缩小和添加模糊边框?

[英]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.

相关问题 FFMPEG在特定垂直位置覆盖1280X720视频上的1080X1920视频 - FFMPEG Overlay 1080X1920 video over 1280X720 video at a particular vertical position FFmpeg:如何将带黑框的水平非全高清视频渲染为 1920x1080 视频,背景模糊 - FFmpeg: How to render horizontal non full hd video with black frames, to video in 1920x1080, with blurred background FFMPEG - 裁剪和填充视频(保持 3840x1920 但有黑色边框) - FFMPEG - crop and pad a video (keep 3840x1920 but with black borders) FFMPEG:是否可以使用 DSHOW 录制 1920x1080 的屏幕? - FFMPEG: is it possible to record 1920x1080 screen with DSHOW? 裁剪黑色填充并将大小调整回原始 1920x1080 - Crop black padding and resize back to original 1920x1080 设置 matplotlib 视频动画大小 (1920x1080) - Set matplotlib video animation size (1920x1080) 如何在 1920x1080 视频中使用“标准 PAL”标志 - How to have “standard PAL” flag with a 1920x1080 video FFMPEG 脚本用于合并列表中的所有文件并制作 1920x1080p 60fps mp4 视频 - FFMPEG script to merge all files in a list and make a 1920x1080p 60fps mp4 video 1920x1080 60视频的H.264级 - H.264 level for 1920x1080 60 video 如何将 iOS App Preview 视频放大到 1080 x 1920? - How do I upscale an iOS App Preview video to 1080 x 1920?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM