Feature request: Comskip ini access

Disables comskip, to save CPU.

Not available from tvOS yet.

It looks like, since some time around February 2/3, comskip.ini is now written to the Logs/comskip/{ID} directory by the code, rather than being a file in the same directory as the binaries. Unfortunately this means that my fix (using inotifywait) to replace the comskip.ini file no longer works, and commercials are messing up more than previously.

Are there any plans to tune the comskip process further soon, or any workaround you can suggest for me, short of simply preventing it from running on a show-by-show basis then implementing comskip with my own homebrew comskip.ini?

Can you share the changes you’ve made to comskip.ini? Are you customizing per show or just in general?

1 Like

I am not customising per show. I am using the last version in this thread:

http://www.kaashoek.com/comskip/viewtopic.php?f=7&t=1741

with some modifications. I’m no expert, by any means.

Note that this is tuned as generally as possible to US broadcast TV. As is usual for comskip, what works for one circumstance will probably not work for all. It’s possible your simpler comskip.ini is better for non-US viewers.


detect_method=107 ; 1=black frame, 2=logo, 4=scene change, 8=fuzzy logic, 16=closed captions, 32=aspect ration, 64=silence, 128=cutscenes, 255=all
validate_silence=1 ; Default, set to 0 to force using this clues if selected above.
validate_uniform=1 ; Default, set to 0 to force using this clues (like pure white frames) if blackframe is selected above.
validate_scenechange=1 ; Default, set to 0 to force using this clues if selected above.
verbose=10 ; Show a lot of extra info, level 5 is also OK, set to 0 to disable
max_brightness=60 ; Frame not black if any pixels checked are greater than this (scale 0 to 255)
test_brightness=40 ; Frame not pure black if any pixels checked are greater than this, will check average brightness (scale 0 to 255)
max_avg_brightness=25 ; Maximum average brightness for a dim frame to be considered black (scale 0 to 255) 0 means autosetting
maxbright=1 ; New
brightness_jump=200 ; New
max_commercialbreak=500 ; Maximum length in seconds to consider a segment a commercial break
min_commercialbreak=21 ; Minimum length in seconds to consider a segment a commercial break, some sports require lower numbers than normal tv shows
max_commercial_size=197 ; Maximum time in seconds for a single commercial or multiple commercials if no breaks in between
min_commercial_size=4 ; Mimimum time in seconds for a single commercial
min_show_segment_length=250 ; Any segment longer than this will be scored towards show (sports and 30 minute programming), increase this to 250 for 1 hour long programming
non_uniformity=500 ; Set to 0 to disable cutpoints based on uniform frames
max_volume=500 ; Any frame with sound volume larger than this will not be regarded as black frame
max_silence=100 ;
min_silence=12 ; Any deep silence longer than this amount of frames is a possible cutpoint
noise_level=5 ; New
ticker_tape=0 ; Amount of pixels from bottom to ignore in all processing
ignore_side=0 ; New, default 0
subtitles=0 ; New, default 0
logo_at_bottom=0 ; Set to 1 to search only for logo at the lower half of the video, do not combine with subtitle setting
use_existing_logo_file=1 ; Use logo file already created at beginning of show, default 0
two_pass_logo=1 ; New
punish=1 ; Compare to average for sum of 1=brightness, 2=uniform 4=volume, 8=silence, 16=schange, set to 0 to disable
punish_threshold=1.3 ; Multiply when amount is above average punish_threshold
punish_modifier=4 ; When above average * threshold multiply score by this value
intelligent_brightness=0 ; Set to 1 to use a USA specific algorithm to tune some of the settings, not advised outside the USA
logo_percentile=0.92 ; If more then this amount of logo is found then logo detection will be disabled
logo_threshold=0.7250 ; Digital signals can be higher
global_threshold=1.79 ; New
min_black_frames_for_break=1 ; Default 1
punish_no_logo=0 ; Default, set to 0 to avoid show segments without logo to be scored towards commercial
aggressive_logo_rejection=0
connect_blocks_with_logo=1 ; Set to 1 if you want successive blocks with logo on the transition to be regarded as connected, set to 0 to disable
delay_logo_search=0 ;
logo_filter=0 ; Set the size of the filter to apply to bad logo detection, 4 seems to be a good value
edge_step=2 ; New, default 1
cut_on_ar_change=1 ; Set to 1 if you want to cut also on aspect ratio changes when logo is present, set to 2 to force cuts on aspect ratio changes. set to 0 to disable
delete_show_after_last_commercial=0 ; Set to 1 if you want to delete the last block if its a show and after a commercial
delete_show_before_first_commercial=0 ; New, default 0
delete_show_before_or_after_current=0 ; Set to 1 if you want to delete the previous and the next show in the recording, this can lead to the deletion of trailers of next show
delete_block_after_commercial=0 ; Set to max size of block in seconds to be discarded, set to 0 to disable
remove_before=0 ; Amount of seconds of show to be removed before ALL commercials
remove_after=0 ; Amount of seconds of show to be removed after ALL commercials
shrink_logo=5 ; Reduce the duration of the logo with this amount of seconds
after_logo=0 ; Set to number of seconds after logo disappears comskip should start to search for silence to insert an additional cutpoint
before_logo=0 ; Set to number of seconds before logo appears comskip should start to search for silence to insert an additional cutpoint
padding=0.50
ms_audio_delay=5
volume_slip=40
skip_b_frames=0 ; Set to 1 to force Comskip to skip frames for higher processing speed.
thread_count=2 ; Set to utilize two cores
max_repair_size=200 ; Will repair maximum 200 missing MPEG frames in the timeline, set to 0 to disable repairing for players that don’t use PTS
disable_heuristics=4 ; Bit pattern for disabling heuristics, adding 1 disables heristics 1, adding 2 disables heristics 2, adding 4 disables heristics 3, 255 disables all heuristics
delete_logo_file=1 ; Set to 1 if you want comskip to tidy up after finishing
output_edl=1
output_vdr=1 ; Set to 1 if you want XBMC to skipping commercials
output_ffmeta=1
output_ffsplit=1

95% of those options are just being set to default values. I forgot how confusing and complicated all the comskip.ini examples out there are.

I suspect you’re getting better results because your detect method includes scene changes.

For now, how about I use comskip.ini from the data directory if it exists there?

Sounds good! Are there plans for internal optimization, to take into account recording settings (e.g. padding), country, channel, etc.? I imagine there are quite a few things that could be tweaked, and only a finite time to do so.

This is implemented in v2017.02.22.0443.

1 Like

Is this dynamic based on available cores?
thread_count=2 ; Set to utilize two cores

I am running on MAC MINI i7 quad core and it runs very fast. And I think you only run 1 COMSKIP at a time which is probably a good idea. Assuming 1 COMSKIP at a time would be good to have it use all 4 cores.

The reason I ask is sometimes you can get a processor with 2 cores and each core runs faster then a each processor with 4 cores. My 4 cores run very fast but am considering upgrading my NAS in the future and might consider running the DVR on it (maybe).

Based on my prior post I went to find the current comskip.ini on my MAC and could not find it. Pretty sure it used to be with the COMSKIP program. Did you move it or is it hidden?

You said you did the following. Is the file for changes to your default comskip.ini? Of is it replacement for your comskip.ini file. I.E. If you only used 2 cores and I wanted to use 4 cores could I just add that 1 parameter to a comskip.ini in the data folder and you would use both comskip.ini? Or do I need to copy your comskip.ini and make the changes to it?
For now, how about I use comskip.ini from the data directory if it exists there

The comskip.ini is copied into each Log folder where comskip runs.

If you add a custom comskip.ini it needs to be the full config, as they are not combined.

Here is the default comskip.ini the DVR uses:

use_existing_logo_file=0
thread_count=1
verbose=10
lowres=1
logo_fraction=0.39
delete_logo_file=1
output_vdr=1
output_edl=1
output_ffmeta=1
output_ffsplit=1

Just wanted to add...
In order to override the default Channels DVR comskip.ini, you need to place your modifed comskip.ini in its data directory which can be found by examining the Channels DVR log and looking for the line

2019/12/17 15:39:38 [SYS] Starting Channels DVR v2019.12.17.0213 (linux-x86_64 pid:24461) in /volume1/@appstore/ChannelsDVR/channels-dvr/data

So in my case the data directory is at /volume1/@appstore/ChannelsDVR/channels-dvr/data

1 Like

And once you have your modified comskip.ini in that data directory, Channels DVR will use it and no longer copy a comskip.ini file into the Logs directory. Channels DVR (when updated) will not overwrite your override comskip.ini file.

You can verify your override comskip.ini settings are being used by looking at the comskip log file in the Logs directory named video.log.

1 Like

I am going to put the comskip.ini into my data directory as suggested to that I may increase the thread count to '3'. The current comskip file is either 17 or 18 lines. The one with the extra line also contains 'lowres=1' at the end. So for my override comskip.ini file, do I include this line or not? What does this line do, and will it be a problem if my override file (which never changes?) does or does not contain this, depending on the content? Thanks

Sorry, this goes with my last post. Here is the current 18 line comskip.ini I see, including 'lowres=1' at the end. The first line is blank:

verbose=10
detect_method=123 ;; everything but scenechange
punish_no_logo=0
cc_correct_type_modifier=1
length_nonstrict_modifier=1.5 ;; required before below due to comskip.ini parsing bug
combined_length_nonstrict_modifier=1
min_show_segment_length=222
min_commercialbreak=45
use_existing_logo_file=0
logo_fraction=0.39
delete_logo_file=1
output_vdr=1
output_edl=1
output_ffmeta=1
output_ffsplit=1
thread_count=1
lowres=1

Just change thread_count=1 to thread_count=3.
You may want to check your CPU usage as that would take 3 cores.
Each Channels DVR transcode session also takes a core.
The daily Channels DVR guide update (between 9-11am) although short-lived also takes a core.

As far as what each setting does you can check the comskip.txt file in the distribution.
More info at http://www.kaashoek.com/comskip/

lowres=0 (0-10)
;Enables resolution reduction, setting to 10 makes comskip choose the best value automatically
;;This only works for certain types of video encoding, may not work for h.264 encoded video and may deliver bad results when used with hardware_decode=1

Here's what I'm using, with added output for VideoRedo Project file for commercial cutting.

verbose=10
detect_method=123 ;; everything but scenechange
punish_no_logo=0
cc_correct_type_modifier=1
length_nonstrict_modifier=1.5 ;; required before below due to comskip.ini parsing bug
combined_length_nonstrict_modifier=1
min_show_segment_length=222
min_commercialbreak=25
use_existing_logo_file=0
logo_fraction=0.39
delete_logo_file=1
output_vdr=1
output_edl=1
output_ffmeta=1
output_ffsplit=1
thread_count=2
lowres=1
output_videoredo3=1
videoredo_offset=0

So, either 'lowres=1' or "null for this line" was what my system created for each recent comskip job within each individual comskip.ini. Since I use both TVE and silicondust quatro, I'm guessing the system inserted 'lowres=1' for content that was SD content (over silicondust tuner). Since the comskip.ini placed in 'data' will be "permanent" and used for ALL jobs, will having 'lowres=1' be bad for HD content recorded from TVE?

No.
Not sure how you got different comskip.ini contents.
The default includes the line lowres=1

It basically tells comskip to look at a low res version of your recording to find the channel logo, etc. which speeds it up vs. having to scan the high res version.
You can play with all the comskip settings, but my life is too short for that stuff :grinning:
i.e. return in time investment to do that isn't worth the gain

Thanks for your input. So I looked at a few different 'Log' folders when looking for the system generated comskip.ini (to copy it). Upon examining a few recently dated log folders is where I noticed the discrepancy in the contents of the ini file. I guess that was my original question, why does the system create different ini files with or without the lowres setting? And, by placing a new 'default' one that is not system generated, I am no longer allowing the system to generate that specific file for the job and will only get the new default one I will put into the data folder.

Does anyone else know that answer to this? Maybe choosing to include the 'lowres' setting or not is not a big deal? I guess I just like to understand how things work and what the impact of my changes will be on the system before I make them, rather than 'playing with different settings'. I did look through the comskip forum in the link provided but nothing jumped out at me. Hoping the developers may know?

lowres is only used for HD recordings. I don't recall offhand why that is.