JuliaIO / VideoIO.jl

Reading and writing of video files in Julia via ffmpeg
https://juliaio.github.io/VideoIO.jl/stable
Other
126 stars 53 forks source link

Decoder not flushed when reading a video stream #270

Closed galenlynch closed 3 years ago

galenlynch commented 3 years ago

It looks like the decoder is not flushed when the end of a file is reached, relevant function is here:

https://github.com/JuliaIO/VideoIO.jl/blob/600f60cb33fbb5836138524ceb5c71d3b2e116cf/src/avio.jl#L106-L133

IanButterworth commented 3 years ago

Interesting. Perhaps this is contributing to https://github.com/JuliaIO/VideoIO.jl/issues/209 where 2 frames are missing

galenlynch commented 3 years ago

In fact you can see this with the videos used to test VideoIO: ladybird.mp4 has 398 frames from querying the container with ffprobe, 397 from counting the frames with ffprobe, and 398 from counting with ffmpeg, and 398 frames from counting with mediainfo (using the commands listed here: https://stackoverflow.com/questions/2017843/fetch-frame-count-with-ffmpeg). The mode of those reports is 398 frames. However, the frame count used to test VideoIO says it has 396 frames (disagreeing with all). After I attempt to solve the lack of decoder flushing, and then test VideoIO, the tests fail because VideoIO now counts 397 frames ladybird.mp4, which agrees with ffprobe.