Title: FFMPEG merge many audio files with a specific positions(start/end) in a video without the audio of the video
Tags: audio;video;ffmpeg
Question: Here how I merge many audio file in a video using ffmpeg.
ffmpeg -y -i original1.mp4 -i music1.mp3 -i music2.mp3 -i music3.mp3 -filter_complex "[1]adelay=5000|5000[aud1];[2]adelay=10000|10000[aud2];[3]adelay=120000|120000[aud3];[aud1][aud2][aud3]amix=3[a]" -map 0:v -map "[a]" -c:v copy originalMovie1.mp4
It works merging the audio in my video and I can point the start of audio but I want to end some audio in a specific time base on the duration of the video. The original audio of the video has been also removed. Is it possible to retain the audio of the video while merging it to new audios ?
Do you know how I can put the time to end the audio without losing the original audio of the video file?
Thank you


Here is another answer: ffmpeg -y -i original1.mp4 -i music1.mp3 -i music2.mp3 -i music3.mp3
-filter_complex "[1]adelay=5000|5000[aud1];[2]adelay=10000|10000[aud2];
[3]adelay=120000|120000[aud3];[aud1][aud2][aud3]amix=3,apad[a];
[0:a][a]amerge[a]"
-map 0:v -map "[a]" -c:v copy -ac 2 originalMovie1.mp4
Comment for this answer: Replace with `[0:a][a]amix=duration=first[a]`
Comment for this answer: Thank you for your answer but it returns an error
[Parsed_amerge_5 @ 0x43b36c0] No channel layout for input 1
[Parsed_amerge_5 @ 0x43b36c0] No channel layout for input 2
[AVFilterGraph @ 0x405c900] The following filters could not choose their formats: Parsed_amerge_5
Consider inserting the (a)format filter near their input or output.
Error reinitializing filters!
Failed to inject frame into filter network: Input/output error
Error while processing the decoded data for stream #0:1
Comment for this answer: ffmpeg -y -i original1.mp4 -i music1.mp3 -i music2.mp3 -i music3.mp3        -filter_complex "[1]adelay=5000|5000[aud1];[2]adelay=10000|10000[aud2]; \
[3]adelay=120000|120000[aud3];[aud1][aud2][aud3][0:a][a]amix=duration=first[a]"                    -map 0:v -map "[a]" -c:v copy -ac 2 originalMovie1.mp4
Hi Gyan I have tried to replace it but it produce error Too many inputs specified for the "amix" filter.
Error initializing complex filters.
Invalid argument
Thank you

{'source': 'StackExchangeDataset', 'subset': 'superuser.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2018:00:06/04/18', 'FavoriteCount': 2.0, 'PostTypeId': 1, 'Tags': '<audio><video><ffmpeg>', 'Title': 'FFMPEG merge many audio files with a specific positions(start/end) in a video without the audio of the video', 'ViewCount': 1866, 'id': 1328404, 'user_AboutMe': '<p>In the day I am a software developer who works for a Japanese Company that is based here in Cebu. Mainly I am working with php technology and using javascript, html5 and css for my frontend.\nBy night I code for self improvement and study.\nExploring new technology makes me happy.</p>\n', 'user_AccountId': 13515800.0, 'user_DisplayName': 'Jolly Ann Dolloso', 'user_Reputation': 21.0, 'user_Views': 3.0, 'user_id': 910405.0}}