Fix lens distortion in video by API with lenscorrection

Sume's video filter allowlists ffmpeg's lenscorrection, so barrel distortion from a wide action-cam clip can be corrected by coefficients you choose and test.

4 min readSume
All posts

Yes, with coefficients you supply. lenscorrection is on the allowlist for POST /v1/video-filter, so a graph like lenscorrection=k1=-0.227:k2=-0.022 can straighten barrel distortion and return a new MP4. Sume has no lens profiles: nothing looks up a GoPro model for you.

Blackmagic's September 8 release notes say DaVinci Resolve 21.1 adds a line-based calibration type to its lens distortion tool, which is a way to derive a correction visually. The Sume route is the manual one, documented in Video filter, read 2026-10-01.

How do I run the correction?

Import the clip with POST /v1/media-imports, then send a filtergraph. The coefficients above are a starting point from ffmpeg's filter documentation, not a Sume preset; sign and strength depend on the lens, so check a short sample first.

curl -X POST https://api.sume.com/v1/video-filter \
  -H "Authorization: Bearer $SUME_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: lens-fix-001" \
  -d '{
    "video_url": "https://media.sume.com/artifacts/artf_demo/wide.mp4",
    "filtergraph": "lenscorrection=k1=-0.227:k2=-0.022"
  }'

How do I test before paying for the full clip?

Call POST /v1/video-filter/check with the same body: it is free, runs the allowlist and source preflight, and returns valid and diagnostics. Then cut a few seconds with video trim and filter that. Corrected edges often need a crop; a crop op runs before the filtergraph, so put the crop after in a second pass.

What are the limits?

Video filter limits from the Sume docs, read 2026-10-01.
ItemValue
Price$0.02 per encode job; check is free
SourceUp to 300 seconds, on media.sume.com
GraphUp to 2048 chars and 32 named filters
OutputKeeps source geometry, frame rate and audio unless the program changes them
Distortion profilesNone; coefficients are yours

Sources

Related posts

More in Developers

All Developers posts

Written by Sume