[mythtv] Mythtv mpeg frame counting - patch?

Daniel Kristjansson danielk at cuymedia.net
Tue Jun 5 12:34:45 UTC 2007


On Tue, 2007-06-05 at 02:15 -0400, Bill wrote:
> Mythtv does not always count frames correctly for mpeg files (ref ticket 799 
> comment from danielk).  As a result the length shown in the OSD is sometimes 
> too short (more often than not for my mpeg video files).  I am looking at 
> writing a patch for this, but want to ask for feedback on a number of things 
> first
> 
> 1. Is anyone else already working on a patch?  I don't want to duplicate 
> effort.
Janne may have started on it, but he's not working on it
right now.

> 2. Any thoughts or ideas on the patch?  Ticket #1693 looks like it might be 
> a useful starting point.
No, it is not. It tries to solve a cosmetic aspect shared
by this problem and another completely different problem
without fixing either the of the actual problems.

There are basically two approaches you can take: You can
get ffmpeg to find the keyframes for you by having it do a
partial decode (You could, for example, implement a dummy
avformatdecoder and have it do a dummy XvMC decode.) The
other option is to look at the MPEG specs and do a TS->PS
conversion then find the keyframes, then once that is working
eliminate the conversion and just keep track of what part
of the TS streams could possibly indicate a new frame.

> 3. Anything to watch out for that could break as a result?  I can only test 
> DVB and mpeg playback.  Can't test IVTV and other stuff.

You would need to collect a library of streams that work and
are broken with the current code, including the working IVTV
streams before embarking on this fix. I recommend that you
work on something else first, as the implementation options
for fixing #799 require either a good knowledge of ffmpeg or
the a good knowledge of the MPEG specs (which you may need
to pay a few hundred $ for). I see you also posted about
GOP_BYFRAME vs GOP_START, that is a much simpler problem to
tackle and will help you familiarize yourself with MythTV.

> Right now both recording and playback mis-count frames in the same way.
Yup, the same algorithm is used. If we miscount, it is best
that we do it consistently.

-- Daniel



More information about the mythtv-dev mailing list