FFMPEG:更改过滤器可防止视频模糊 [英] FFMPEG: Changing the filter prevents the video from being blurred

查看:43
本文介绍了FFMPEG:更改过滤器可防止视频模糊的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 FFMPEG 的新手,我已经研究了几天.我尝试了给出的代码FFmpeg - 在脸上应用模糊.我有一个 208 X 208 分辨率的视频,我需要在视频上模糊一个矩形,有一些宽度/高度和顶部/左侧偏移.以下代码成功模糊视频

I am new to FFMPEG, it has been a few days I am working on it. I tried the code given at FFmpeg - Apply blur over face .I have a video with 208 X 208 resolution and I need to blur a rectangle on the video, with some width/height and top/left offset. The following codes successfully blur the video

ffmpeg -i test1.mov -filter_complex "[0:v]crop=10:10:1:1,boxblur=1[b0];[0:v][b0]overlay=10:10" intro-blur.mov

ffmpeg -i test1.mov -filter_complex "[0:v]crop=50:50:1:1,boxblur=1[b0];[0:v][b0]overlay=10:10" intro-blur.mov

但以下内容没有

ffmpeg -i test1.mov -filter_complex "[0:v]crop=5:5:1:1,boxblur=10[b0];[0:v][b0]overlay=10:10" intro-blur.mov

ffmpeg -i test1.mov -filter_complex "[0:v]crop=10:10:1:1,boxblur=10[b0];[0:v][b0]overlay=10:10" intro-blur.mov

ffmpeg -i test1.mov -filter_complex "[0:v]crop=20:20:1:1,boxblur=10[b0];[0:v][b0]overlay=10:10" intro-blur.mov

我想知道为什么会这样?不工作的代码有什么问题.

I would like to know why it is so? What is the problem with the codes that don't work.

提前致谢.

推荐答案

boxblur 说,

半径值必须为非负数,且不得为大于表达式 min(w,h)/2 的亮度值和alpha 平面,以及 min(cw,ch)/2 色度平面.

The radius value must be a non-negative number, and must not be greater than the value of the expression min(w,h)/2 for the luma and alpha planes, and of min(cw,ch)/2 for the chroma planes.

如果没有指定,chroma_radius 和 alpha_radius 默认为为 luma_radius 设置的相应值.

If not specified, chroma_radius and alpha_radius default to the corresponding value set for luma_radius.

<小时>

所以,在 crop=20:20:1:1,boxblur=10

对于亮度平面条件,值10应等于或小于min(20,20)/2 = 10.通过

for the luma plane condition, the value 10 should equal to or be less than min(20,20)/2 = 10. PASS

但由于您尚未指定色度半径的值,因此其计算结果为 20.现在,大多数视频都是 YUV 4:2:0,即色度平面的宽度和高度是亮度平面的一半,因此在 crop=20:20:1:1,boxblur=10 中,

But since you haven't specified a value for the chroma radius, it evaluates to 20. Now, most videos are YUV 4:2:0 i.e. the chroma planes' width and height is half that of the luma plane, so in crop=20:20:1:1,boxblur=10,

对于色度平面,值 10 应等于或小于 min(10,10)/2 = 5.失败!

for the chroma plane, the value 10 should equal to or be less than min(10,10)/2 = 5. FAIL!

补救方法是要么确保半径值满足条件,要么在模糊之前插入格式过滤器.

The remedy is to either ensure the radius value satisfies the conditions, or insert a format filter before the blur.

crop=20:20:1:1,format=yuv444p,boxblur=10

您仍然需要确保模糊半径等于或小于裁剪区域最小尺寸的一半.

You still have to make sure that the blur radius is equal to or less than half the smallest dimension of the cropped area.

这篇关于FFMPEG:更改过滤器可防止视频模糊的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆