[mythtv] Jitter with time stretch

Mark Spieth mark at digivation.com.au
Sun Jul 15 00:14:35 UTC 2018

On 7/15/2018 7:27 AM, Peter Bennett wrote:
> Hi David
> I do not use time stretch, so I do not know what is good and what is 
> bad. I tested time stretch with the current master version on Linux 
> (no patches), VAAPI and "-v playback" . With a 30fps recording it can 
> be speeded up to 2x with no log messages about aout of sync audio. 
> With a 60fps recording (720p) from Comcast, it shows hundreds of 
> errors, a bunch of messages saying "Video is 20.0819 frames behind 
> audio (too slow), dropping frame to catch up." followed by a bunch of 
> messages saying "Video is 17.7729 frames ahead of audio, doubling 
> video frame interval to slow down.". This repeats.
> On the shield, this type of thing also happens, including with 30 fps 
> interlaced content, perhaps because it is actually shown at 60 fps.
> On the shield if you set your audio device to NULL it seems to be 
> perfectly smooth when speeding up to 2x.
> I suspect what you are seeing is a pre-existing bug, not related to 
> the shield specifically, but showing up because of the frame doubling 
> that is happening on the shield.
> I think the audio speedup may not be perfect, or maybe showing video 
> at higher rates than 60fps is problematic.
I notice with timestretch it is sensitive to the number of audio buffers 
and video buffers to absorb any delta in A/V presentation in the 
transport stream.
Increasing the audio buffering time helps in one direction (A precedes 
V) and video buffers where V precedes A.
As a test, adjust audio sync to the point where you no longer get the 
Video ahead of audio logs and that will give you an idea of how many 
buffers are required.
Also with mediacodecs pipeline, this will exacerbate this V lagging 
audio issue.
20 frames is about 750 ms at 30fps. so up the audio extra buffer to 1 
sec should fix this.


More information about the mythtv-dev mailing list