Overlay audios together with ffmpeg and loop both of them for 3 minutes

I’m tryin to use ffmpeg in Flutter to overlay two audio files together and loop them for 3 minutes. Right now i have this command

 -i $path1 
 -i $path2 
  -filter_complex 
      \"
      [0]aloop=loop=-1:size=7938000[b]; 
      [1]aloop=loop=-1:size=7938000[a]; 
      [b][a]amix=inputs=2:duration=longest
     \" 
   -t 180 -c:a pcm_s16le $outputPath

The audio does come out for 3 minutes and the longer audio($path1) is looped for 3 minutes, but the second one only plays once at the beginning.

Read more here: Source link