0
My purpose is to map multiple audios to one channel and trim them.
There is my ffmpeg command.
ffmpeg -framerate 30 -i test_%03d.png
-ss 5 -t 20 -i s01.wav
-ss 10 -t 30 -i s02.wav
-filter_complex "[1]adelay=10000|10000,apad[a1];
[2]adelay=15000|15000[a2];
[a1][a2]amerge=2[a]" \
-map 0:v -map "[a]" -c:v libopenh264 -c:a mp3 test.mp4
It works perfectly when there are only two sound streams, if I want to map three sound streams it didn't trim them properly.
I think the reason is I set apad incorrectly.
Please tell me how to map and trim multiple streams in the same time.
With more streams(adelay might not the actually number I used in the command):
ffmpeg -framerate 30 -i test_%03d.png
-i s01.wav
-i s02.wav
-i s03.wav
-i s04.wav
-filter_complex "[1]adelay=10000|10000,apad[a1];
[2]adelay=15000|15000,apad[a2];
[3]adelay=12000|15000,apad[a3];
[4]adelay=20000|10000[a4];
[a1][a2][a3][a4]amerge=4[a]" \
-map 0:v -map "[a]" -c:v libopenh264 -c:a mp3 test.mp4
Show the command you tried with three audio streams. – Gyan – 2018-01-05T06:19:52.950
@Mulvya I added new command to my question. – Ives – 2018-01-05T06:59:42.693
Just to be sure, your command isn't trimming in advance any of the streams, only delaying and merging them. The merged stream should end when s04 does. What are you seeing? – Gyan – 2018-01-05T07:46:18.270
I skipped the -ss -t but I think it doesn't change the apad result, should I add apad parameter to each stream except last one? – Ives – 2018-01-05T07:53:34.667
Your command already does that, but yes. Add it all streams except one. – Gyan – 2018-01-05T08:40:01.323
except last one? last one might be shortest is that ok? – Ives – 2018-01-05T08:46:53.133
Add to all streams except the one whose duration you want to preserve. – Gyan – 2018-01-05T08:51:25.737
kinda confused, so it should be the longest one? – Ives – 2018-01-05T09:02:40.060
Decide which stream should be preserved in full. Add apads to all other streams. – Gyan – 2018-01-05T09:44:29.927