Improving commercial break skip support for MythTV
#16
That's just it.. Under MythTV, it's correct, the timestamp line up and everything. I dumped the db, looked at the commercial breaks, and using the mythtv client verified where the commercials started and stopped.

They do something to correct the frame rate.. what exactly it is, I don't know.

Reply
#17
The more I dig into how mythtv makes this work, I am starting to believe that XBMC will never truly support it AS-IS from a myth setup that records mpeg-ts with variable frame rate; myth never records this fact into it's db, and uses a seek table with frame/byte offsets on where to jump.

I am looking into transcoding the file into something else, and then seeing what happens; it's too bad mythtranscode in 0.26 is borked (I'm getting the deadlock error..)

Reply
#18
MythTV 0.27 seems to bring some support for this: http://code.mythtv.org/trac/changeset/49dbed5be0/mythtv
Haven't checked it in detail, but it sounds promising.
Is anyone able to upload a sample recording with different framerates somewhere (for example on dropbox)?
Reply
#19
I've uploaded one to a web service I manage.. PM'd you cfetzer with it. It's BIG 3.2GB in size, but it's a COMPLETE 30 minute show, so you have plenty of material to work with. I included the myth commercial skip list in another text file also.

If someone else wants it, ask and I'll pm the link to it.
Reply
#20
(2013-01-18, 09:34)cfetzer Wrote: MythTV 0.27 seems to bring some support for this: http://code.mythtv.org/trac/changeset/49dbed5be0/mythtv
Haven't checked it in detail, but it sounds promising.
Is anyone able to upload a sample recording with different framerates somewhere (for example on dropbox)?

I would like to submit a patch for this that implements a basic lookup on the recordedseek table for these functions. Taking the information from that MythTV patch, I made a cmyth_mysql function that pulls the closest MS offset from the recordedseek table (type = 33). This value could be before or after the actual frame mark, generally within a MS or two.

This should also be compatible with previous version of MythTV because if no value comes back from the DB it falls back to the static frame rate method from before.

It has been a long time since I've done much in C/C++, and while I've tested this on my own system, I feel it could be double checked.

Debugging log output will show this:
Code:
22:12:52 T:2691705664   DEBUG: AddOnLog: MythTV cmyth PVR Client: start_mark: 0, end_mark: 2082, start: 0, end: 69069, bad_start: 0, bad_end: 69469
22:12:52 T:2691705664   DEBUG: AddOnLog: MythTV cmyth PVR Client: start_mark: 15293, end_mark: 20603, start: 509509, end: 705532, bad_start: 510276, bad_end: 687454
22:12:52 T:2691705664   DEBUG: AddOnLog: MythTV cmyth PVR Client: start_mark: 30425, end_mark: 37410, start: 1033860, end: 1290041, bad_start: 1015181, bad_end: 1248248
22:12:52 T:2691705664   DEBUG: AddOnLog: MythTV cmyth PVR Client: start_mark: 52183, end_mark: 59102, start: 1782400, end: 2037744, bad_start: 1741174, bad_end: 1972038
22:12:52 T:2691705664   DEBUG: AddCut - Pushing new cut to back [00:00:00.000 - 00:01:09.069], 3
22:12:52 T:2691705664   DEBUG: ReadPvr - Added break [00:00:00.000 - 00:01:09.069] found in PVRRecording for: pvr://recordings/Default/The Daily Show With Jon Stewart/
22:12:52 T:2691705664   DEBUG: AddCut - Pushing new cut to back [00:08:29.509 - 00:11:45.532], 3
22:12:52 T:2691705664   DEBUG: ReadPvr - Added break [00:08:29.509 - 00:11:45.532] found in PVRRecording for: pvr://recordings/Default/The Daily Show With Jon Stewart/
22:12:52 T:2691705664   DEBUG: AddCut - Pushing new cut to back [00:17:13.860 - 00:21:30.041], 3
22:12:52 T:2691705664   DEBUG: ReadPvr - Added break [00:17:13.860 - 00:21:30.041] found in PVRRecording for: pvr://recordings/Default/The Daily Show With Jon Stewart/
22:12:52 T:2691705664   DEBUG: AddCut - Pushing new cut to back [00:29:42.400 - 00:33:57.744], 3
22:12:52 T:2691705664   DEBUG: ReadPvr - Added break [00:29:42.400 - 00:33:57.744] found in PVRRecording for: pvr://recordings/Default/The Daily Show With Jon Stewart/

Example:
Code:
start_mark: 52183, end_mark: 59102, start: 1782400, end: 2037744, bad_start: 1741174, bad_end: 1972038
Added break [00:29:42.400 - 00:33:57.744]
start/end_mark: the mark lookup value
start/end: the ms of the start and end of the time frame
bad_start/end: the comparision to the constant frame rate value math

start = 1782400 ms => 1782.400 seconds = 00:29:42.400
bad_start = 1741174 ms => 1741.174 seconds = 00:29:01.174
Proper break added: Added break [00:29:42.400 - 00:33:57.744]

As shown in the example above, the offset is over 30 seconds off at the end of the the show. And if that is a hour long show it gets worse.

If there is no map in the database, the output shows:
"missing recorded map, try running 'mythcommflag --rebuild' for this recording"

I hope this at least a decent enough start to getting it implemented into the PVR for MythTV. Thank you for all of your work you've put into this so far!

Patch: http://pastebin.com/CNFYjq4R

EDIT: Typo in the description above.

EDIT 2: Now that I'm awake, I have reworked the patch into a fork of xbmc-pvr-addons: https://github.com/nerddtvg/xbmc-pvr-add...fb09b77c18 I will be initiating a pull request soon for it.
Reply
#21
This sounds great. Any word if this patch has been accepted?
Reply
#22
For what its worth, I have been using:
- MythBackend 0.26 with a HDHR,
- recording OTA TV in North America,
- watching it with XBMC Gotham Alpha (various builds) on a Raspberry Pi.

1. I don't believe the timing has ever been off resuming from an ad (100% perfect, as far as I can tell);
2. However, it cuts off the program a few seconds short of the ad. The program video freezes for a second, and then resumes after the commercial break.

I have tried delaying the commercial skip using commbreakautowait in the advancedsettings file, with indeterminate results. Although it is supposed to be in seconds, smaller numbers (i.e. single digits) had no effect. A larger number like 3000 this testing did delay a few seconds, alleviating the problem of the early skip. NB: I tried this a couple of months ago (Alpha 5?) so if there have been relevant changes, I have not tested them yet. I also tried to override automatic commercial skipping altogether by using a huge number with commbreakautowait (i.e. 50,000) to no effect.

Currently running Alpha 8 in OpenELEC and would be happy to provide additional information if it will help.
Reply
#23
FWIW, I tried using 'commbreakautowait' in /storage/.xbmc/userdata/advancedsettings.xml with the latest gotham openelec build from rbej, and it appears the same issue still exists: small values (in seconds) do not appear to work. Larger values seem to delay the skip somewhat, but I can't find any consistent pattern to the skip and setting value. Just to muddy the water further, I saw a value of 10 would cause a slight delay (not 10 seconds, but a couple...).
Reply
#24
Please provide a debug log of playback when it doesn't appear to be working. The log includes details of the commercial break points loaded from MythTV and then the subsequent changes to those positions based on the advanced settings.
Use MythTV for recording TV? Try the integrated MythTV support in XBMC Media Center. Now with commercial skip support built-in and integration with the Movie database!
Reply
#25
(2013-10-10, 07:38)dteirney Wrote: Please provide a debug log of playback when it doesn't appear to be working. The log includes details of the commercial break points loaded from MythTV and then the subsequent changes to those positions based on the advanced settings.
This is the only log line generated at the skip:
03:27:37 T:2934535264 NOTICE: FlushBuffers: q:0 pts:760127000 a:1

OK. Debug log:
Code:
03:34:45 T:2909103200   DEBUG: CPVRTimers - Update - updating timers
03:34:46 T:2909103200   DEBUG: PVRTimers - UpdateEntries - updated timer 327680 on client 1
03:34:46 T:2909103200   DEBUG: PVRTimers - UpdateEntries - updated timer 196608 on client 1
03:34:46 T:2909103200   DEBUG: PVRTimers - UpdateEntries - updated timer 262144 on client 1
03:34:46 T:2909103200   DEBUG: PVRTimers - UpdateEntries - updated timer 65536 on client 1
03:34:46 T:2909103200   DEBUG: PVRTimers - UpdateEntries - updated timer 458752 on client 1
03:34:46 T:2909103200   DEBUG: PVRTimers - UpdateEntries - updated timer 589824 on client 1
03:34:46 T:2909103200   DEBUG: PVRTimers - UpdateEntries - updated timer 393216 on client 1
03:34:46 T:2909103200   DEBUG: PVRTimers - UpdateEntries - updated timer 131072 on client 1
03:34:46 T:2909103200   DEBUG: PVRTimers - UpdateEntries - updated timer 327681 on client 1
03:34:46 T:2909103200   DEBUG: PVRTimers - UpdateEntries - updated timer 196609 on client 1
03:34:46 T:2909103200   DEBUG: PVRTimers - UpdateEntries - updated timer 655360 on client 1
03:34:46 T:2909103200   DEBUG: PVRTimers - UpdateEntries - updated timer 720896 on client 1
03:34:46 T:2909103200   DEBUG: PVRTimers - UpdateEntries - updated timer 262145 on client 1
03:34:46 T:2909103200   DEBUG: PVRTimers - UpdateEntries - updated timer 65537 on client 1
03:34:46 T:2909103200   DEBUG: PVRTimers - UpdateEntries - updated timer 458753 on client 1
03:34:46 T:2909103200   DEBUG: PVRTimers - UpdateEntries - updated timer 589825 on client 1
03:34:46 T:2909103200   DEBUG: PVRTimers - UpdateEntries - updated timer 393217 on client 1
03:34:52 T:2934535264   DEBUG: CheckAutoSceneSkip - Clock in commercial break [00:09:46.910 - 00:12:40.126]: 00:09:46.916. Automatically skipping to end of commercial break (only done once per break)
03:34:52 T:2934535264   DEBUG: COMXPlayer::SetCaching - caching state 3
03:34:52 T:2934535264   DEBUG: OMXClock::OMXSetSpeed(0.00) pause_resume:1
03:34:52 T:2934535264   DEBUG: demuxer seek to: 760127
03:34:52 T:2934535264    INFO: AddOnLog: MythTV cmyth PVR Client: ReadRecordedStream: Read 0 Bytes!
03:34:52 T:2934535264    INFO: Previous line repeats 1 times.
03:34:52 T:2934535264   DEBUG: SeekTime - seek ended up on time 760106
03:34:52 T:2934535264   DEBUG: demuxer seek to: 760127000, success
03:34:52 T:2934535264  NOTICE: FlushBuffers: q:0 pts:760127000 a:1
03:34:52 T:2934535264   DEBUG: OMXClock::OMXStop
03:34:52 T:2630874208   DEBUG: COMXPlayerAudio - CDVDMsg::PLAYER_SETSPEED 0
03:34:52 T:2630874208   DEBUG: COMXPlayerAudio - CDVDMsg::PLAYER_STARTED 1
03:34:52 T:2630874208   DEBUG: COMXPlayerAudio - CDVDMsg::GENERAL_FLUSH
03:34:52 T:2815452256   DEBUG: COMXPlayerVideo - CDVDMsg::PLAYER_SETSPEED 0
03:34:52 T:2815452256   DEBUG: COMXPlayerVideo - CDVDMsg::PLAYER_STARTED 1
03:34:52 T:2815452256   DEBUG: COMXPlayerVideo - CDVDMsg::GENERAL_FLUSH
03:34:52 T:2815452256   DEBUG: COMXPlayerVideo - CDVDMsg::GENERAL_SYNCHRONIZE
03:34:52 T:2630874208   DEBUG: COMXPlayerAudio - CDVDMsg::GENERAL_SYNCHRONIZE
03:34:52 T:2934535264   DEBUG: OMXClock::OMXMediaTime set config OMX_IndexConfigTimeCurrentAudioReference = 0.00
03:34:52 T:2815452256   DEBUG: CDVDPlayerVideo - CDVDMsg::GENERAL_RESYNC(-4503599627370496.000000, 760106888.888884, 1)
03:34:52 T:2815452256    INFO: COMXPlayerVideo - Stillframe left, switching to normal playback
03:34:52 T:2815452256   DEBUG: OMXVideo::Decode VDec : setStartTime 760.106889
03:34:52 T:2934535264   DEBUG: COMXPlayer::HandleMessages - player started 2 (tpa:0,a:0,v:1)
03:34:52 T:2630874208   DEBUG: CDVDPlayerAudio - CDVDMsg::GENERAL_RESYNC(-4503599627370496.000000, 0)
03:34:52 T:2630874208   DEBUG: COMXAudio::Decode ADec : setStartTime 760.004150
03:34:52 T:2630874208    INFO: COMXPlayerAudio - Switching to normal playback
03:34:52 T:2934535264   DEBUG: Resume 760.00,760.11 (A:01 V:01) EOF:0 FULL:0 T:0.20
03:34:52 T:2934535264   DEBUG: OMXClock::OMXSetSpeed(1.00) pause_resume:1
03:34:52 T:2934535264   DEBUG: COMXPlayer::HandleMessages - player started RESET
03:34:52 T:2934535264   DEBUG: OMXClock::OMXReset audio / video : 1 / 1 wait mask 0->3 state : 2->1
03:34:52 T:2934535264   DEBUG: COMXPlayer::HandleMessages - player started 1 (tpa:0,a:1,v:1)
03:34:52 T:2934535264   DEBUG: COMXPlayer::SetCaching - caching state 0
03:34:52 T:2630874208   DEBUG: COMXPlayerAudio - CDVDMsg::PLAYER_SETSPEED 1000
03:34:52 T:2815452256   DEBUG: COMXPlayerVideo - CDVDMsg::PLAYER_SETSPEED 1000
Reply
#26
Can you please provide a debug log of the area where the commercial breaks are loaded so I can see what the original ones were and what they were changed to. That was what I originally meant but didn't describe that very well.
Use MythTV for recording TV? Try the integrated MythTV support in XBMC Media Center. Now with commercial skip support built-in and integration with the Movie database!
Reply
#27
How can I identify the part of the log you want? I do not know when the breaks are loaded.
Reply
#28
Post the entire debug log to http://pastebin.com/ and paste the link to it here.
Use MythTV for recording TV? Try the integrated MythTV support in XBMC Media Center. Now with commercial skip support built-in and integration with the Movie database!
Reply
#29
I only ran the log on debug for a minute, to get the excerpt I gave you. The breaks may have been loaded already. I need to know the juncture at which the breaks are loaded in order provide what you want.
Reply
#30
Turn debug on. Start XBMC, play the Myth Recording. Stop XBMC. Paste the entire log.
Use MythTV for recording TV? Try the integrated MythTV support in XBMC Media Center. Now with commercial skip support built-in and integration with the Movie database!
Reply

Logout Mark Read Team Forum Stats Members Help
Improving commercial break skip support for MythTV0