Creating a CutScene File

Here you can ask your questions on how to use Comskip for the detection of commercials. Also questions on how to remove commercials are welcome
Post Reply
jdm12989
Posts: 2
Joined: Sun Feb 12, 2017 4:35 pm

Creating a CutScene File

Post by jdm12989 »

I have a TV show that has a channel logo scene that is displayed ever time before going back to the show. From what I've been able to gather is that using a cutscene file will allow cutting the video at these points. And it would seem that you can create said file by using the -u, --dump=<int> argument. However, when I use this argument the program seems to just dump every frame from the video one-by-one into the dump file. Is there some tutorial or more information somewhere that I just could not find or can someone enlighten me on what I am doing wrong?

running:
Linux Mint 18.0 | kernel 4.4.0-59
comskip 0.81.089

command used:

Code: Select all

comskip -u 102300 --ini=comskip_default.ini video.ts
ini:

Code: Select all

verbose=12
detect_method=69        		; 1=black frame, 2=logo, 4=scene change, 8=fuzzy logic, 16=closed captions, 32=aspect ratio, 64=silence, 128=cutscenes, 255=all

;==== GENERAL SETTINGS ====
intelligent_brightness=1 		; Set to 1 to use a USA specific algorithm to tune some of the settings, not adviced outside the USA
max_commercialbreak=250 		; maximum length in seconds to consider a segment a commercial break
min_commercialbreak=30			; minimum length in seconds to consider a segment a commercial break
max_commercial_size=250			; 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=140 	; any segment longer than this will be scored towards show
padding=0
remove_before=0                 ; amount of seconds of show to be removed before ALL commericals
remove_after=0                  ; amount of seconds of show to be removed after ALL commercials
;ticker_tape=0					; amount of pixels from bottom to ignore in all processing 

;==== GLOBAL REMOVES ====
delete_show_before_first_commercial=0
min_commercial_break_at_start_or_end=25

;==== CPU LOAD REDUCTION ====
thread_count=2
hardware_decode=1
play_nice_start=-1
play_nice_end=-1
play_nice_sleep=2

;==== BLACK FRAME DETECTION SETTINGS ====
;test_brightness=40      	; frame not pure black if any pixels checked are greater than this, will check average brightness (scale 0 to 255)
;max_brightness=60      	; frame not black if any pixels checked are greater than this (scale 0 to 255)
min_black_frames_for_break=5
non_uniformity=500

;==== LOGO DETECTION SETTINGS ====
after_logo=0				; number of seconds after logo disappears to create pseudo black frame
before_logo=0				; number of seconds before logo appears to create pseudo black frame
connect_blocks_with_logo=0	; set to 1 if you want successive blocks with logo on the transition to be regarded as connected, set to 0 to disable
delete_logo_file=1			; set to 1 if you want comskip to tidy up after finishing
delay_logo_search=360		; number of seconds to wait before logo search
logo_at_bottom=1			; Set to 1 to search only for logo at the lower half of the video, do not combine with subtitle setting
;logo_filter=0              ; set the size of the filter to apply to bad logo detection, 4 seems to be a good value
logo_present_modifier=0.5
;logo_threshold=0.8250
punish_no_logo=0			; Default, set to 0 to avoid show segments without logo to be scored towards commercial	
shrink_logo=0				; reduce the duration of the logo with this amount of seconds
two_pass_logo=1
use_existing_logo_file=0	; use logo file in same directory if one exists

;==== SILENCE DETECTION SETTINGS ====
max_volume=0                ; any frame with sound volumen larger than this will not be regard as black frame
;min_silence=20              ; any deep silence longer than this amount of frames is a possible cutpoint

;==== CUTSCENE DETECTION SETTINGS ====
;cutscene_frame=0
;cutscene_dumpfile=""
;cutscene_threshold=10
;cutscene_file1="comskip_mytv.dmp"
;cutscene_file8=""

;==== OUTPUTS ====
output_edl=1
output_framearray=0			; create a big excel file for detailed analysis, set to 0 to disable
output_vdr=0				; set to 1 if you want XBMC to skip commercials
delete_logo_file=0
erik
Site Admin
Posts: 3368
Joined: Sun Aug 21, 2005 3:49 pm

Re: Creating a CutScene File

Post by erik »

Drag and drop the recording on comskipGUI.exe
let it run till completed
Click on the time bar at the top to navigate to where you want the cutscene being recorded.
Hit F1 and see what key to press to save the current frame as a cutscene file
jdm12989
Posts: 2
Joined: Sun Feb 12, 2017 4:35 pm

Re: Creating a CutScene File

Post by jdm12989 »

erik wrote:Drag and drop the recording on comskipGUI.exe
let it run till completed
Click on the time bar at the top to navigate to where you want the cutscene being recorded.
Hit F1 and see what key to press to save the current frame as a cutscene file
Okay, so first off, I'm using linux. So I tried running comskip-gui and I received an error "ComSkip: missing option <file>. So then I run "comskip-gui --ini=config.ini path/to/file.ts" and it runs displaying the video, however, once it completes the pass it closes and says "Commercials were found. Close window when done." Not sure where to go from here.
erik
Site Admin
Posts: 3368
Joined: Sun Aug 21, 2005 3:49 pm

Re: Creating a CutScene File

Post by erik »

Seems the linux comskip-gui is incomplete and does not support the reviewing.
virtual
Posts: 15
Joined: Sat Jan 20, 2018 11:52 am

Re: Creating a CutScene File

Post by virtual »

I'm trying to tune a specific .ini file for a TV channel that doesn't work with default settings neither with Comskip nor Videoredo Ad-Detective.
This cutscene feature works very well, as I captured two DMP files and enabled cutscene mode in my INI file:

Code: Select all

detect_method=132 ;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
max_commercialbreak=600 ;maximum length in seconds to consider a segment a commercial break
min_commercialbreak=240 ;minimum length in seconds to consider a segment a commercial break
max_commercial_size=600 ;maximum time in seconds for a single commercial or multiple commercials if no breaks in between
min_commercial_size=10 ;mimimum time in seconds for a single commercial
min_show_segment_length=600 ; any segment longer than this will be scored towards show.
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
min_silence=12 ; Any deep silence longer than this amount  of frames is a possible cutpoint
ticker_tape=0 ; Amount of pixels from bottom to ignore in all processing
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
punish=0 ; 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=2 ; 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 adviced 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.75
punish_no_logo=1 ; 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
logo_filter=0 ; set the size of the filter to apply to bad logo detection, 4 seems to be a good value.
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_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
padding=0
ms_audio_delay=5
volume_slip=40
skip_b_frames=0 ; Set to 1 to force Comskip to skip frames for higher processing speed.
hardware_decode=0 ; Set to 1 to enable hardware accelerated video decoding, only available in donator version
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_debugwindow=0
output_framearray=0 ; create a big excel file for detailed analysis, set to 0 to disable
output_data=0 ; create a dump of the user data channel, used for CC and XDS (such as V-Chip info). Can be use together with output_framearray to remote debug CC decoding
output_videoredo=0 ; The old videoredo format
output_videoredo3=1 ; The new videoredo v3 format.
output_womble=0
output_mls=0 ; set to 1 if you want MPeg Video Wizard bookmark file output
output_cuttermaran=0
output_mpeg2schnitt=0
output_mpgtx=0
output_dvrcut=0
output_zoomplayer_chapter=0
output_zoomplayer_cutlist=0
output_edl=1
output_dvrmstb=0 ; Set to 1 if you're running DVRMS-Toolbox
output_edlx=0
output_vcf=0
output_bsplayer=0
output_btv=0 ; set to 1 if you want Beyond TV chapter cutlist output
output_projectx=0 ; set to 1 if you want ProjectX cutlist output (Xcl)
output_avisynth=0
output_vdr=0 ; set to 1 if you want XBMC to skipping commercials
output_demux=0 ; set to 1 if you want comskip to demux the mpeg file while scanning
sage_framenumber_bug=0
sage_minute_bug=0
live_tv=0 ; set to 1 if you use parallelprocessing and need the output while recording
live_tv_retries=4 ; change to 16 when using live_tv in BTV, used for mpeg PS and TS
dvrms_live_tv_retries=300 ; only used for dvr_ms
standoff=0 ; change to 8000000 when using live_tv in BTV
cutscene_frame=0
cutscene_dumpfile=""
cutscene_threshold=10
cutscenefile1="paramount1.dmp"
cutscenefile2="paramount2.dmp"
cutscenefile3=""
cutscenefile4=""
cutscenefile5=""
cutscenefile6=""
cutscenefile7=""
cutscenefile8=""
After processing the MKV/TS file from TVHeadend and opening the resulting Vprj file, there are the "red marks" indicating the cutscenes in the correct positions, but the blocks are not marked as commercial (i.e. found none).

What I was trying to do is instructing Comskip to begin marking commercials with the first cutscene and then stop at the second cutscene; the two marks must be between 4-8 minutes of distance between each other. Also, the best would be align the block at the scene change before/after the two cutscenes.
Is something possible?
erik
Site Admin
Posts: 3368
Joined: Sun Aug 21, 2005 3:49 pm

Re: Creating a CutScene File

Post by erik »

The cutscenes generate cutpoints. They do not force block start/end
In the GUI you should be able to confirm cutpoints have been added at the cutscenes
Are they present?
Forcing block start/end is behavior not yet present
virtual
Posts: 15
Joined: Sat Jan 20, 2018 11:52 am

Re: Creating a CutScene File

Post by virtual »

erik wrote:In the GUI you should be able to confirm cutpoints have been added at the cutscenes
Are they present?
I'm unable to tell from the debugwindow, even after reading the manual; what colour should they be?
Here's the result window after processing.

Image

If I open the resulting Vprj file in VideoRedo I get:

Image

So definitely Comskip detects the correct cutscenes, but does not create the "blocks" (in my image above: 1, 2, 3 and 4).
Last edited by virtual on Tue Mar 06, 2018 6:55 pm, edited 1 time in total.
erik
Site Admin
Posts: 3368
Joined: Sun Aug 21, 2005 3:49 pm

Re: Creating a CutScene File

Post by erik »

Can you follow the "how to ask for help" post?
Makes it easier to help
virtual
Posts: 15
Joined: Sat Jan 20, 2018 11:52 am

Re: Creating a CutScene File

Post by virtual »

Yes, I could, but basically I just wanted to know which is the method to make Comskip work in cutscene mode "generally".
Set the detect_method=128 and cutscene_threshold=10 (for example), then pass the cutscene files and then...? How would it mark the commercials?
I'm already done that but it seems not to create the blocks, even if my min_commercialbreak < cutscene distance (see picture above) < max_commercialbreak. Am I missing something?
erik
Site Admin
Posts: 3368
Joined: Sun Aug 21, 2005 3:49 pm

Re: Creating a CutScene File

Post by erik »

The cutscenes are only used to find where to cut. Not for deciding if something is show or commercial
You need the use the regular scorimg methods for that
virtual
Posts: 15
Joined: Sat Jan 20, 2018 11:52 am

Re: Creating a CutScene File

Post by virtual »

I was able to solve the problem, eventually, by reading this post:
viewtopic.php?p=1900#p1900

So the important INI parameter that I was missing was:

global_threshold=0.95

... that toghether with:

detect_method=128
delete_show_after_last_commercial=1
delete_show_before_first_commercial=1

and the INI posted before now works well.
How can I improve it with scene change, as the cutscenes are a couple of seconds "inside" commercials?
I've tried with detect_method=132 (128 cutscene + 4 scene change) but the output frames are exactly the same; on the CSV however, I have this for example:

Code: Select all

sep=,
frame,brightness,scene_change,logo,uniform,sound,minY,MaxY,ar_ratio,goodEdge,isblack,cutscene, MinX, MaxX, hasBright, Dimcount,PTS,2500
72302,79,490,0,19570,484,10,566,126,0,268435456,1,10,710,195,12720,2892.040000,0,2
72303,79,495,0,19544,429,10,566,126,0,268435456,1,10,710,195,12665,2892.080000,0,2
72304,79,490,0,19542,376,10,566,126,0,268435456,1,10,710,195,12716,2892.120000,0,2
72305,79,495,0,19510,415,10,566,126,0,268435456,0,10,710,195,12539,2892.160000,0,2
72306,79,495,0,19498,365,10,566,126,0,268435456,0,10,710,195,12492,2892.200000,0,2
72307,79,490,0,19530,322,10,566,126,0,268435456,0,10,710,195,12875,2892.240000,0,2
72308,79,490,0,19475,336,10,566,126,0,268435456,0,10,710,195,12454,2892.280000,0,2
72309,79,495,0,19452,272,10,566,126,0,268435456,0,10,710,195,12353,2892.320000,0,2
72310,78,490,0,18873,263,10,566,126,0,268435456,0,10,710,195,12559,2892.360000,0,2
72311,79,485,0,19417,260,10,566,126,0,268435456,0,10,710,195,11652,2892.400000,0,2
72312,79,495,0,19419,192,10,566,126,0,268435456,0,10,710,195,11687,2892.440000,0,2
72313,78,485,0,18925,152,10,566,126,0,268435456,0,10,710,195,12951,2892.480000,0,2
72314,78,490,0,18876,170,10,566,126,0,268435456,0,10,710,195,12394,2892.520000,0,2
72315,78,495,0,18874,139,10,566,126,0,268435456,0,10,710,195,12428,2892.560000,0,2
72316,78,495,0,18881,99,10,566,126,0,268435456,0,10,710,195,12526,2892.600000,0,2
72317,78,495,0,18869,101,10,566,126,0,268435456,0,10,710,195,12441,2892.640000,0,2
72318,78,495,0,18870,79,10,566,126,0,268435456,0,10,710,195,12461,2892.680000,0,2
72319,78,495,0,18887,57,10,566,126,0,268435456,0,10,710,195,12688,2892.720000,0,2
72320,78,490,0,18846,56,10,566,126,0,268435456,0,10,710,195,12291,2892.760000,0,2
72321,78,495,0,18844,60,10,566,126,0,268435456,0,10,710,195,12272,2892.800000,0,2
72322,78,490,0,18870,57,10,566,126,0,268435456,0,10,710,195,12459,2892.840000,0,2
72323,79,490,0,19410,57,10,566,126,0,268435456,0,10,710,195,11652,2892.880000,0,2
72324,79,495,0,19411,59,10,566,126,0,268435456,0,10,710,195,11642,2892.920000,0,2
72325,78,480,0,18946,50,10,566,126,0,268435456,0,10,710,195,13261,2892.960000,0,2
72326,86,95,0,26749,50,10,566,126,0,0,100,10,710,189,31175,2893.000000,0,2
72327,86,490,0,26801,35,10,566,126,0,0,100,10,710,190,31251,2893.040000,0,2
72328,86,485,0,26904,29,10,566,126,0,0,100,10,710,188,31160,2893.080000,0,2
72329,86,485,0,26949,28,10,566,126,0,0,100,10,710,190,31262,2893.120000,0,2
72330,86,485,0,27005,26,10,566,126,0,0,100,10,710,189,31317,2893.160000,0,2
72331,86,485,0,27125,21,10,566,126,0,0,100,10,710,188,31457,2893.200000,0,2
72332,86,485,0,27165,19,10,566,126,0,0,100,10,710,187,31654,2893.240000,0,2
The cutscene is detected (correctly) on frame 72302, but the commercial should end at 72325 included (72326 is the show). Any suggestion on how to "align" the cut correctly?
Post Reply