SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Github Development


SageTV Github Development Discussion related to SageTV Open Source Development. Use this forum for development topics about the Open Source versions of SageTV, hosted on Github.

Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 01-09-2018, 06:46 PM
Narflex's Avatar
Narflex Narflex is offline
Join Date: Feb 2003
Location: Redondo Beach, CA
Posts: 6,313
Cool Fix for bad timelines in MPEG recordings

This is probably one of the only things left in SageTV that can totally piss me off and completely ruin my day. It's when you try to playback a recording and you realize the timeline is either stuck at zero, the end of the file or it increments at some bizarre rate that does not match reality. Then of course if you try to'll just end, go back to the beginning or completely ruin the game by showing you the 4th quarter score even though just skipped 15 seconds into it.

These files work fine if you just start them and ignore the timeline and don't try to skip...but what's the fun in that? It really annoys me when I forget I'm watching one of these problems and then out of habit at a commercial, I grab the remote and hit skip only to be reset back to the beginning (I can't count how many times I've pissed off the wife trying to navigate around one of these recordings).

Well, I've just posted a fix (not ideal, but it gets the job done) to GitHub for this!

This problem happens generally due to bad commercial insertions by cable providers where they do not readjust the PTS values in the MPEG packets so that the timeline isn't increasing throughout the entire recording. The solution is to just completely ignore the PTS values for purpose of showing the timeline in the UI and for executing seek operations (it just assumes the file is constant bitrate, and uses byte positions instead...not very accurate...but way better than the crap you deal with otherwise).'s the commit I just posted to GitHub:

And here's the details of the commit which give you all the other details you are likely interested in.

Byte based seeking support for MPEG files

This helps to resolve a long standing issue where files that have bad PTS timelines cause the playback time to jump wildly and infuriate you when you try
to skip around them.

What it does is detect when the parser's calculated duration for a file that is
being played back (extender only, no transcoding) is different by a decent amount (25%) from that of what SageTV thinks the recorded duration should be. Then it uses the read file position to estimate the current playback time and then for seeking, it guesses the proper file position as if the file were constant bitrate. This works WAY better than being stuck without the ability to seek or even know what time you are at in the file.

This feature is off by default, and it can be enabled by setting this in your file:

This does NOT work on files that are currently recording.
This does NOT allow you to fast forward or rewind properly in files like this, only seek.
You CAN force this to work for currently recording files by setting this property in the properties file for the extender you want it to work on:
(this is so if you're recording something you really want to watch right now that has this issue, you can turn off the extender, edit the properties file and then it'll make it happen...don't forget to reset that property later).
This is somewhat inaccurate, but that's what you get with byte-based time estimation.
Jeffrey Kardatzke
Founder of SageTV
Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
VideoRedo & Sage Timelines graywolf General Discussion 3 02-19-2012 12:34 PM
Tinelines, timelines, timelines... Polypro SageTV Beta Test Software 3 09-13-2007 10:17 PM
recordings timelines' get messed up JonTom SageTV Software 26 01-30-2007 04:46 PM
timelines (?) in some files are wrong... JonTom SageTV Software 1 01-22-2006 12:03 PM
Currupt MPEG Recordings Muchacho SageTV Software 1 08-30-2004 06:52 PM

All times are GMT -6. The time now is 04:27 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.