user3552325
user3552325

Reputation: 415

Merge video and audio while delaying audio by x seconds

This works for merging audio and video

 ffmpeg -i video.mp4 -i audio.ogg -filter_complex "[0:a][1:a]amerge=inputs=2[a]" -map 0:v -map "[a]" -c:v copy -c:a libvorbis -ac 2 -shortest out.mp4 -y -nostdin

I can't figure out how to delay the audio so it starts x seconds into the video. I have tried -itsoffset but it doesn't work.

Upvotes: 1

Views: 1017

Answers (2)

Gyan
Gyan

Reputation: 92928

Use

ffmpeg -i video.mp4 -i audio.ogg -filter_complex "[1:a]adelay=1000|1000[a1];[0:a][a1]amerge=inputs=2[a]" -map 0:v -map "[a]" -c:v copy -c:a libvorbis -ac 2 -shortest out.mp4 -y -nostdin

The adelay adds 1000 ms of silence to both channels of the OGG.

Upvotes: 4

Bryan Newman
Bryan Newman

Reputation: 631

This is more of a workaround, but you could concatenate 1 second of silence with your ogg first:

https://trac.ffmpeg.org/wiki/Concatenate

Upvotes: 0

Related Questions