DEV Community

Cover image for Speed up your video
Dr. Gernot Starke
Dr. Gernot Starke

Posted on

Speed up your video

In case you want a video to play faster, you have a few options:

  • some video players (like Elmedia Player (Mac only) or similar tools) allow faster or slower playback.
  • Use a video editing tool (like DaVinci Resolve or similar tools) to either speed up or slow down your video
  • Use the free ffmpeg tool on the command line to modify the duration of a video. (ffmpeg can perform a lot of other cool things with video, have a look at their website.

Let's look at an example: Below you find a 6-minute video, plus a 14 second version of the same visual content... just lot's faster.

Original (Slow) Video

High-Speed Video

ffmpeg Solution

ffmpeg: A complete, cross-platform solution to record, convert and stream audio and video.

  1. Obviously, you need to install ffmpeg first. The ffmpeg website has instructions for you. (You can use a package manager like brew)
  2. Open a terminal, head over to a directory containing your original (slow) video.

Now for the good stuff:

$ ffmpeg -i Yoda-Autoplay-compact.mp4  -vf "setpts=(PTS-STARTPTS)/5" -crf 18 yoda-autoplay-fast.mp4
Enter fullscreen mode Exit fullscreen mode

The magic happens in the parameter setpts=(PTS-STARTPTS)/5, which reduces the duration to one fifth.

For the example above, I used a factor of 30 to reduce the duration from approx 6 minutes to approx 15 seconds.

Hope you find this info useful - all kudos to the ffmpeg developers.

Top comments (0)