[mythtv] Mythtv mpeg frame counting - patch?

Bill level42 at sympatico.ca
Fri Jun 15 13:00:02 UTC 2007

Ok now I'm confused. I decided to look at the frame counting on the playback 
side first, since the decode is already been done, its a little easier to 
get started and familar with the code.  But it looks it me like the frame 
counting is ok on playback; its incremented only after a successful decode 
and anyway, av_read_frame performs some partial parsing and is suppose to 
return only complete video frames.

So I ran a test based on a tutorial using ffmeg at 
http://dranger.com/ffmpeg/tutorial01.html to count the frames of a file I 
have problems with.  Since the tutorial should be doing frame accurate 
counting, I thought it would give different numbers than mythtv, but it 
didn't.  So what am I missing?????

Here's the facts, the last value in the filemarkup position map for the mpeg 
is 148891.  Due to the way mythtv generates the position map this is not 
quite the end of the file, but close, close enough.  As the position map is 
generated using calls to av_read_frame in mythtv, the frame counting for the 
position map is correct.

My tutorial based test file gives 148903 total frames, similar to mythtv, so 
mythtv is counting frames ok on playback.  The mpeg header reported by 
dump_format is 1:42:23 for length and 29.97 for frame rate. The length 
calculated by Mythtv is 148891 / 29.97 = 1:22:48 which is too short.  The 
actual play time by Mythtv is 1:42, but the OSD will show the 1:22 time.

What am I missing for this problem?  I checked the repeat_pic field in 
AVFrame (I think it is); this is not the problem.  It is almost as if the 
actual frame rate is 24, or the frame rate is not constant or for DVB 
broadcast they are playing some other tricks to save bandwidth. 

More information about the mythtv-dev mailing list