[mythtv] num of frames played vs nvp->GetTotalFrameCount()

Chris Pinkham cpinkham at bc2va.org
Tue Jan 30 06:44:03 UTC 2007


* On Thu Jan 25, 2007 at 02:04:47AM -0500, Daniel Walton wrote:
> I have a recording of an ABC HD show that is one hour long and according to
> nvp->GetTotalFrameCount() is 158700 frames:

I think a couple different things are coming into play.  I believe there
is still code in the editor that will not let you seek within a certain
distance of the end of the recording.  This is by design and dates back a
long time, so it may not even be required anymore, but I'm not 100% sure.

There is also a minor difference in how frames are calculated which
may affect frame numbers on corrupted files.  It appears that the
new/experimental commercial flagger just increments frame numbers as it
goes through.  If there are any corrupted or missing frames in the file,
they may not get counted with this method.  When you seek, the decoder's
frame counter gets reset based on the keyframe distance and the keyframe
number that you jumped to.

If you look in ClassicCommDetector, you'll see that I do the following
to set the current frame number:

    VideoFrame* currentFrame = nvp->GetRawVideoFrame();
    currentFrameNumber = currentFrame->frameNumber;

That way I'm syncing my frame numbers with the decoder's frame counter.

I'm not sure if this totally explains why your frame numbers are off,
but it is a couple things that I ran into while I was going through the
same process with the existing commercial flagger.  In the beginning,
I'd see that the blank frame detector said frame X was blank, but when I
tried to view that frame in the editor, I'd see that the player thought
it was frame Y (usually higher than X).  Once I switched my code to using
currentFrame->frameNumber instead of just doing currentFrameNumber++
ever frame, the accuracy was much better.

--
Chris


More information about the mythtv-dev mailing list