0

I have a video with audio (overlayvideo.mov) that I'm overlaying over another video (basefilem.mp4) and I'm starting the overlay at 20 seconds. The output (finalvideo.mp4) looks great, but the audio from the overlay is still starting at 00:00:00.000 instead of when I need it to start, which is 00:00:20.000 (which I set with itoffset).

I understand that itoffset only deals with video. So, how do I go about specifying in my command below to start the audio in the overlay at the same time as itoffset?

This is my current command. It works perfect except I'm just trying to figure out how & where to place the adelay filter with this so that the audio in the overlay starts at the same time as the overlay video (in this example, I need the overlay audio to start after 20 seconds)

ffmpeg -y -i basefilem.mp4 -itoffset 00:00:20.000 -i overlayvide.mov - ilter_complex "[1:v]scale=1280x720[ovrl];[0:v][ovrl]overlay=eof_action=pass[outv];[0:a][1:a]amix[outa]" -map [outv] -map [outa] -c:v mpeg4 -strict experimental -ascale:v 10 finalvideo.mp4
1
  • The complete console output is missing, and it would be nice if you format the command.
    – llogan
    Aug 29, 2015 at 2:30

1 Answer 1

1

After several hours of attempting various solutions with atrim and adelay, which none worked correctly for me, I ended up taking this route. Worked like a charm.

  1. Create [s1]. N is the number of seconds (to match video offset (itsoffset)) aevalsrc=0:d=N[s1]
  2. Concat [s1] and overlayvideo’s audio (where [s1] is placed before [1:a]): [s1][1:a]concat=n=2:v=0:a=1[ovrla]
  3. Amix audio from basevideo ([0:a]) with [ovrla]

    Ffmpeg -y -i basevideo.mp4 -itsoffset 4 -i overlayvideo.mov -filter_complex "aevalsrc=0:d=4[s1];[s1][1:a]concat=n=2:v=0:a=1[ovrla];[1:v]scale=1280:720[ovrl];[0:v][ovrl]overlay=eof_action=pass[outv];[0:a][ovrla]amix[outa]" -map [outv] -map [outa] -c:v mpeg4 -strict experimental -qscale:v 10 finalvideo.mp4

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .