Streampunk/beamcoder

Encoder message error catching

Closed this issue · 1 comments

Hello,

Thanks for this great library.

I was wondering if it would be possible to catch the errors given.
When i'm setting up the parameters wronlgly, for the encoder, i'm often having important/interesting messages like

[mpeg2video @ 0x7fc8c00ba500] The encoder timebase is not set.

Next time when the system is logging

[NULL @ 0x7fc8c00ba500] No codec provided to avcodec_open2()

I see the message in the console, but i was wondering if there is any way to catch this message.

  • the code does not throw an error
  • I have checked in the encoder instance, and encoder.error is null

The only thing i could detect programmatically is an empty {packets: []}

Do you have any idea of how to detect/catch this kind of error from the code, instead of relying on the stdout/stderr.

Would it be technically feasible to add an event .on('error', err => {}) or .on('message', msg => {}) in the encoder ?

After seeing av_log_set_callback

It should be possible to add something like beamcoder.setLoggingCallback((message, level) => {})