Need help to change working ffmpeg command to overlay instead of concatenate two audio files at specific position

余生长醉 提交于 2021-01-29 06:51:01

问题


By asking another question here, I got working code

ffmpeg -i input.mp3 -i second.mp3 -filter_complex "[0:a]atrim=end=10,asetpts=N/SR/TB[begin];[0:a]atrim=start=10,asetpts=N/SR/TB[end];[begin][1:a][end]concat=n=3:v=0:a=1[a]" -map "[a]" output

The code inserts second.mp3 into the input.mp3 at 10 seconds.

But now I need to overlay second.mp3 into the input.mp3 starting at 10seconds. In other words I need playing input.mp3 and after 10 seconds I need start playing second.mp3 simultaneously.

The code I have been given keeps the params of input.mp3 and changes everything about second.mp3 to match input.mp3.

Could you help me altering the command I have to do the overlay...


回答1:


Use

ffmpeg -i input.mp3 -i second.mp3 -filter_complex "[1:a]adelay=10000|10000[1a];[0:a][1a]amix" output

The adelay delays the 2nd audio start by 10 seconds. The amix mixes the two audios together.



来源:https://stackoverflow.com/questions/55040846/need-help-to-change-working-ffmpeg-command-to-overlay-instead-of-concatenate-two

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!