I’m not certain that this is the best place to post this … if its not, then please point me in the right direction.
I am trying to get Comskip working properly on my Raspberry Pis. I have one RPi running tvheadend and comskip and I have that working pretty well producing EDL files that are as accurate as I could expect given the TV broadcast being processed.
The problem is that when playing the recording on my OSMC Rpi, some of the commercial breaks are sometimes not being skipped.
I created a “fake” EDL file that looked like this …
0009 0100 3
0109 0200 3
0209 0300 3
0309 0400 3
… repeated segments of 9 seconds of “show” followed by 91 seconds of “commercials”.
Most of the time the “commercials” were skipped properly, but sometimes, maybe 1 in 4 times for a HD show and one in 10 times for an SD show, the “commercials” were not skipped.
So I dug into the code, and I think I have found a bug. I actually work in IT, and have programmed for many years, but I have never been a c/c++ programmer, so please forgive me if I’m wrong here, but here is what I think is going on, based on my reading of the code.
In the (main?) loop in VideoPlayer.cpp that starts at line 1357, there are two places that check for EDL skips.
At line 1384, a call to CheckAutoSceneSkip() checks before a chunk of video stream is read, to see if we have entered a commercial and should skip before reading the next chunk of stream.
At line 1625, ProcessPacket() calls ProcessVideoData() which calls CheckSceneSkip() which checks to see if the chunk of video that we are processing is in a commercial an needs to be dropped.
I think that the problem is that both CheckAutoSceneSkip() and CheckSceneSkip() make calls to m_Edl.InCut() which updates the value of m_lastQueryTime within the EDL data structure, but I think that the logic of lastPos in CheckAutoSceneSkip() is based on the last time that m_Edl.InCut was called in that function, but it is also called from CheckSceneSkip() so it can mess up the test at line 2385
For example …
An EDL cut starts at 01:00.00 …
- Start of main loop at 00:59.99
- CheckAutoSceneSkip() calls m_Edl.InCut() which sets m_lastQueryTime = 00:59.99
- Read video stream and time passes to 01:00.01
- ProcessPacket() calls ProcessVideoData() calls CheckSceneSkip() which sets m_lastQueryTime = 01:00.01
- (Some tiny imperceptible chunk of video gets dropped?)
- Loops back top of main loop
- CheckAutoSceneSkip() calls m_Edl.GetLastQueryTime() which sets lastPos = 01:00.01
- Test at Line 2385 “if ( lastPos <= cut.start )” is false, so the code to skip the commercial is not executed.
My main problem/question now is, how do I code a fix for this and build an executable to test? I think I can figure out how to hack the code, but building is more of an issue. Is there a guide for coding and building dirty hacks? :