Add audio at specific time in video using ffmpeg
--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Puddle Jumping Looping
--
Chapters
00:00 Add Audio At Specific Time In Video Using Ffmpeg
02:08 Accepted Answer Score 16
02:35 Thank you
--
Full question
https://superuser.com/questions/708125/a...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#audio #video #ffmpeg #android
#avk47
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Puddle Jumping Looping
--
Chapters
00:00 Add Audio At Specific Time In Video Using Ffmpeg
02:08 Accepted Answer Score 16
02:35 Thank you
--
Full question
https://superuser.com/questions/708125/a...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#audio #video #ffmpeg #android
#avk47
ACCEPTED ANSWER
Score 16
I finally solved the problem by adding just 1 option -async
ffmpeg -y -i a.mp4 -itsoffset 00:00:30 -i sng.m4a -map 0:0 -map 1:0 -c:v copy -preset ultrafast -async 1 out.mp4
By default audio/video timestamps are stretched to match each other; which was my problem of audio starting from initial even after giving the "itsoffset" option.
As per Ffmpeg Doc, using -async 1
corrects the initial timestamp of audio only. I know that this option is deprecated; but anyhow it solved my case.