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.
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.
| Factor | Block size on a 1080 px wide frame | Look |
|---|---|---|
| 12 | 12 px | Light, text may still be guessable |
| 24 | 24 px | Clear mosaic |
| 48 | 48 px | Heavy, 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
- Remix cut refused with only a start time: the 120 s budget
Why a remix media cut with start but no end fails remix_cut_too_long, how the 120 second and 20 span limits add up, and when to use video trim instead.
- Remix notes lint: FORMAT.md needs a Captions heading
What the remix media notes verb checks: a Captions heading in FORMAT.md, media.sume.com links only, the 200,000 byte cap, and why a lint failure still saves.
- Remix tile: 96 cells per call, and how to count yours
A remix media tile call is refused above 96 cells with remix_tile_too_many_cells. How each selector is counted, worked examples, and ways to split a request.
- Remix tile accepts a reference ingest id; other verbs do not
Use a finished reference ingest id as understanding_id for remix tile, including around without a transcript job. Boundaries and cut still need a probe.
Written by Sume