Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Raising OnErrorThrownEventArgs instead of an exception when an error occurs in FFmpeg #38

Open
Japollack opened this issue Apr 7, 2016 · 3 comments
Labels

Comments

@Japollack
Copy link

This is more like an suggestion than an issue:

I would like to be able to handle public Engine.OnError event if an error occurs from FFMpeg.

Currently it is privatly handled in the Engine.FFmpegProcess.ErrorDataReceived but AFAIK it does not notify user about it. Instead, it should invoke the OnError event handler. The user then could log the error and decide if the process should be canceled or ignored.

@AydinAdn
Copy link
Owner

AydinAdn commented Apr 8, 2016

The issue is that FFmpeg writes to STDERR, so we can only read the output from ErrorDataReceived. This is how we raise progress events and completion events by reading the output and attempting to serialise it,

If FFmpeg exits with errors, it will return an ExitCode of something other than 0 or 1, in such situations the an exception is composed and thrown. You can find the code below in Engine.cs at the end,

if ((this.FFmpegProcess.ExitCode != 0 && this.FFmpegProcess.ExitCode != 1) || caughtException != null)
{
    throw new Exception(
    this.FFmpegProcess.ExitCode + ": " + receivedMessagesLog[1] + receivedMessagesLog[0],
    caughtException);
}

@AydinAdn AydinAdn closed this as completed Apr 8, 2016
@Japollack
Copy link
Author

That is all fine but instead of throwing a new exception would it not be great if the OnError event is invoked? Ofcourse, if no OnError event handler is attached an exception is thrown.

@AydinAdn
Copy link
Owner

AydinAdn commented Apr 8, 2016

Ah my bad, I misunderstood you. I like that idea!

If I'm honest... I want to bulldoze the entire thing and rebuild from scratch, sometimes I wonder if I was drunk the entire time I was writing the damn thing.

@AydinAdn AydinAdn changed the title Not able to catch errors from FFMpeg Feature request: Raising OnErrorThrownEventArgs instead of an exception when an error occurs in FFmpeg Apr 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants