How to change video speed by ffmpeg?

杀马特。学长 韩版系。学妹 提交于 2019-12-10 11:37:57

问题


I'm using ffmpeg for video filter.

But, When I changed video speed, that time I got issue

  • Audio is longer than video :

    ffmpeg -i INPUT.mp4  -filter:v setpts=0.5*PTS -shortest -y -preset ultrafast OUTPUT.mp4
    

I want to set audio's length same as video's length.

  • shortest = to extend audio streams to the same length as the video stream

In my case, shortest is not working. Video file and audio file, both are different and then after merging in a video file. Video's last frame stop and audio is continued working.


回答1:


You can use complex filters

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

https://trac.ffmpeg.org/wiki/How%20to%20speed%20up%20/%20slow%20down%20a%20video




回答2:


Got it worked!!!

ffmpeg -filter_complex [0:v]setpts=0.5*PTS -i INPUT -i INPUT -filter_complex [1:a]apad -shortest -y -preset ultrafast OUTPUT 2>&1


来源:https://stackoverflow.com/questions/55565886/how-to-change-video-speed-by-ffmpeg

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!