Before/after side-by-side video: hstack in Sume video filter

Make a before/after comparison clip with ffmpeg hstack through the Sume video filter API. Split the video, grade one side, stack, and dry-run first.

5 min readSume
All posts

Use split to copy the video into two streams, change one, and join them with hstack in the filtergraph of Sume's video filter. The output is twice as wide as the source. Run the free POST /v1/video-filter/check first to confirm the graph is accepted before you pay for a job.

The graph

FFmpeg's documentation says hstack stacks input videos horizontally, that all streams must be the same pixel format and height, and that it is faster than using overlay and pad (read 2026-10-02). Its inputs option defaults to 2. Because the two halves come from one split, the heights match automatically as long as the graph only changes colour.

Filters used, from FFmpeg's filter docs (read 2026-10-02)
FilterRole hereDocumented behaviour
splitCopy the input into two streamsSplits the input into several identical outputs
colortemperatureChange one copytemperature 1000 to 40000 K, default 6500; mix 0 to 1
hstackPlace the copies side by sideSame pixel format and height required; inputs default 2

Dry-run it, then submit

The check endpoint is unbilled and validates the program. The same body goes to POST /v1/video-filter with an Idempotency-Key. The filtergraph limit is 2048 characters and 32 filters, and the source clip can be at most 300 seconds. Internal labels like [a] are allowed; stream specifiers are refused.

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/talk.mp4",
    "filtergraph": "split[a][b];[b]colortemperature=temperature=5200:pl=0.4[c];[a][c]hstack=inputs=2"
  }'

Things to watch

The result is a new MP4 with twice the source width, so a 1920-wide source becomes 3840 wide. If you need a standard size, use a second step to scale the stack down, or start from a smaller clip. Label the halves in your editor or in your post; drawtext is not on the filter allowlist, so a text label cannot be added in this call.

The video must already be a media.sume.com URL in your workspace. After the job succeeds, read GET /v1/jobs/:id/result for the new video_url.

Sources

Related posts

More in Media tools

All Media tools posts

Written by Sume