TVE and Comskip

This is a developer type question and I hope a member of the team can give me some insight so I can do what I want to do.

I want to script the comskip executable and depending on the show, either run my own commercial detector or call the comskip binary. Comskip is terrible on the TVE type channels that just show the banner instead of running a commercial. Of course on channels (like OTA) comskip does a terrific job.

At this point it works in the sense that channels-dvr calls my script and then in turn runs my program. My program I've tried to duplicate the stdout that the real comskip does and I duplicate the 5 output files it generates. Even though my program does detect the banner type breaks well (at least for my tests on the Travel Channel) channels logs a message that there were no detections when the program finishes.

My question is if you could tell me what your code does to get the detections from comskip. I think in other threads I read that you store the detections in your own DB, which is cool but you must get the detections from comskip somehow and that is eluding me. I thought perhaps you added code to comskip and hit a REST service to get the data into your DB. I would have no way of knowing that of course.

I really would like to this working for myself as it would add a lot of value. I really hate commercials but being properly detected I can live with them. Otherwise I'll probably go back to buying the few shows I do watch and skip the DVR.

Thanks in advance for any info you could supply.

Doug Barnum

The results are read from the edl file in the comskip log directory.

What program are you using instead of comskip?

Well then I don't understand why its not working. The edl file that comskip puts out looks like:


which looks like a start seconds, end seconds and some status field that has a value of zero. I'm doing the same thing. File permissions and ownership are the same too.

It's my own program using the javacpp bindings to the ffmpeg/avlib libraries. So I have a bash script calling a compiled Mac App created by java 14 jpackage. Using jpackage you essentially get a platform dependent binary with an embedded JRE. Its kind of cool - at work I wrote a video player which runs on Mac win and linux.

Do you think it could be a process thing? The server definitely knows when the process ends - which in my case are two, bash and then my program. I would think it would just look for the file, which is video.edl based upon the arguments from the server.

Yea it just opens the edl file and reads it in after the process ends.

Does the log tab show any errors?

No errors, just these two entries:

2020/10/02 19:23:25.080289 [DVR] Running commercial detection on file 252 (TV/The Dead Files/The Dead Files S12E07 Detox 2020-03-12-2200.mpg)
2020/10/02 19:59:06.040424 [DVR] Commercial detection for The Dead Files S12E07 Detox 2020-03-12-2200.mpg finished with 0 markers.

Is there a debug mode for the log that might show more?

No, but our parser is very simple. You can try on

func ParseResults(edl string) ([]float64, error) {
	file, err := os.Open(edl)
	if err != nil {
		return nil, err
	defer file.Close()

	var results []float64
	scanner := bufio.NewScanner(file)
	for scanner.Scan() {
		var a, b float64
		fmt.Sscanf(scanner.Text(), "%f\t%f", &a, &b)
		results = append(results, a, b)

	return results, err

Thank you for the time you spent on this. So I installed go on my machine and ran the function with my video.edl output file and it parses it fine. So weird.

Looks like the function I linked is no longer being used, and we rely on the comskip video.log now.

We should be able to add the edl fallback when the log file is missing.

Ok cool, I’ll look at duplicating what they write in their log to see if I can get it to work. Thank you.

I think you'll change your mind once you see a comskip log :grinning:
Might be easier to ask what specific info in the comskip log is being parsed. got that right. First cut was the "Final List", second try was creating an additional "Block List" with a lot of dummy data. Yeah it no workie. Kind of working blind. :slight_smile:

Are you sure you're not seeing any error logging? I would expect some messages complaining that video.log was not present..

[DVR] Commercial detection failed for ... with ...

I'm uploading a new build which will fallback to reading from video.edl after comskip runs if video.log is not present.

Hi. Is this now in the latest build? I was thinking of giving this another go.

Yes it is

Thats not version 2020.09.14.2100 right? Is it a beta build somewhere? Sorry I'm new around here for the most part.

Edit: Nevermind I used this fancy search function to find the answer. :slight_smile:

1 Like

It's in the prerelease build of the DVR. You need to Click+Hold or Shift+Click on the "Check for Updates" button in the web UI to get the newest build.

1 Like

Thanks everyone. It worked really well on the first recording I tried. As a proof of concept it should work. Have to think about the best way to proceed to make a real solution. This would probably benefit from the API to the dvr service once something like that is available.

1 Like