Search code examples
ffmpegvideo-streamingframe-rate

How to change video speed only while adding a same-speed separated audio stream with ffmpeg?


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.


Solution

  • 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