Changes between Version 6 and Version 7 of How to speed up / slow down a video


Ignore:
Timestamp:
Jan 9, 2013, 2:47:28 PM (4 years ago)
Author:
evilsoup
Comment:

Added atempo filter & speeding up video and audio at the same time

Legend:

Unmodified
Added
Removed
Modified
  • How to speed up / slow down a video

    v6 v7  
     1= Speeding up/slowing down video = 
     2 
    13You can change the speed of your video using [http://ffmpeg.org/ffmpeg.html#asetpts_002c-setpts setpts] video filter.  The "old way" of creating timelapse or still frame was to first split up a video into individual frames, (for instance, as jpg's) then delete some and recombine the frames.  Using the setpts filter is the new way and is faster and possibly less lossy :) 
    24 
    35To speed up your video, you can type: 
    46{{{ 
    5 ffmpeg -i input.avi -vf "setpts=0.5*PTS" output.avi 
     7ffmpeg -i input.mkv -filter:v 'setpts=0.5*PTS' output.mkv 
    68}}} 
    79 
     
    911 
    1012{{{ 
    11 ffmpeg -i Input.mp4 -r 16 -vf setpts=0.125*PTS -an Output.mp4 
     13ffmpeg -i input.mkv -r 16 -filter:v 'setpts=0.125*PTS' -an output.mkv 
    1214}}} 
    1315 
     
    1517To slow down your video, you can type: 
    1618{{{ 
    17 ffmpeg -i input.avi -vf "setpts=2.0*PTS" output.avi 
     19ffmpeg -i input.mkv -filter:v 'setpts=2.0*PTS' output.mkv 
    1820}}} 
     21 
     22== Speeding up/slowing down audio == 
     23 
     24You can speed up or slow down *audio* with the atempo audio filter. To double the speed of audio: 
     25 
     26{{{ 
     27ffmpeg -i input.mkv -filter:a 'atempo=2.0' -vn output.mkv 
     28}}} 
     29 
     30The atempo filter is limited to using values between 0.5 and 2.0 (so it can slow it down to no less than half the original speed, and speed up to no more than double the input). If you need to, you can get around this limitation by stringing multiple atempo filters together. The following with quadruple the audio speed: 
     31 
     32{{{ 
     33ffmpeg -i input.mkv -filter:a 'atempo=2.0,atempo=2.0' -vn output.mkv 
     34}}} 
     35 
     36Using a complex filtergraph, you can speed up video and audio at the same time: 
     37 
     38{{{ 
     39ffmpeg -i input.mkv -filter_complex '[0:v]setpts=0.5*PTS[v];[0:a]atempo=2.0[a]' -map '[v]' -map '[a]' output.mkv 
     40}}}