Reverse a Video with FFmpeg made Ridiculously Easy

Tags:

It’s very easy to reverse a video using FFmpeg because FFmpeg has a built-in reverse filter that can do this job for both audio and video! Let’s learn how in this tutorial and some gotcha’s that you should avoid.

Reverse a Video using FFmpeg

Here it is! A simple one-liner that takes your video and reverses it.

ffmpeg -i originalVideo.mp4 -vf reverse reversedVideo.mp4

And if you want to reverse the audio and video, all you gotta do is use this command.

ffmpeg.exe -i originalVideo.mp4 -vf reverse -af areverse reversedVideo.mp4

It’s as simple as that.

I used it on the Parkjoy sequence downloaded from xiph. Note, that the original video is in y4m format and I first transcoded it to H.264/AVC using crf=1 and then added timestamps for this fun experiment.

If you want to learn how to add timestamps to your video using the drawtext filter, then read this tutorial on OTTVerse.com.

Here is the original sequence

And here is the reversed sequence – fun right?

Caution for Large Files

The problem with the reverse filter is that it loads the sequence into memory and if you try this on large sequences, you could very easily run out of memory.

The solution for this is to split your video into small pieces or segments, reverse each of them, and join them in the reverse order (yea, remember that!).

If you don’t know how to cut a video into small pieces, check out our tutorial on trimming or cutting videos.

About The Author

I’m Dr. Krishna Rao Vijayanagar, and I am the Founder and Editor of OTTVerse.com. I've spent several years working hands-on with Video Codecs (AVC, HEVC, MultiView Plus Depth), ABR streaming, and Video Analytics (QoE, Content & Audience, and Ad). I hope to use my experience and love for video streaming to bring you information and insights into the OTT universe. Please use the Contact Page to get in touch with me.

Leave a Reply