[mythtv] timestretch: predictive frame skipping (was Re: DVD playback issues, patch)

John P Poet jppoet at gmail.com
Wed Nov 25 06:29:30 UTC 2009

On Tue, Nov 24, 2009 at 9:35 PM, John P Poet <jppoet at gmail.com> wrote:
> On Tue, Nov 24, 2009 at 7:57 PM, David Engel <david at istwok.net> wrote:
>> On Tue, Nov 24, 2009 at 06:36:21PM -0700, John P Poet wrote:
>>> ...and that happens even when doing this with "simple" 720p mpeg2.  My
>>> system should be able to decode 100 frames per second pretty easily.
>>> So, the video being +3 frames behind the audio does not make sense.
>>> There is no excuse for my system no being able to "keep up", unless it
>>> is not being allowed to.  I assume the problem is that there can only
>>> be one-frame-per-refresh, and the refresh is 60Hz.  I don't know what
>>> the solution is, but I would love it if Davin or Mark could come up
>>> with it ;-)
>> I haven't followed any of this thread until this message.  Please
>> pardon the interruption if I'm way off base.
>> John, I believe you've touched on the reason I have my HD-PVR attached
>> STBs set to 1080i instead of 720p -- interlaced content stretches much
>> more smoothly than progressive.  With the fallback deinerlacing
>> options limited to 1x, you never have more deinterlaced frames than
>> refresh intervals (60, in my case) so you never have to drop any
>> frames.  With progressive content, you always have more frames than
>> refresh intervals so you always have to drop frames and the result is
>> jerky.
>> I have an idea that might remedy this.  We detect when we have more
>> video frames than refresh intervals similarly to how we detect when to
>> use the fallback deinterlacers.  When we detect this condition, what
>> if we discard every other video frame?  In a sense, we fallback to a
>> "0.5x deinterlacer."  Since we discard frames at a regular rate
>> instead of somewhat randomly as currently done, the result might be as
>> smooth current the stretching of interlaced content.
> This is getting off topic for the original purpose of this thread, but...
> That seems reasonable to me.  Although, you would only want to discard
> every other frame if playback is at 2.0x.  For 1.5x, it would be every
> 3rd frame, for 1.25x it would be every 5th frame, and for 1.3x it
> would be every 4.333333 frames, right?  Those fractions would still
> cause issues, but would make the avsync easier.
> frame index to discard = (refresh / ((speed * refresh) - refresh)) + 1

The obvious solution to the fractions such as 4.33333 for 1.3x, is to
skip every 4th frame *and again* every 12th frame.

I may have to tinker with this on Thursday....

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

More information about the mythtv-dev mailing list