Commercial Detection Accuracy

I am recording multiple news shows from ABC, NBC, and CBS. I found that the commercial detection is hit-and-misses with 50%-60% accuracy. Some segments were mistakenly identified as commercials when they were actually not. Some segments completely missed the commercial identification and thought there were real news programs. Is it because news programs are more challenging? Just curious what is the algorithm to correctly identify commercials. Comskip uses a lot of CPU, it seems comskip is scanning every frame to identify, isn’t it? So, I need help on how I can improve the commercial detection accuracy.


Can someone please address about the detection accuracy issue?

Sorry for the delay. We’re both out of town for the long weekend and busy with family.

Commercial detection is done by comskip, which is open-source and there are various resources online about tweaking it. Generally speaking, it’s tuned for prime-time shows and might not work as well on news programs.

I’ve contributed a lot of time and code to the comskip project, and have reached the conclusion that it’s not worth putting in much more effort as the ROI has decreased significantly. Our long-term plan is to write our own new commercial detection algorithm that uses modern programming techniques and machine learning. As such, comskip support in Channels DVR is considered “as-is” or “what you see is what you get”.

If you’re interested in trying out different comskip.ini options to see if they help in your scenario, you can do so by creating the following file on the QNAP:


The default values we use are as follows:


So I would recommend starting with that and then adding whatever custom options you want to use to the end of the file.

See also some discussion in Feature request: Comskip ini access

Resources on comskip tuning:

And the comskip source code:


Thanks for the details and pointers.

You could email [email protected] with comskip.log from a recording that’s not working and I’ll see if anything sticks out in the log.

As long as you’re thinking of writing your own - it would be interesting to see if you could do some sort of group-think here. So if someone records my program in the time zone ahead of me, and they do the detection on theirs, perhaps there are hints that their system could upload that would make the detection quicker for me.

I don’t really know how the detection works, so this might be silly!

But if there were hints of some sort, and you could for example reduce the second person’s CPU requirement to do it, you might be able to then do the detection in real time as it’s recording…

@gregr I modified my comskip.ini for faster detection on a DS916+ receiving OTA broadcast channels. I think the main speed of it comes from adding the lowres=10, which I read about in the documentation. It allows comskip to process its markers using the lowest resolution needed to identify the segments accurately. It works great, but only for mpeg2 streams, so I don’t think it will work for anyone using an HDHR Prime.

Anyway, ini looks like this:


and here is an example of detection speed:

2017/06/02 12:30:01 [DVR] Running commercial detection on file 1944 (TV/RightThisMinute/2017-06-02-1200 RightThisMinute 2017-06-02 S06E471.mpg)
2017/06/02 12:32:32 [DVR] Commercial detection finished with 10 markers.

Thanks. I wasn’t actually complaining that it’s too slow - even with the default settings it runs in something like 6x real time on the DS916+. I was more musing about the potential for using hints from other peoples’ detection, in order to make mine faster and require fewer resources. And potentially run it as we are recording a show, potentially providing the ability to skip a commercial when you’re watching a program that’s still airing, but you’re not watching live.

I would think it would have to use the tuner-sharing beta so that the live stream was sent from the DVR. It looks like NextPVR attempted it with some kind of parallelprocessing batch file, but there were lots of reports of errors and crashing.

We already default to lowres=1, which decodes mpeg2 at 1/2 resolution. lowres=10 is not a valid value… here are the supported ones:

1=1/2, 2=1/4, 3=1/8 resolutions

Almost all cable companies still use mpeg2, so it works just as well with PRIMEs. For cable cos that have switched over or EXTEND users w/ transcoding it won’t help, because H264 is a much more sophisticated codec and it is not possible to do partial decoding with it.

Interesting idea… might be possible, atleast to reduce the number of frames that must be analyzed. Overall though there are numerous differences between locations and broadcast towers which make this difficult, including clock drift and resolution/framerate/interlacing changes.

I found it in the comskip changelog. It was a new feature introduced in 0.81.087. It is also mentioned in the forums that you linked.

[code] Changes on 0.81.087

  • Added multi-threaded video processing that can give up to 30% speed increase in mpeg2 video, set lowres=10 for most impact
    From site admin on comskip forums:

For mpeg 2 with lowres=10 the increase should be the biggest.
If you set lowres to 10 it will automatically find the best speed/quality compromise[/quote]

Okay I guess it’s just translating it to 3 under the hood, because that the highest the mpeg2 decoder goes.

I would like to report that latest status of this issue.

I have been trying to find inaccurate commercial detection for past 10 days, and I have not had any problem since last time I reported. Before I reported the accuracy problem initially, almost every other recorded news program would have had hit-and-misses accuracy issue. Now, it seems everything is fine. The only change that I found (or I suspect) is the latest update that reverted the comskip back to using 1 thread instead of 4 threads. I am still not sure if that’s the case, but currently all the commercials in TV shows, news programs, NBA final games, have been correctly identified. I have not had the problem after your 1st reply, that’s about 10 days ago. Unfortunately, I deleted all the old problematic news programs. I could not provide any log or video to show you. :frowning: Hopefully, that was the fix. ???

Good to know, thanks!

Digging up an old thread in the interest of determining where to locate a custom comskip.ini on a Synology NAS install - I see no /data folder in the ChannelsDVR folder? Do I need to find that location on the package itself somewhere? Thanks.

Would be something like this on Synology:


Thanks - had to ssh in there and cp the file over - all appears to have worked. I assume there is no need to restart the service to make this take effect, thinking that the custom ini file is accessed at each initiation of a comskip session post-recording?

1 Like