Yahweasel / libav.js

This is a compilation of the libraries associated with handling audio and video in ffmpeg—libavformat, libavcodec, libavfilter, libavutil, libswresample, and libswscale—for emscripten, and thus the web.
288 stars 18 forks source link

Seek in demo stops working after reaching end of file #33

Closed naktinis closed 8 months ago

naktinis commented 8 months ago

I loaded an MP4 file into the demo page using the "mediarecorder-transcoder" variant (which is as far as I know the only variant that loads MP4 files at the moment) and tried seeking around.

Everything works great until reaching the end of file after which an error appears saying "Error submitting the packet to the decoder: End of file" after which seeking no longer works.

This happens with every MP4 file I've tried, but I can send an example if that helps.

Is this a known issue and is there anything that can be done to work around it? Let me know if there's anything I can do to help investigate this.

https://github.com/Yahweasel/libav.js/assets/657600/73f352e7-02a0-400b-ae18-2f830d83e8eb

Yahweasel commented 8 months ago

This is a rather silly bug. I triggered the decoder to dismantle itself on EOF, but also allowed seeking. See https://github.com/Yahweasel/libav.js/blob/9cce05ba80b9d7ea763538efd62e0f74dc18ff12/demo/demo.html#L194 . That's setting the fin flag, which makes sense for a normal end of file, but if you're allowing seeking after end, should not be set, as it dismantles the decoder. Will fix Soon™.