Open grepwood opened 8 years ago
I think I found a solution. In the function passed into SDL thread, we need to SDL_Delay by an accurate delay instead of 40, because 40ms is exactly the time that a frame is displayed at 25fps. To calculate the correct delay, do:
accurate_delay = (uint32_t)(pow((pFormatCtx->streams[0]->avg_frame_rate.num)/(double)(pFormatCtx->streams[0]->avg_frame_rate.den),-1)*1000.0);
Update: This does not fix the issue entirely. There are still 9 seconds lost for a 3m19s movie.
I've changed the source so that we can specify what file to play.
Here is a free sample that exhibits the same problem as all files of this format: https://sucs.org/~grepwood/FreeRadical/moognu.mve For comparison, the original is available here: https://archive.org/download/M00GNU/Freedom-catmoognu.ogv
If you play both files with
ffplay
, they play at the same speed. So, obviously there is a problem with the way simplest_ffmpeg_player_su works.