Closed MastalerzKamil closed 3 years ago
The StreamInfo.FrameCount can't be trusted to be accurate. There are two ways the value is filled.
There is a StreamInfo.IsFrameCountProvidedByContainer you can check to see if it was filled the first way. Otherwise it's the second. Here's the corresponding code. You shouldn't trust the frame count if it's provided by the container either. That isn't always accurate. This library really needs a better method for decoding.
What I did to dimiss that bug is using
try {
for() {
....
}
} catch(EndOfStreamException){}
It helped I don't know why
I recommend using ReadFrame(TimeSpan)
instead of ReadFrame(int)
. It is accurate both in constant and variable frame rate videos. I've also added a bool TryReadNextFrame
method that returns false
instead of throwing an EndOfStreamException
. See example code.
I'm using .NET Core 3.1. What I would like to do is decode whole mp4 file into frames. I have uploaded
.mp4
file inuploads
directory. I want to decode it and save all frames intopictures
directory. My code has been inspired by README and issue #20The exception which I get is following