Open dhill999 opened 9 months ago
I initially thought this was limited to my older videos, but I found that even more recently encoded videos are also showing this behavior. These are typically videos ripped from DVDs with the following commands:
/usr/bin/mplayer dvd://01 -nocache -dumpstream -dumpfile video.vob -alang en -slang en -forcedsubsonly
/usr/bin/ffmpeg -i video.vob -vcodec libx264 -preset fast -b:v 1800k -af aresample=async=1000 -f avi -pass 1 -r 30000/1001 -y /dev/null
/usr/bin/ffmpeg -i video.vob -vcodec libx264 -preset fast -b:v 1800k -af aresample=async=1000 -f avi -pass 2 -r 30000/1001 -acodec ac3 -b:a 256k -map 0:0 -map 0:1 video.avi
Platform: Linux dh 5.15.0-88-generic #98-Ubuntu SMP Mon Oct 2 15:18:56 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
MythTV version: fixes/32
Package version: mythtv/jammy,jammy,now 2:32.0+fixes.20220325.f69ce764b7-0ubuntu1 all [installed]
Component:
What steps will reproduce the bug?
Play video encoded with 24 fps but reported frame rate as 30fps. When I play these videos, there is a noticeable drift between the mythtv timestamps and the actual video position. EG if I save a bookmark after playing for 10 minutes, then resume, it will resume a few minutes prior to the actual position. This also shows up when jumping forward / back within the video -- a jump forward often actually jumps backwards. Videos were created over 10 years ago with mencoder but I do not have the specific options that led to this behavior. I fixed my video encoding procedure at the time but still have many videos with this odd encoding. I am happy to provide a sample upon request. This bug was reported 11 years ago https://code.mythtv.org/trac/ticket/11415 and fixed in 0.27-fixes however I recently upgraded to 0.32-fixes and found the old behavior has returned. Jim Stichnoth noted that: 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.
How often does it reproduce? Is there a required condition?
100% of the time for videos encoded as described.
What is the expected behaviour?
mythtv should save bookmarks accurately so it can resume playback from the bookmarked position and jump forward/backward from the playback position accurately.
What do you see instead?
Resuming from bookmark always resumes earlier than video position and jumping forward/back jumps farther back than intended. The longer the video was playing, the farther off it gets.
Additional information
Original commit that fixed the issue: https://github.com/MythTV/mythtv/commit/e7a8dfc62226f3b192559828e43f3396640c7c0e
Latest code has no references to framesPlayedExtra -- commit history shows it was removed in 2020: https://github.com/MythTV/mythtv/commit/5bb0e9ebd577fc208339ecb2ca5b51ed61970cee