12

My OS is Debian 8.

I have a file named clip01.mp4 that I would like to reverse, so it plays backwards. Audio can be discarded or reversed as well, doesn't matter.

Apparently ffmpeg is deprecated in favor of avconv, but I can't seem to find a solution that uses either tool!

I would like to keep the same video codec to avoid any sort of losses, if possible.

Command line tools are preferred, for ease of scripting.

  • 3
    To do this with ffmpeg / avconv you have to split the video into single frames, rename the frames so they are in reverse order, then build a new video. Take a look at encode video in reverse? – PM 2Ring Jul 7 '15 at 6:55
  • Have you tried with avidemux or kino? – YoMismo Jul 7 '15 at 8:42
  • 6
    ffmpeg is not, in fact, deprecated (though that's a common misunderstanding thanks to some poor wording on avconv's part…). – n.st Jul 25 '15 at 20:33
  • 3
    Ffmpeg is not deprecated anymore lwn.net/Articles/650495 – gena2x Jul 27 '15 at 12:28
16
+25

From https://stackoverflow.com/questions/2553448:

Dump all video frames

$ ffmpeg -i input.mkv -an -qscale 1 %06d.jpg

Dump audio

$ ffmpeg -i input.mkv -vn -ac 2 audio.wav

Reverse audio

$ sox -V audio.wav backwards.wav reverse

Cat video frames in reverse order to FFmpeg as input

$ cat $(ls -t *jpg) | ffmpeg -f image2pipe -vcodec mjpeg -r 25 -i - -i backwards.wav -vcodec libx264 -vpre slow -crf 20 -threads 0 -acodec flac output.mkv

Use mencoder to deinterlace PAL dv and double the frame rate from 25 to 50, then pipe to FFmpeg.

$ mencoder input.dv -of rawvideo -ofps 50 -ovc raw -vf yadif=3,format=i420 -nosound -really-quiet -o - | ffmpeg -vsync 0 -f rawvideo -s 720x576 -r 50 -pix_fmt yuv420p -i - -vcodec libx264 -vpre slow -crf 20 -threads 0 video.mkv
| improve this answer | |
  • 2
    cat $(ls -t *jpg) caused trouble, but this worked great cat $(ls *jpg |sort -n) – Aquarius Power Apr 13 '16 at 1:36
  • 3
    Ateempting to use -vpre slow resulted in File for preset 'slow' not found. – reducing activity Jan 26 '17 at 7:57
  • 1
    Also, I am not sure is it problem of vlc/mplayer or presented process but produced file is unplayable - in mplayer only left half is displayed and video display is very laggy, vlc crashes on opening video file. – reducing activity Jan 26 '17 at 7:58
6

kdenlive reverse clip https://userbase.kde.org/Kdenlive/Manual/Project_Menu/Reverse_Clip

right-click on the clip: clip jobs / reverse clip

| improve this answer | |
  • 2
    Indeed kdenlive 15.12.3 on Ubuntu 16.04 has this feature and it works. – Stéphane Gourichon Apr 22 '17 at 9:50
  • I am using Kdenlive Version 17.12.3 and there is no "reverse clip" option anymore – Leevi L Sep 2 '19 at 18:19
  • No, but there's "duplicate with speed change" and "-100%" is reverse in normal speed. – Stefan Witzel May 2 at 11:33
4

In Debian there's Avidemux program, with Reverse video filter. Just tested - works perfectly.

GTK, QT and command line versions available.

Edit: this plugin has been removed in Avidemux ver. 2.6. Use 2.5.6 and older.

| improve this answer | |
4

You could also use Openshot it's a very intuitive an easy to use video editor.

You have to right click on the imported clip then properties -> speed tab, change the direction of the clip.

| improve this answer | |
  • 1
    In my case openshot refused to import .mp4 as video. – reducing activity Jan 26 '17 at 6:55
  • 1
    In recent OpenShots (mine is 2.4.1), the setting is now called Time and it is not in the video clip properties; you have to right-click the clip itself in the timeline and then choose Time -> Backwards -> 1X or similar. – anol May 12 '18 at 20:13
1

AviSynth has a Reverse() command, which could be used ...

also see: "how do I make a video play backwards on virtual dub?"

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.