8

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 ;(

13

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
  • 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. – Viacheslav Rodionov Jul 8 '13 at 13:24
  • This worked perfectly for me. Thanks so much! – Ryan Sep 30 '15 at 18:27
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.