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
ffmpeg -i in.mp4 -vf reverse -af areverse \
-c:v libx264 -crf 20 -preset veryfast -c:a aac -movflags +faststart reversed.mp4reverse 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
Shrink first
Put
scalebeforereverseand 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.mp4Long 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.mp4A boomerang
Take 3 s,
splitit, reverse one copy and join the two withconcat. 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
| Flag | What it does | Used here |
|---|---|---|
reverse | Buffers every video frame, then outputs them last to first | All four |
areverse | The same for audio | Reverse, smaller, parts |
scale=-2:540 | Shrinks frames before they are buffered; -2 keeps the width even | Smaller |
-ss 5 | Before -i: starts reading the input at 5 s | Parts |
-t 5 | Reads 5 s of the input | Parts |
-f concat | Joins the files in a list, in list order | Parts |
trim=0:3 | Keeps the first 3 s inside the graph | Boomerang |
concat=n=2:v=1:a=0 | Joins 2 video segments with no audio | Boomerang |
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.
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"]
}'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.
- Loop a video with ffmpegRepeat a clip a set number of times or to a length with -stream_loop, without re-encoding, or with the loop filter inside a graph.
- Speed up or slow down video with ffmpegChange playback speed with setpts for the picture and atempo for the sound, from timelapse to smooth slow motion.
- Trim a video with ffmpegCut a clip with -ss and -to: frame-exact with a re-encode, fast with -c copy, and why the copy starts before your time.
- Concatenate videos with ffmpegJoin clips with the concat demuxer and -c copy when they match, or with the concat filter when their size, frame rate or codec differ.
- Video to GIF with ffmpegMake a clean GIF from a video with palettegen and paletteuse, then shrink it with frame rate, size, colours or a different format.
- ffmpeg -filter_complex explainedLabels, commas and semicolons: how a filtergraph wires inputs to outputs, with four working graphs and the errors they fix.
- FFmpeg onlineRun your own ffmpeg command on your files in the browser, free and without installing or uploading anything.
- ffmpeg exited with code 1: Conversion failed!fluent-ffmpeg reports only ffmpeg's exit code and last line. The real cause is in stderr: print it, or use -v error to see it alone.
- ReelSDK vs self-hosted FFmpegTranscoding a minute of 1080p to 720p takes about 24 seconds of compute: about 0.8 cents on ReelSDK, about a tenth of a cent on a busy 4 vCPU box. Below about 11,000 minutes a month, the API costs less than an always-on box.
Sources, checked November 2026
Ready to build?
Ship video from your app today
Your first $0.50 is free, and one key covers every endpoint.
