Ffmpeg: How to Set "Apad" Parameter

Ffmpeg: How to Set "Apad" Parameter

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  

Here is the original question

9
Sophia Al-Mansoor
Author

Sophia Al-Mansoor

Sophia analyzes international trade, startup ecosystems, retail transformation, and supply chain logistics for modern digital publications.