0
votes

I have 2 files: 1 video file (without sound) - length 6 seconds, 1 audio - length 10 seconds. Both audio and video contains same conversation, but audio starts 4 seconds earlier and after that was started video.

[----------] audio
    [------] video

So, I want to mix them together to video file with length 10 seconds where first 4 seconds black screen with audio then goes real video and audio.

[====------] audio+video (where '=' is black screen)

I hope my description was clear enough ). How can I do this with ffmpeg or gstreamer ?

1

1 Answers

1
votes

Let's say the video's resolution is WxH and framerate is F, and the difference in durations is D seconds, then the command is

ffmpeg -i video.mp4 -i audio.mp3 -f lavfi -i color=s=WxH:r=F -filter_complex
          "[0]setpts=PTS-STARTPTS+D/TB[v];[2][v]overlay=eof_action=endall[vid]"
       -map "[vid]" -map 1:a output.mp4