1

I am able to do slow motion video using following command (found this at How to use slow motion effect in a specific time interval with ffmpeg):

ffmpeg -i input.mkv -filter_complex \
"[0:v]trim=0:10,setpts=PTS-STARTPTS[v1]; \
 [0:v]trim=10:30,setpts=PTS-STARTPTS[v2]; \
 [0:v]trim=start=30,setpts=PTS-STARTPTS[v3]; \
 [v2]setpts=PTS/0.5[slowv]; \
 [v1][slowv][v3]concat=n=3:v=1:a=0[out]" \
-map [out] output.mp4

but i also want to have same effect on audio such as that duration between 10-30 secs have slow motion audio else all other audio parts have normal speed.

Also the above command increase the video length, can some how it can be reduce to actual video length ?

Kindly someone help me out how to do this ?

1

You can't slow down a video and preserve its original length. You'll have to trim off some portion to do so.

To slow down the audio as well, do this

ffmpeg -i input.mkv -filter_complex \
"[0:v]trim=0:10,setpts=PTS-STARTPTS[v1]; \
 [0:v]trim=10:30,setpts=(PTS-STARTPTS)*2[v2]; \
 [0:v]trim=start=30,setpts=PTS-STARTPTS[v3]; \
 [0:a]atrim=0:10,asetpts=PTS-STARTPTS[a1]; \
 [0:a]atrim=10:30,asetpts=PTS-STARTPTS,atempo=0.5[a2]; \
 [0:a]atrim=start=30,asetpts=PTS-STARTPTS[a3]; \   
 [v1][a1][v2][a2][v3][a3]concat=n=3:v=1:a=1[v][a]" \
-map [v] -map [a] output.mp4
  • thanks @Mulvya is there any ratio (formula) between atempo(audio) and setpts(video)? for example if i want to slow down video 30 percent than what should be the value of atempo in this case ? – user1640954 May 4 '16 at 8:07
  • Slowing down 30% means playing it at 70% of original speed, so atempo=0.70 – Gyan May 4 '16 at 8:20

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.