Add -vf reverse -af areverse and re-encode, and a 10-second 1080p clip plays backwards, sound included. reverse buffers every frame, so the encode peaked near 2 GB. ReelSDK charges $0.02 per compute minute, under a third of a cent for this one.

Reverse a video with ffmpeg

Memory is the limit, not speed: a decoded 1080p frame takes about 3 MB, so 10 seconds at 30 fps need close to 1 GB before the first frame comes out. ReelSDK's API reversed ours in about 8 seconds; shrink, trim or split anything longer.

GuidesUpdated

reverse
ffmpeg -i in.mp4 -vf reverse -af areverse \
  -c:v libx264 -crf 20 -preset veryfast -c:a aac -movflags +faststart reversed.mp4

reverse buffers the video and areverse the audio, then both play out from the end. Stream copy can't work here: every frame has to be decoded and encoded again.

Variations

The other commands you will need

  1. Shrink first

    Put scale before reverse and the buffer holds small frames. At 960x540 the run took about a third of the time and a quarter of the memory.

    smaller
    ffmpeg -i in.mp4 -vf scale=-2:540,reverse -af areverse \
      -c:v libx264 -crf 20 -preset veryfast -c:a aac -movflags +faststart reversed-540.mp4
  2. Long clips: reverse in parts

    Reverse each part on its own, then join them last part first. The join copies the streams, so it takes a fraction of a second.

    parts
    ffmpeg -ss 0 -t 5 -i in.mp4 -vf reverse -af areverse -c:v libx264 -crf 20 -preset veryfast -c:a aac part1.mp4
    ffmpeg -ss 5 -i in.mp4 -vf reverse -af areverse -c:v libx264 -crf 20 -preset veryfast -c:a aac part2.mp4
    printf "file 'part2.mp4'\nfile 'part1.mp4'\n" > parts.txt
    ffmpeg -f concat -i parts.txt -c copy -movflags +faststart reversed-parts.mp4
  3. A boomerang

    Take 3 s, split it, reverse one copy and join the two with concat. The result plays forward and back in 6 seconds; loop it on a page for the effect.

    boomerang
    ffmpeg -i clip.mp4 -filter_complex "[0:v]trim=0:3,setpts=PTS-STARTPTS,split[fwd][tmp];[tmp]reverse[rev];[fwd][rev]concat=n=2:v=1:a=0" \
      -an -c:v libx264 -crf 20 -preset veryfast -movflags +faststart boomerang.mp4

The flags

The options in these commands

The options in these commands
FlagWhat it doesUsed here
reverseBuffers every video frame, then outputs them last to firstAll four
areverseThe same for audioReverse, smaller, parts
scale=-2:540Shrinks frames before they are buffered; -2 keeps the width evenSmaller
-ss 5Before -i: starts reading the input at 5 sParts
-t 5Reads 5 s of the inputParts
-f concatJoins the files in a list, in list orderParts
trim=0:3Keeps the first 3 s inside the graphBoomerang
concat=n=2:v=1:a=0Joins 2 video segments with no audioBoomerang

Sources: ffmpeg filters: reverse, areverse, ffmpeg formats: concat demuxer, checked November 2026.

Where the memory goes

The manual is blunt: "This filter requires memory to buffer the entire clip, so trimming is suggested." Nothing comes out until the last frame is in. Decoding our clip to a null output used little memory; adding reverse took it close to 1 GB, about what the raw frames take.

That grows with length. A minute of 1080p at 30 fps is 1800 frames, about 5.6 GB of buffer, before the encoder adds its own share. Shrink the frames, trim the clip, or reverse it in parts.

Why parts work

Each part only buffers its own frames: our two halves each peaked about a quarter lower than the whole clip. The saving is small on a clip this short and grows with length, because each buffer depends only on its own part.

The join needs no re-encode because both parts came out of the same encoder settings. Our 2 parts joined into one file with every frame in place.

On the API

reverse, areverse, trim and concat are all allowed on POST /v1/ffmpeg; the full-HD job above took about 8 seconds. A minute of 1080p at 30 fps already needs 5.6 GB of frames, so trim, scale or split long clips and send each part as its own job. Billing is per compute second; see pricing.

Without installing ffmpeg

The same command as one API call

Send the first command's args to POST /v1/ffmpeg. Each job runs ffmpeg 8.1 on a fresh machine at $0.02 per compute minute, billed per second; this one finished in about 8 seconds and cost under a third of a cent.

terminalTry it
curl "https://api.reelsdk.com/v1/ffmpeg?wait=60" \
  -H "Authorization: Bearer $REELSDK_KEY" \
  --json '{
    "inputs": {
      "in.mp4": "https://api.reelsdk.com/f/lib/demo/landscape.mp4"
    },
    "args": [
      "-i", "in.mp4", "-vf", "reverse", "-af", "areverse", "-c:v", "libx264",
      "-crf", "20", "-preset", "veryfast", "-c:a", "aac", "-movflags",
      "+faststart", "reversed.mp4"
    ],
    "outputs": ["reversed.mp4"]
  }'
reversed.mp4 from the API: the full 10 seconds, picture and sound reversed.Input: 1920x1080 input

FAQ

Questions, answered

How do I reverse a video with ffmpeg?

Run ffmpeg -i in.mp4 -vf reverse -af areverse with an encoder for each stream. Our 10-second 1080p clip took about 13 seconds.

Why does ffmpeg use so much memory to reverse a video?

reverse keeps every decoded frame until the input ends. A 1920x1080 frame is about 3 MB, so 10 seconds at 30 fps need close to 1 GB.

How do I reverse a long video?

Cut it into parts with -ss and -t, reverse each part, then join them last part first with the concat demuxer and -c copy.

Can I reverse a video without re-encoding?

Not with ffmpeg: reverse is a filter, filters work on decoded frames, so the video is encoded again.

Ready to build?

Ship video from your app today

Your first $0.50 is free, and one key covers every endpoint.

Moonlit lake with a lit cabin under the mountains