Kukuster
Kukuster

Reputation: 184

How to compress video with uniform blur being the only side effect of compression?

The point is to somehow compress a video file, significantly reducing bitrate but somehow without changing its apparent quality, and because it would fit the design, I thought I will blur the video. In raster image processing I guess, it would be closer to the mean blur, or kind of like being behind turbid glass effect.

Ideally, I would like to be able to choose between compressing more with more strong blur and compressing less with less strong blur, all look pretty in any case.

I tried some ffmpeg postprocessing libraries including fspp, spp, uspp (takes a long time to render), etc. I almost reached the goal using fspp with parameters 5:60:15. But blur was either very strong for certain objects or left other undesired artifacts. Although uspp does a good job and looks pretty, it leaves about half of the image in frames unblurred, while I'm looking for more uniform blur across the frame. Because sometimes it takes a lot of time, I didn't try all the features of uspp.

Here is my ffmpeg input data about the video streams:

  Duration: 00:01:03.02, start: 0.000000, bitrate: 4010 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 3870 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 133 kb/s (default)
    Metadata:
      handler_name    : SoundHandler

Edit: example input and output: not blurred blurred

Upvotes: 0

Views: 1767

Answers (1)

Kukuster
Kukuster

Reputation: 184

Thanks to Mulvya!

Doing first -vf uspp=8:12, and then -vf unsharp=la=-1.1, worked really fine.

Exact commands:

ffmpeg -i video.mp4 -vf uspp=8:12 video_uspp8-12.mp4
ffmpeg -i video_uspp8-12.mp4 -vf unsharp=la=-1.1 video_uspp8-12__unsharp_la-1.1.mp4

reduced video file size to 56% of the original (17.7MB vs 31.6MB) and preserved quality.

uspp mostly compresses video, takes much time to render (for me it took more than 10 seconds for each second of the video), blurs the picture, but if you do much of it it will blur some parts of picture way too much more than everywhere.

unsharp works hundreds times faster, compresses less but balances uspp, applying more even blur.

If you need less of blur and blur spots and more of smoothing and more of "behind the turbid glass effect", and you don't need much compression, then you should give more preference to unsharp.

Upvotes: 0

Related Questions