

Then all we need to do is concatenate everything: ffmpeg -f concat -safe 0 -i fileList.txt -c copy final_revered_video.FFmpeg is a tool that can be used to edit or convert videos and audios.It includes libavcodec – the audio/video codec library. SegmentedVideos/*_reversed.mp4 doĪt this point you should have a text file fileList.txt that contains the video files in reverse order like this: file './video_XXX_reversed.mp4' You can automatically create this text file using the following: for f in. To do that we need a text file with all the files we want to concatenate.

The final command concatenates them into a single video. You will now have a set of reversed segments med video_000_reversed.mp4, video_001_reversed.mp4 etc. NOTE: Make sure you remove the original video video.mp4 from the folder before using this loop (otherwise you are back to the start). This loop looks for all mp4 files in the current directory and reverses each of them: for f in *.mp4 doįfmpeg -i $f -vf reverse $ Alternatively for long videos you might want to use a loop. You can either do that manually using the original reverse command. Next you need to reverse each of these segments. This will output a bunch of video files named video_000.mp4, video_001.mp4 etc. You can first segment a video into 300 second chunks using: ffmpeg -i video.mp4 -map 0 -c copy -f segment -segment_time 300 -reset_timestamps 1 video_%03d.mp4 Here is how to segment the video, reverse each part, and then concatenate them again.

Therefor for any reasonably sized video (> 10 minutes) you are going to have a tough time using the above command. To reverse it, it needs basically load each frame of the video into memory. I wont go into details but it has to do with the video is saved in a compressed format. However this is incredibly memory intensive. You can reverse a video using ffmegs built in reverse video filter: ffmpeg -i video.mp4 -vf reverse video_reversed.mp4
