ffmpeg实例,使用高斯模糊为视频生成一个模糊背景(gblur)


ffmpeg命令目录


最终效果在这里插入图片描述

gblur命令参数

Apply Gaussian blur filter.

The filter accepts the following options:

sigma
Set horizontal sigma, standard deviation of Gaussian blur. Default is 0.5.

steps
Set number of steps for Gaussian approximation. Default is 1.

planes
Set which planes to filter. By default all planes are filtered.

sigmaV
Set vertical sigma, if negative it will be same as sigma. Default is -1.

命令

ffmpeg -i 纸短情长.mp4 -filter_complex [0:v]crop=(ih/16*9):ih,scale=iw/10:-2,gblur=sigma=5,scale=720:1280[vbg];[vbg][0:v]overlay=0:(H-h)/2 -y out.mp4

命令解析

输入的原视频是一个1280x720的横屏视频
命令核心在于滤镜filter_complex可以拆解成两部分。
1.背景的生成
2.原视频与背景的叠加

  • 生成背景
[0:v]crop=(ih/16*9):ih,scale=iw/10:-2,gblur=sigma=5,scale=720:1280[vbg];

crop=(ih/16*9),从原视频中裁剪出一个竖屏区域作为背景
scale=iw/10:-2,对裁剪后的视频缩小未原来的1/10以便高斯模糊(速度快)
gblur=sigma=5,对缩小后的视频背景进行高斯模糊
scale=720:1280[vbg],对高斯模糊后的视频进行放大,并保存到vbg变量中

  • 背景与原视频的叠加
[vbg][0:v]overlay=0:(H-h)/2

overlay的参数x,y。
0为x的坐标
(H-h)/2是y的坐标,也就是高度居中叠加

  • 1
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值