AlexZheda
AlexZheda

Reputation: 475

The audio disappears from 2/3 of the video after speeding up with ffmpeg

I have tried to speed up a video file (with the audio stream) 8 times with ffmpeg using the script below. All works well that from a 50 hour video I get a 7-hour video with the audio sped up also, yet in the resulting file the audio lasts for just over 2 hours and silences after that, i.e. there video without audio.

ffmpeg -i video.mp4 -filter_complex "[0:v]setpts=0.5*PTS,setpts=0.5*PTS,setpts=0.5*PTS[v];[0:a]atempo=2.0,atempo=2.0,atempo=2.0[a]" -map "[v]" -map "[a]" video_x8.mp4

EDIT: video.mp4 file enter image description here

video_x8.mp4 file (naming is different for the clear picture) enter image description here

EDIT 1. Here are the full 100MB logs. https://gofile.io/?c=L0Au2e

EDIT 2: Thank you Gyan. But could you please help me write it in 1 command so that it works in 1 go? enter image description here

Upvotes: 1

Views: 230

Answers (1)

Gyan
Gyan

Reputation: 92928

As far as I can tell, the atempo (whether due to the chaining or otherwise), is not updating timestamps correctly, so the remedy is to insert asetpts afterwards.

ffmpeg -i video.mp4 -vf "setpts=0.125*PTS" -af "atempo=8.0,asetpts=N/SR/TB" video_x8.mp4

Upvotes: 1

Related Questions