Changes between Version 6 and Version 7 of How to speed up / slow down a video
- Timestamp:
- 01/09/2013 01:47:28 PM (4 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
How to speed up / slow down a video
v6 v7 1 = Speeding up/slowing down video = 2 1 3 You 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 :) 2 4 3 5 To speed up your video, you can type: 4 6 {{{ 5 ffmpeg -i input. avi -vf "setpts=0.5*PTS" output.avi7 ffmpeg -i input.mkv -filter:v 'setpts=0.5*PTS' output.mkv 6 8 }}} 7 9 … … 9 11 10 12 {{{ 11 ffmpeg -i Input.mp4 -r 16 -vf setpts=0.125*PTS -an Output.mp413 ffmpeg -i input.mkv -r 16 -filter:v 'setpts=0.125*PTS' -an output.mkv 12 14 }}} 13 15 … … 15 17 To slow down your video, you can type: 16 18 {{{ 17 ffmpeg -i input. avi -vf "setpts=2.0*PTS" output.avi19 ffmpeg -i input.mkv -filter:v 'setpts=2.0*PTS' output.mkv 18 20 }}} 21 22 == Speeding up/slowing down audio == 23 24 You can speed up or slow down *audio* with the atempo audio filter. To double the speed of audio: 25 26 {{{ 27 ffmpeg -i input.mkv -filter:a 'atempo=2.0' -vn output.mkv 28 }}} 29 30 The 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 {{{ 33 ffmpeg -i input.mkv -filter:a 'atempo=2.0,atempo=2.0' -vn output.mkv 34 }}} 35 36 Using a complex filtergraph, you can speed up video and audio at the same time: 37 38 {{{ 39 ffmpeg -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 }}}


