简体   繁体   中英

Mix audio input with video to specific location with FFmpeg

I created small video editing tool with which you can put some overlay images to the video and show them at specific locations and durations (filter: overlay=enabled(from, to...), etc.). Now I also want to add some short audio sounds on the same way like pictures -> adding them to a specific time in the video. That means that overlays and audio sounds should be in one command if possible. I am using amix to merge all sound channels (video.mp4 and sound.mp3) but the thing is that they both start at the beginning. I tried with adelay=1500 but then I actually delay one channel that means I hear duplicate sounds with 1.5 sec delay. So I would like to delay only sound.mp3 input. Am I doing something wrong?

My try was that:

-i video.mp4 -i sound.mp3 -filter_complex amix -preset ultrafast -vcodec libx264 -r 24 -profile:v baseline -threads 14 video_output.mp4

Thank you very much!

I'm still fairly new to using FFMPEG but i've used "-ss 0.3 -i INPUT" to fix offset/latency on mixing of two audio files.

Try this:

    -i video.mp4 -ss 0.015 -i sound.mp3 -filter_complex amix -preset ultrafast -vcodec libx264 -r 24 -profile:v baseline -threads 14 video_output.mp4

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM