I was able to reverse with:
ffmpeg -i input.mp4 -vf reverse output_reversed.mp4
And I can concat with:
ffmpeg -i input.mp4 -i input.mp4 -filter_complex "[0:0] [0:1] [1:0] [1:1] concat=n=2:v=1:a=1 [v] [a]" -map "[v]" -map "[a]" output.mp4
But can I concat with a reverse version of the video, with a single command?
What I am trying to achieve is a ping pong effect, where the video plays once, then plays backwards right after.
Thanks!
Use TikTok app (Android & iOS)To play a video backwards with this mobile tool, simply choose a video from your library or do a fresh recording. After that, go to the Effects tab, look for time effects and then choose “Reverse” and then press “Save” to keep the changes made.
FFmpeg can handle the entire process of transcoding, video and image manipulation (resizing, denoising, etc.), packaging, streaming, and playback. It is the most popular video and image processing software by a mile and is used by many companies across various industries.
Technically, you can do it using
ffmpeg -i input.mp4 -filter_complex "[0:v]reverse,fifo[r];[0:v][0:a][r] [0:a]concat=n=2:v=1:a=1 [v] [a]" -map "[v]" -map "[a]" output.mp4
But the reverse filter will use a lot of memory for large videos. I've added a fifo
filter to avoid frame drops. But test and see. (I haven't reversed the audio)
If your clip has no audio, the above command will throw an error – instead, use:
ffmpeg -i input.mp4 -filter_complex "[0:v]reverse,fifo[r];[0:v][r] concat=n=2:v=1 [v]" -map "[v]" output.mp4
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With