[mythtv] Video playback framerate
pb.mythtv at gmail.com
Fri Jan 4 20:47:28 UTC 2019
Since you are getting deeply involved in video playback, I would like to
mention a couple of things I have done and what I would like to do.
AVSYNC has some problems. It makes the assumption that video is fixed
frame rate (not always true) and that the rate matches what ffmpeg
supplies as the fps (not always true). If the frame rate differs from
what ffmpeg said, the audio sync will drop frames or double frame
intervals to get it back on time. There is also an "avsync predictor"
that attempts to smooth things out. I have seen cases where a few frames
per second are continuously being dropped on a high powered system that
is quite capable of keeping up.
I developed AVSYNC2 as a replacement for AVSYNC. At the moment it is
invoked by an advanced playback option, but I think it could replace
AVSYNC. AVSYNC2 relies on the timestamp of each frame to display the
frame at the correct time. I also added some code in the decoder
routines to fix incorrect timestamps when they occur. Also I fix
timestamps on deinterlace doubled frame rates when they are incorrect.
Everybody who has tried AVSYNC2 has give favorable feedback..
If we get rid of AVSYNC there is a lot of other code that can be
removed. The classes in vsync, the avsync predictor can probably be trashed.
2. Elapsed Time
The elapsed time of playback that is displayed in the information OSD
and used when skipping back or forward is something I would like to fix.
It works by taking the frame count, which gets calculated as playback
proceeds, and dividing by what it thinks the framerate is. If the
framerate is variable or the provided rate incorrect this results in
wrong values. I have seen playback where the time as measured on a
stopwatch diverges from the time as displayed by the OSD at the rate of
some 10 seconds every minute. MythTV can think playback is at the end
when there are still 10 minutes left. If there is no seek table, when
doing skip forward or back it converts its framecount back to a time
stamp for ffmpeg to jump to the desired location. This can give a wrong
result. In some cases doing a jump forward causes a jump backwards, in
other cases it jumps by the wrong amount.
I would like to change it throughout to use timestamp instead of frame
number for keeping track of the position. (I am not sure whether
timestamps ever get reset in the middle of a video and what to do about
that). Unfortunately this change would affect a lot of things, including
the seek table, which is currently indexed by frame number. It also
would affect commercial flagging and video editing, processing of cuts.
More information about the mythtv-dev