nekomata_saren@tg says to YSITD
比較懶的做法的是計數器 let ffmpegOngoing = 0; … while (ffmpegOngoing > 4) { await sleep(1000); } ffmpegOngoing++; ffmpeg… .on('error', () => { ffmpegOngoing--; reject() }) .on('finish', () => { ffmpegOngoing--; resolve() });