radek-k / FFMediaToolkit

FFMediaToolkit is a cross-platform video decoder/encoder library for .NET that uses FFmpeg native libraries. It supports video frames extraction, reading stream metadata and creating videos from bitmaps in any format supported by FFmpeg.
MIT License
352 stars 56 forks source link

Uncatchable exception crashes process when reading all frames #60

Closed marksugrue closed 3 years ago

marksugrue commented 3 years ago

I'd like to use TryReadNextFrame to read all the frames in a video. When I try, my application crashes after a few hundred frames with an uncatchable exception (Event Viewer logs an 'application error' code 0x0000374, heap corruption)

My code is this:

using (var file = MediaFile.Open(filename)) while (file.Video.TryReadNextFrame(out var imageData)) { //Code to use the imageData will go here, but currently this is blank. Exception happens anyway after about 800-900 frames. }

Using Dot Net Framework 4.7