Node-fluent-ffmpeg: only the first ffmpeg command created reports it's progress, subsequent commands are silent.

Created on 13 Aug 2019  路  2Comments  路  Source: fluent-ffmpeg/node-fluent-ffmpeg

Simply create 2 streams and add event listeners for 'progress' on both. You'll only get messages from the first command.

Most helpful comment

I'm not sure if this is also what is happening to you, but I found that if I do something like:

const command = ffmpeg(input).outputFormat('mp4').save(outputFile);
command.on('progress', () => ...);

Then it works once but not the second time. This was because there was a race condition, and the save() was sometimes happening before attaching the event listeners. Instead, this worked for me:

const command = ffmpeg(input).outputFormat('mp4');
command.on('progress', () => ...);
command.save(outputFile);

All 2 comments

I'm not sure if this is also what is happening to you, but I found that if I do something like:

const command = ffmpeg(input).outputFormat('mp4').save(outputFile);
command.on('progress', () => ...);

Then it works once but not the second time. This was because there was a race condition, and the save() was sometimes happening before attaching the event listeners. Instead, this worked for me:

const command = ffmpeg(input).outputFormat('mp4');
command.on('progress', () => ...);
command.save(outputFile);

Confirmed, this putting save before progress works for me too.

Was this page helpful?
0 / 5 - 0 ratings