Turn a video into a line-art sketch by API with edgedetect

Sume's video filter allowlists edgedetect and negate. Edges come out as white wires on black; negating gives dark lines on white. Modes: wires, colormix, canny.

4 min readSume
All posts

A pencil-sketch look can be had with two allowlisted filters in Video filter: edgedetect to draw edges and negate to flip them to dark lines on white. The default wires mode draws white or gray wires on black, which is why the negate helps. This is a stylised effect for B-roll or title backgrounds, not a way to get a clean vector outline.

Which edgedetect options shape the lines?

Options of edgedetect as listed in the FFmpeg filter documentation, read 2026-10-01.
OptionWhat it does
modewires (default): white/gray wires on black. colormix: mixes colors. canny: detects edges on planes.
low, highThresholds from 0 to 1, defaults about 0.078 and 0.196. A higher high keeps only strong edges.
planesWhich planes to filter. Default is y, u, v, r, g and b.

How do I get dark lines on white?

Chain negate after edgedetect. In a local ffmpeg 9.0.1 run on a test pattern, mode=canny:low=0.1:high=0.3 followed by negate came out predominantly light. Raise high if the frame is a mess of lines and lower it if the lines break up.

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/street.mp4",
    "filtergraph": "edgedetect=mode=canny:low=0.1:high=0.3,negate"
  }'

Does this make a cartoon of my footage?

No. It outlines edges and discards color and shading, so the result reads as a line drawing. If you want a painted or illustrated restyle of a clip, that is a generative job, not a pixel filter. This one is deterministic: the same clip and settings give the same result.

Is there a way to keep some color under the lines?

colormix mode mixes colors into the output, and the allowlist also has blend, so a graph can split the clip, edge-detect one copy and blend it over the original. Try a simple split and blend graph on a short clip first; the check will tell you whether the filters are allowed before you pay for an encode.

What does a filter job cost and where are the limits?

The docs list $0.02 per encode job, with a source of at most 300 seconds, a filtergraph of at most 2048 characters and 32 named filters. The /v1/video-filter/check route runs the same allowlist and source checks for free and returns valid and next_action; a graph that passes can still fail on the worker (bad expression, memory, time), which comes back as a structured job error.

Sources

Related posts

More in Developers

All Developers posts

Written by Sume