FFmpegBlazor icon indicating copy to clipboard operation
FFmpegBlazor copied to clipboard

Is there a way to catch errors/exceptions coming from the ff.Run()?

Open WarrickWilson opened this issue 3 years ago • 4 comments

I'm doing a two-pass conversion on an MP4 to AVI. If it works, things seems great. But if my parameters will not allow a file to be created, I get an error that I can sort of see with logging messages, but I get an immediate RuntimeError: memory access out of bounds right after that. I'm running locally in a "Start without Debugging" mode. I'm not sure if it's something I'm doing, or if it's something happening in the code with this approach. Any ideas?

FFMpegBlazor_error_low_bitrate_with_exception

WarrickWilson avatar Jun 30 '22 01:06 WarrickWilson

Hi, thanks for reporting this issue, If possible can you share the code so I could reproduce on my end. Generally speaking there is a way to catch these errors, I had implemented for Calling Async js function in BlazorBindGen. I have seen this issue in original source lib https://github.com/ffmpegwasm/ffmpeg.wasm/issues/29

sps014 avatar Jun 30 '22 03:06 sps014

My code for this branch is in https://github.com/WarrickWilson/makeavifiles/tree/AddVideoDataRate

If you can let me know what I'm doing wrong, I'd appreciate it.

WarrickWilson avatar Jun 30 '22 12:06 WarrickWilson

For quick fix :

  1. You can reference lib directly,
  2. And you can wrap https://github.com/sps014/FFmpegBlazor/blob/7bc3fde9da68e34b7cbad4316e4915b222871c7f/FFmpegBlazor/wwwroot/blazorFfmpeg.js#L31 in try catch block
  3. send js exception as string to c# side(if you want).

sps014 avatar Jun 30 '22 12:06 sps014

I am rewriting FFMPEG with BlazorBindGen which can catch exception from JS process and redirect it to C# process. It may take time as Blazor threads are coming in few releases so waiting for it also.

sps014 avatar Jul 13 '22 05:07 sps014

Most of FFmpeg wasm exceptions are now catchable with https://github.com/sps014/FFmpegBlazor/commit/efb02a53476b7105b1c763f7fbfa73be47bb0740 commit.

sps014 avatar Jan 22 '23 12:01 sps014