Pixelate part of a video by API: a fixed-region mosaic

Hide a label or a screen area with a mosaic using one Sume video-filter graph: crop a region in 24-pixel multiples, shrink, enlarge with neighbor, overlay.

5 min readSume
All posts

To pixelate one area of a video with Sume, use a video-filter graph that copies the area, shrinks it by 24, enlarges it back with nearest-neighbour scaling and lays it over the original: split[a][b];[b]crop=w=floor(iw*0.3/24)*24:h=floor(ih*0.15/24)*24:x=iw*0.1:y=ih*0.2,scale=w=iw/24:h=ih/24,scale=w=iw*24:h=ih*24:flags=neighbor[c];[a][c]overlay=x=W*0.1:y=H*0.2. It hides a fixed rectangle for $0.02 per encode.

It is a fixed-region tool. The mosaic sits at the same spot for the whole clip, so it suits a static screen recording, a shelf label or a corner of a generated product scene, and does not follow a face or a moving plate. Sume's video filter has no detector or tracker.

Why multiples of 24?

A pixelate is a downscale followed by an upscale. If the cropped width is not divisible by the shrink factor, the enlarged patch comes back a few pixels smaller than the hole it must cover, and a sliver of the original shows at the right or bottom edge. Rounding the crop down to a multiple of 24 with floor(iw*0.3/24)*24 makes iw/24*24 exact.

flags=neighbor on the second scale keeps the blocks square and hard. Without it the enlargement would be smoothed and look like a blur instead of a mosaic. A larger factor gives bigger blocks: 24 on a 1080 pixel wide frame makes blocks of 24 pixels.

How do I place the region?

The crop starts at x=iw*0.1 and y=ih*0.2 and spans roughly 30 percent of the width and 15 percent of the height. The overlay then puts the patch back at W*0.1 and H*0.2. Keep those two pairs equal. Take a still with video frames at the moment the object is largest, read its box off the image, and add a margin.

curl -X POST https://api.sume.com/v1/video-filter/check \
  -H "Authorization: Bearer $SUME_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "video_url": "https://media.sume.com/artifacts/artf_demo/clip.mp4",
    "filtergraph": "split[a][b];[b]crop=w=floor(iw*0.3/24)*24:h=floor(ih*0.15/24)*24:x=iw*0.1:y=ih*0.2,scale=w=iw/24:h=ih/24,scale=w=iw*24:h=ih*24:flags=neighbor[c];[a][c]overlay=x=W*0.1:y=H*0.2"
  }'

How do the settings compare?

Change the number in all four places in the graph: the two multiples in the crop, the division and the multiplication. Do not trust the mosaic for secrets without looking at the output; export one frame with video frames and read it yourself.

Mosaic settings (Sume video filter, read 2026-10-11)
FactorBlock size on a 1080 px wide frameLook
1212 pxLight, text may still be guessable
2424 pxClear mosaic
4848 pxHeavy, hides small print

Is it a privacy guarantee?

No. If the object moves out of the box in some frames, those frames expose it. Review the full output, or cut the clip to the stretch where the object stays inside the box with video trim and run the filter on that range. The source stays unchanged and available if the result fails review.

Sources

Related posts

More in Media tools

All Media tools posts

Written by Sume