How to blur the sides of horizontal video with FFmpeg?

I would like to find a solution to blur the top and the bottom of a video.
I used the following common but didn’t work for me:
ffmpeg -i test.mp4 -lavfi “[0:v]scale=19202:10802,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=(W-w)/2:(H-h)/2,crop=w=1920:h=1080” outpt.mp4Any suggestion on that?

Hey! Try this if it helps.

Thanks, I tried this previously, but this is not exactly what I want.

To blur the sides of a horizontal video with ffmpeg, you can use the unsharp filter with a negative amount parameter to create a blur effect.

The blur strength and behavior are controlled by a number of parameters that the unsharp filter accepts. These values can be changed to suit your preferences.

Here’s an example command that will blur the left and right sides of the video:

ffmpeg -i input.mp4 -vf "unsharp=amount=-1:threshold=0:radius=1:x=-w/2:y=0" output.mp4

  • This command will apply the unsharp filter to the input video input.mp4.
  • Create a new output video output.mp4.
  • The amount parameter is set to a negative value (-1) to create a blur effect.
  • The x parameter is set to -w/2 to apply the blur only to the left half of the video.

Keep in mind to modify the command’s size and offsets according to the width, height, and desired blur region of your input video.

You should be able to blur the sides of a horizontal movie using this command with FFmpeg’s unsharp filter.

You can blur the right side of the video as well, by using the following command:

ffmpeg -i input.mp4 -vf "unsharp=amount=-1:threshold=0:radius=1:x=w/2:y=0" output.mp4

This command is similar to the above, but the x parameter is set to w/2 to apply the blur to the right half of the video.

You can adjust the strength of the blur by changing the value of the amount parameter. A higher value will result in a more substantial blur effect.

Thanks

Are there any specific parameters or options to control the intensity of the blur effect applied to the sides of the video?

Yes, you may regulate the strength of the blur effect applied to the sides of the video using particular parameters and options in FFmpeg’s gblur filter. The sigma value, which controls how strong the blur effect is, is the main parameter that can be changed.

The sigma parameter regulates the Gaussian blur kernel’s standard deviation. A greater sigma value will produce a stronger, more obvious blur effect, whilst a lower value would result in a softer blur.

Here is the FFmpeg command for adjusting the blur effect’s strength using the sigma parameter:

ffmpeg -i input.mp4 -vf "split[left][tmp];[tmp]crop=iw/2:ih:0:0, gblur=sigma=VALUE[left_blurred];[left][left_blurred]hstack" -c:a copy output.mp4

Now, change VALUE to reflect the desired sigma value. For instance, you can increase the sigma number as follows for a stronger blur:

ffmpeg -i input.mp4 -vf "split[left][tmp];[tmp]crop=iw/2:ih:0:0, gblur=sigma=30[left_blurred];[left][left_blurred]hstack" -c:a copy output.mp4

This is how you can control the blur effect using FFmoeg.