9

What I'd like to achieve is getting the same effect as I get with (assuming 1.7x speed up) :

mplayer -af scaletempo -speed 1.7 myvideo.mp4

This command gives me exactly what I want, but I need to save the result in file somehow.

What I don't want to get is this:

mplayer -vf scale -speed 1.7 myvideo.mp4

I need this to be done in file (file has to be recoded) because I have to play it outside Linux box.

CLI is preferable, because I want to make it in script. Googled around a lot and found lots of suggestions - ffmpeg, mencoder and many funny exotic uncompilable tools, nothing gives me the exact result. Actually almost nothing of this works (I guess it worked in sometime, long long ago).

Unfortunately I upgraded and use Ubuntu 13.04 and it seems that almost all solutions do not work in this version ;(

2 Answers 2

19

setpts & atempo filters

Examples using ffmpeg with the setpts and atempo filters:

Fast motion

ffmpeg -i input -filter_complex "[0:v]setpts=PTS/2[v];[0:a]atempo=2[a]" -map "[v]" -map "[a]" output

Slow motion

ffmpeg -i input -filter_complex "[0:v]setpts=PTS/0.5[v];[0:a]atempo=0.5[a]" -map "[v]" -map "[a]" output

Range for atempo value is 0.5-100.

setpts & rubberband filters

Alternatively you can use the rubberband filter instead of atempo, and it may sound better, but your ffmpeg will need to be compiled with --enable-librubberband. You can refer to ffmpeg -filters to see if you can use it.

Fast motion

ffmpeg -i input -filter_complex "[0:v]setpts=PTS/2[v];[0:a]rubberband=tempo=2[a]" -map "[v]" -map "[a]" output

Slow motion

ffmpeg -i input -filter_complex "[0:v]setpts=PTS/0.5[v];[0:a]rubberband=tempo=0.5[a]" -map "[v]" -map "[a]" output
3
  • 1
    you literally saved me. Didn't even know that ffmpeg in Ubuntu is something ancient. I used static build, because there is no ppa or deb for 13.04 and compiling looks really painful. Jul 8, 2013 at 13:24
  • This worked perfectly for me. Thanks so much!
    – Ryan
    Sep 30, 2015 at 18:27
  • Weirdly I found rubberband to be worse than atempo at the same tempo. Sep 24, 2021 at 12:42
0

Try this:

Video:

mkfifo stream.yuv
mplayer -vf scale -speed 1.7 -vo yuv4mpeg source.avi

cat stream.yuv | yuv2lav -o result.avi

or

ffmpeg -i source.avi -filter "setpts=PTS/1.7" result.avi

Audio:

mplayer -vf scale -speed 1.7 -vo null -ao pcm -ao pcm:file=result.wav source.avi

Result files: result.avi, result.wav

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .