Kim Mỹ
Kim Mỹ

Reputation: 436

How to make multiple ffmpeg commands run in parallel

I'm using the following ffmpeg command to compress video:

`nice -n 10 ${ffmpegPath} -i "${chunkPath}" -c:v libx264 -preset fast -crf 28 "${compressedPath}"`

However, when I run two instances of ffmpeg of this command to achieve parallelism:

Either in two child processes within a single Node.js application or in two separate Node.js applications running at the same time, it seems only one command is processed, and the other is skipped.

I've noticed that 2 FFmpeg instances are loaded into RAM and both create a starting file for the final compressed video, they finish compression around the same time. However, the total processing time is effectively doubled compared to compressing a single video file alone, which only takes half the time.

I also try to pass the -threads argument but it produces same result.

Upvotes: -1

Views: 114

Answers (0)

Related Questions