Fix endless loop when generating thumbnails on certain files
|Found in version:||4.99.749||Platform:||Linux|
My "fix" is terribad though, you can get the idea I think. I'm sure you can manage to evade this more efficiently (or even manage to get it working).
As mentioned in the Pull request I could provide a sample, though not sure if appropriate here (maybe via PM).
#1 Updated by Daren K over 5 years ago
I did some further digging, the mentioned files have something in common:
1. When loaded into Avidemux, they show one single I-frame at the beginning of the video, followed by only P-frames until the end. This may have something to do with an open GOP structure saved in the wrong container format (http://forum.doom9.org/showthread.php?t=161226), which results non-IDR I-frames not being referenced as I-frames.
2. A variable frame rate.
I tried to find a fix for seeking in these files but couldn't get it working.
What I tried:
Using avformat_seek_file(ifv_fctx, ifv_stream, INT64_MIN, ts, INT64_MAX, <flag> instead of av_seek_frame(ifv_fctx, ifv_stream, ts, AVSEEK_FLAG_BACKWARD) with flags such as AVSEEK_FLAG_ANY right before the loop starts, still no frames extracted.
Also checked if avcodec_decode_video2(ifv_ctx, frame, &got_pic, &pkt) does return errors when hit with those files, but on all tries it returned > 0.
The guys over at Kodi somehow manage to extract frames out of those files for thumbnails with the last function mentioned, but C++ is too scattered for me to get to the bottom of it and adapt.