Opened 7 years ago

Closed 6 years ago

#11415 closed Bug Report - General (Fixed)

video seeking and bookmarks do not work properly for some .avi files

Reported by: myth@… Owned by: Jim Stichnoth
Priority: minor Milestone: 0.27.1
Component: MythTV - Video Playback Version: 0.26-fixes
Severity: medium Keywords:
Cc: Ticket locked: no

Description

I have a set of DIVX mpeg4 .avi files generated with mencoder that mythfrontend seems to have problems with -- seeking and saving bookmarks show time drifting, especially after playing back the video for a while. During playback, myth's notion of the current position in the movie drifts away from the actual position, to the point where after 45 minutes of playback, if you save a bookmark and resume from it, the video resumes 10 minutes earlier than the previous position. Likewise, attempts to skip forward / back after 45 minutes of playback end up jumping back 10 minutes.

After analyzing the .avi files, I found that the container shows the frame rate as 29.97 fps and using 'ffprobe -show_packets', I see video packets with duration = 0.033 (the appropriate value for 29.97fps), however there are only actually 24 frames in the stream for every second of PTS time. Myth is using the (incorrect) container fps value for seeking / bookmarking decisions. PTS time seems to be accurate which is, I assume, why playback works fine.

I had this issue with earlier versions of MythTV and I believe it was resolved by generating a seek table with 'mythcommflag --video', however this no longer seems to work.

I've had some discussion with Jim Stichnoth about this and he indicated that changing to use ffmpeg-based seeking in 0.27 should resolve the problem.

Until 0.27, I have a short-term solution which is to add a '--fixavi' option to mythtranscode which analyzes the first 5 minutes of the video and saves the frame rate in the filemarkup table. Then, during playback of .avi files, if the frame rate is in the filemarkup table, it is used to override the container frame rate. Patch will be attached soon.

Attachments (1)

fps_db.patch (8.3 KB) - added by David Hill <myth@…> 7 years ago.
Adds --fixavi option to mythtranscode to save FPS in database, Read FPS from db during playback.

Download all attachments as: .zip

Change History (6)

Changed 7 years ago by David Hill <myth@…>

Attachment: fps_db.patch added

Adds --fixavi option to mythtranscode to save FPS in database, Read FPS from db during playback.

comment:1 Changed 6 years ago by Jim Stichnoth

Milestone: unknown0.27.1
Owner: set to Jim Stichnoth
Status: newaccepted

The intention here is to ignore any seektable for video formats that don't allow timestamp discontinuities, and use ffmpeg functionality instead. My notes from a while back, which may be inaccurate:

Don't use a seektable unless necessary - "ic->iformat->flags & AVFMT_TS_DISCONT". Use display timecode "picframe->disp_timecode = NormalizeVideoTimecode?(stream, temppts);".

comment:2 Changed 6 years ago by Jim Stichnoth <jstichnoth@…>

In e7a8dfc62226f3b192559828e43f3396640c7c0e/mythtv:

Provide better seeking and position display for some videos.

Specifically, there are examples of poorly-encoded avi files that
report a video frame rate of 30fps but the video stream is actually
24fps. Because frame intervals are actually encoded as 30fps, every
4th frame has to be repeated. Without an adjustment to framesPlayed,
translations between MythPlayer?'s frame-based seeking/display and
ffmpeg's timecode-based seeking drift out of sync.

Note: Similar adjustments may be necessary if frames have to be
dropped due to a frame rate mismatch.

Refs #11415.

comment:3 Changed 6 years ago by Jim Stichnoth <jstichnoth@…>

In 990757a60e43c7054876eee5de4cc25a5a301022/mythtv:

Provide better seeking and position display for some videos.

Specifically, there are examples of poorly-encoded avi files that
report a video frame rate of 30fps but the video stream is actually
24fps. Because frame intervals are actually encoded as 30fps, every
4th frame has to be repeated. Without an adjustment to framesPlayed,
translations between MythPlayer?'s frame-based seeking/display and
ffmpeg's timecode-based seeking drift out of sync.

Note: Similar adjustments may be necessary if frames have to be
dropped due to a frame rate mismatch.

Refs #11415.
(cherry picked from commit e7a8dfc62226f3b192559828e43f3396640c7c0e)

comment:4 Changed 6 years ago by Jim Stichnoth <jstichnoth@…>

In 46d8c2392429113e40be9a7dcc3dd392c625b8d7/mythtv:

Bump the ABI version after 990757a. Refs #11415.

comment:5 Changed 6 years ago by Jim Stichnoth

Resolution: Fixed
Status: acceptedclosed
Note: See TracTickets for help on using tickets.