How-To: Alter Video Speed with FFmpeg and mjpegtools
Unfortunately my Linux based non-linear editing tool of choice, Open Movie Editor, doesn’t currently support directly altering video playback speed. For example, if you wanted a portion of your new compilation to run at 200% of original recorded speed, it can’t be done within OME. This exact functionality was something I needed for an existing editing project.
After some thought and investigation, such changes can be achieved through using a combination of FFmpeg and yuvfps, which is part of mjpeg tools, to alter the framerate of the desired footage. If your original file is PAL based, with a framerate of 25fps, changing the framerate to 50fps will result in the video running twice as fast, for half as long.
I didn’t initially have mjpegtools installed, but on my Debian based system this was easy enough with
sudo apt-get install mjpegtools
Next, the input video needs to be converted to yuv4mpegpipe format, passed through yuvfps and output to a new avi file. Here’s the command line I used to create a clip at 50fps:
ffmpeg -i input.dv -f yuv4mpegpipe - | yuvfps -s 50:1 -r 50:1 | ffmpeg -f yuv4mpegpipe -i - -b 28800k -y output.avi
Change the 50:1 ratios to whatever framerate you require. e.g. 100:1 for 100fps. Be sure to set the output file bitrate to a relevant quality level. Omitting this flag will result in a poor quality AVI output file by default.
The resulting AVI file was easily played back with Totem, and handled on the timeline admirably by OME.
Thanks to Victor Paesa on the FFmpeg mailing list for pointing me in the right direction.
Some other options to investigate include the new Libavfilter for FFmpeg and converting the original footage to a raw data file, which will lost the audio.