Closed redbaty closed 4 years ago
I've found a workout, tho this issue might be weirder than I thought, should I provide a sample file?
I've tested this library with a 30 minutes long 60 fps h265 file which has 108 000 frames(generated by the following command) and it's working correctly.
ffmpeg -t 0:30:00 -f lavfi -i color=c=black:s=640x480 -c:v libx265 -x265-params crf=25 -r 60 -pix_fmt yuv420p c:/video-h265.mp4
The bug may be in FFmpeg.AutoGen
because stream->duration
is set by it.
Can you provide a sample file?
As it is on my fork, I can only extract the duration from the AVContext
.
The bug probably is in FFmpeg.AutoGen
or even in ffmpeg
.
Could you open a pull request with the workaround - duration from AVContext
(and also with the chapters support - your 2e86dd8 commit) to my develop
branch?
Sure, I'll open some pull requests, the only thing I'm worried about is breaking another file in which the old stream->duration
method works but the new avcontext->duration
doesn't.
Which file it will break?
I mean, if we move from stream->duration
to AVContext->duration
there's a chance in some specific file it'll break, right?
Stream duration is often equal to the file duration (converted to seconds), but in some cases it can be shorter. The library may get the stream duration from AVContext
only if the AVStream->duration
is unavailable.
Example:
if(stream->duration >= 0)
return stream->duration;
else
return avcontext->duration;
Great suggestion! This way we keep compatibility and fixes files in which the stream duration is invalid.
Fixed by #11
First of all, I'd like to thank you for your efforts, this lib is pretty life saving (probably the first cross-platform library in .net which is not a complete mess).
Anyway, here's the problem, I've got an HEVC (H265) file which is exactly 22 minutes and 53 seconds long, but for some reason, the
StreamInfo
constructor fails to parse the correct duration causing an overflow (claiming that the duration is too long). I'm not so sure if this is related to this project or the project this is based onFFmpeg.AutoGen
.Here is some information that can be helpful:
StreamInfo.cs
to a fixed timespan, the library works as expected.stream->duration
is: -9223372036854775808stream->time_base
as double is 0.001