I think the number of frames shouldn't be counted on the constructor of vidl2_ffmpeg_istream, because it's not everyone who needs that information every time. A lazy calculation seems better to me. My program now takes a lot more time to open a video, when I use the latest VXL source code, due to this loop. But I actually need the number of frames, because I'm using a graphical slider to indicate the progression of the video (like YouTube's), and I need the total number of frames to do that.

By the way, how do other programs, like mplayer, do this? As soon as I start mplayer, I can seek the video forward, and the program shows a progress bar of the current position of the video. So I suppose mplayer knows how many frames the video has, so it can show me a progress bar of its current position. If mplayer uses ffmpeg, how does it calculate the number of frames so fast?

Crístian Deives dos Santos Viana [aka CD1]
Google Talk: cristiandeives@gmail.com