Thicken or thin bright shapes in a video: dilation and erosion by API

dilation grows bright areas and erosion shrinks them, two allowlisted filters in Sume's video filter. When they help and how to check cheaply.

4 min readSume
All posts

To make bright shapes in a video thicker, run the dilation filter; to make them thinner, run erosion. FFmpeg describes dilation as expanding bright areas and shrinking dark ones, and erosion as the opposite, replacing each pixel with the minimum in its neighbourhood. Both are on Sume's video filter allowlist, so you send them as a filtergraph and get a new MP4 back for $0.02, after a free check.

When would I want this?

The useful cases are narrow. White line art on a dark background can look thin after a downscale, and dilation fattens it. A thin bright scratch or speckle can be reduced with erosion, at the cost of shrinking everything else bright. Pairing either with edgedetect or sobel, which are also allowlisted, changes how heavy outlines look.

It is not a general sharpening or denoising tool. If your problem is grain, median is the better filter; if it is softness, unsharp or cas. Dilation and erosion change the shape of regions, so run them on a short test first.

How do I run and check one?

Put the filter name in the graph with no input or output labels. Send it to the free check endpoint, then to the encode endpoint with an idempotency key. Both filters take inline options only, which is why they are allowed; the compiler refuses anything that would read a file.

Because the effect is visual, the cheapest review is one frame. After the encode, extract a frame at a time where the shape matters and compare it to the same time in the source.

curl -s 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_EXAMPLE.mp4",
    "filtergraph": "dilation"
  }'

Which one should I pick?

The table compares the two with the filters people usually mean instead.

Shape filters on Sume's video filter, read 2026-10-12
GoalFilterEffect (per FFmpeg docs)
Thicken bright shapesdilationExpands bright areas, shrinks dark areas
Thin bright shapeserosionShrinks bright areas, expands dark areas
Remove speckle noisemedianReplaces each pixel with a neighbourhood median
Outline edgesedgedetect, sobelEdge detection

What are the limits?

The source must live on media.sume.com and be 300 seconds or shorter. Up to 32 filters and 2,048 characters fit in a graph. If a chain gets long, trim the clip first with the trim tool so you pay to filter only the seconds you keep.

Each encode produces a new MP4 and never overwrites the source, so you can keep the original, try dilation at one setting and erosion at another, and compare the results frame against frame. Failed encodes return a structured job error rather than a broken file, and the idempotency key means a retried request does not queue a second paid encode.

Sources

Related posts

More in Media tools

All Media tools posts

Written by Sume