Node-fluent-ffmpeg: logger defined but seeing no output

Created on 5 Nov 2014  路  12Comments  路  Source: fluent-ffmpeg/node-fluent-ffmpeg

I have new FfmpegCommand({logger: console.log}) here but am not seeing any output.

Any idea why?

Most helpful comment

I must admit, I just got caught up on the logger option as well and landed here because I was wondering why it wasn't working.

const log = (...args) => console.log(...args);
ffmpeg({source: filePath, logger: {debug: log, info: log, warn: log, error: log}})

I now use this which satisfies my requirements:

.on('progress', function(progress) {
    console.log('Processing: ' + progress.percent + '% done @ ' + progress.currentFps + ' fps');
})
.on('end', function(err, stdout, stderr) {
    console.log('Finished processing', err, stdout, stderr);
})

All 12 comments

As stated in the documentation:

  • logger: logger object with debug(), info(), warn() and error() methods (defaults to no logging)

console.log will not work there!

That was just an example. I also tried with the bunyan and winston logger. Both have these methods but it still does not work.

Fluent-ffmpeg does not log a lot of things, it mostly does when problems happen. What were you expecting to see ?

Ah ... I expected the whole ffmpeg output.

There is a workaround for now:

command.on('end', function(err, stdout, stderr) {
    console.log(stdout);
}

but I wish the logger option would output these lines in real-time.

That's not really an option, since ffmpeg rewrites its output multiple times during processing.

If you need progress info though, you can use the 'progress' event !

Ah, I think you should document that in the README.md - does the progress event come with stdout as a parameter?

The progress event is documented in the README. But I guess you're right about the logger parameter not being well described. I may even remove it from the README as it is mainly useful to diagnose failures in the test suite.

Yep it is documented but there is no stdout in the progress event.

Let's forget this. I'll stick to

command.on('end', function(err, stdout, stderr) {
    console.log(stdout);
}

but really, I wish there is an event to get the output in realtime. Similar like the message event in the avconv package at https://github.com/binarykitchen/avconv#how-to-watch-for-results-progress-meta-data-output-errors-exit-code

I just ran into the same issue. Logger was mentioned in the README, so I implemented it, then so no change. :)

Perhaps time to remove it from the README?

I must admit, I just got caught up on the logger option as well and landed here because I was wondering why it wasn't working.

const log = (...args) => console.log(...args);
ffmpeg({source: filePath, logger: {debug: log, info: log, warn: log, error: log}})

I now use this which satisfies my requirements:

.on('progress', function(progress) {
    console.log('Processing: ' + progress.percent + '% done @ ' + progress.currentFps + ' fps');
})
.on('end', function(err, stdout, stderr) {
    console.log('Finished processing', err, stdout, stderr);
})

Some thing here, the Log is poorly documented.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

echo66 picture echo66  路  3Comments

epdev picture epdev  路  3Comments

TomKaltz picture TomKaltz  路  5Comments

baoxiangyang picture baoxiangyang  路  3Comments

jsamos picture jsamos  路  6Comments