BTV/AdScan Automation Guide

bits

New member
1. Copy a file called ssppcmd.dll into the following folder: C:\Documents and Settings\All Users\Application Data (this may be hidden)\Snapstream\Beyond TV. This file is available at : http://snapstream.helpserve.com/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=1254&nav=0,1

2. Create the following xml file by copying what you see here, paste into Notepad and the save the file as CustomPostProcessing.xml. Save this file to: C:\Documents and Settings\All Users\Application Data (this may be hidden)\Snapstream\Beyond TV.

<CustomTasks>
<Task>
<GUID>531E0175-87F4-4d6f-B464-E603BC641DAE</GUID>
<Priority>DeferredImmediate</Priority>
<PropertyCollection>
<Property>
<Name>Command</Name>
<Value>C:\Program Files\VideoReDoPlus\vrd.bat</Value>
</Property>
</PropertyCollection>
</Task>
</CustomTasks>

3. Create a bat file in the following folder by copying what you see below into Notepad and save the file as vrd.bat. This bat file goes in: C:\Program Files\VideoReDoPlus.

"C:\Program Files\VideoReDoPlus\AdScan.vbs" %* /q
:: clean up log and txt files
del "%~pdn1".log
del "%~pdn1".logo.txt
del "%~pdn1".mpg.index.dat
del "%~pdn1".tp.index.dat
del "%~pdn1".txt

4. You will need to make a few minor changes to AdScan.vbs, which is located at : C:\Program Files\VideoReDoPlus. Right click on this file and select 'Edit' from the drop down menu. This should open the file for editing.
Make the changes indicated in Bold lettering and then 'Save' the file.

Below are the contents of the AdScan.vbs file with the changes Bolded:

'
' AdScan.vbs - cscript file to run Ad-Detective scan in the background from the command line.
' This will create a VidoeReDo project with the scenes marked.
'
' Commmand line: cscript //nologo "C:\program files\videoredo\AdScan.vbs" <mpeg file> <project filename> [/q]
'
' Note: AdScan.vbs should have the full folder name on it. i.e. c:\program files\VideoReDo\AdScan.vbs"
' likewise the the mpeg file.
' <project filename" is optional and if present should include a folder as well.
' [/q] to run quietly.

set Args = Wscript.Arguments
if Args.Count < 1 or Args.Count > 3 then
wscript.echo( "? Invalid number of arguments - usage is: AdScan <mpeg file> [<project filename>] [/q]" )
Wscript.Quit 2
end if

' Parse arguments
sourceFile = ""
destFile = ""
quietFlag = false
for i = 0 to Args.Count-1
p = args(i)
if ( p = "/q" or p = "/Q" ) then
quietFlag = true
elseif len(sourceFile) <> 0 then
destFile = p
else
sourceFile = p
end if
next

'Create VideoReDo object and open the source project / file.
if quietFlag = true then
'wscript.echo("Running in quiet mode.")
Set VideoReDoSilent = WScript.CreateObject( "VideoReDo.VideoReDoSilent" )
set VideoReDo = VideoReDoSilent.VRDInterface
else
Set VideoReDo = WScript.CreateObject( "VideoReDo.Application" )
end if

openFlag = VideoReDo.FileOpen( sourceFile )

if openFlag = false then
Wscript.echo( "? Unable to open file/project: " + sourceFile )
Wscript.Quit 3
end if

' Start the scan
' Parameters: 1 - Fast Search: 0 = program default, 1 = Yes use fast search, 2 = No, use slower more exhaustive search.
' 2 - Auto Cut: 0 = program default, 1 = Yes automatically mark cuts, 2 = No, Don't mark cuts.
' 3 - Disable Display: 0 - Program default, 1 = Always disable the display (also minimizes), 2 = Show scan.
'
displayMode = 0
if quietFlag then displayMode = 1

scanStarted = VideoReDo.StartAdScan( 0, 0, 1 )
if scanStarted = false then
Wscript.Echo("? Unable to start Ad-Detective Scan.")
Wscript.Quit 5
end if


' Wait until scan is done.
while( VideoRedO.IsScanInProgress() )
Wscript.Sleep 2000
wend

projectFile = VideoReDo.WriteProjectFile( destFile )
'Wscript.Echo(" Ad-Detective project written to: " + projectFile )

VideoReDo.Close()
'Wscript.quit 0

It is not obvious but the last three lines need to have a ' put in front in order to make these lines non active.


What should happen is, when BTV finishes recording; a Windows cmd window will pop up and VRD go to the tray in a sec or so. The Windows cmd window does not automatically minimize...have not figured that out yet but you can manually minimize it. When VRD is finished a Vprj file will be written to the same folder that the video was recorded to and VRD will close.

Good Luck!

BTW the credit for the above guide should go to those that actually did all the work! I am just a conduit......
 
Last edited:

bits

New member
phd said:
Thanks for the post. I'm sure other BTV users will find it useful.
I realize that this guide is specific to BTV users but I think it may also help with Sage and GBPVR users.
 

jimvodka

New member
something must have changed using beta of both programs and i am getting a scrip error.
a box opens up with a ok box.."running is quiet mode" when click ok.
error windows opens.."cannot find import.dll may be missing or wrong version. file navsliderbar.dll, function ?setrange@chorzslider@@qaexhhh@z (error 0)
 

jimvodka

New member
i have both vrd plus and tv on the same computer but i use plus usually to edit my files.
i just tested plus out on a small file and it worked without error.

jim
 

emagin

New member
Is it possible to make these scripts skip the VRD ad detection and use the BTV ad detection instead?
I find VRD ad detection to be fairly inaccurate, whereas the BTV is more accurate.
So if it could snip based on the XML that BTV generates that would be better.

Thanks
 

bits

New member
Is it possible to make these scripts skip the VRD ad detection and use the BTV ad detection instead?
I find VRD ad detection to be fairly inaccurate, whereas the BTV is more accurate.
So if it could snip based on the XML that BTV generates that would be better.

Thanks
I wrote this guide long ago and not long after writting it I went with comskip for commercial detection. Comskip is significantly better than BTV and Ad-Scan.

I use Dirmon2 (freeware) to automatically start comskip working on a video file that has just finished recording. comskip generates a .vprj file that I drop into VRD. I usually record 0-12 shows per day and therefore batch process. I manually confirm the cuts but that takes no more than 15-30secs per 1-2 hour show. I record OTA HD, SD and SD dvr-ms files from a very wide variety of channels and show types....comskip handles them all quite easily.

If you need more details let me know. BTW VRD is great software but Ad-Scan is not why I value it so much.
 

emagin

New member
Thanks Pat.
However the instructions in that thread are for manually dragging the BTV xml file into VRD to edit cuts. That's works great and I do it all the time when I want to manually edit something. What I was looking for is some way to automate this on each show after BTV finishes doing its Smart Skip scan.

Bits, thanks for the explanation.
I'll take a look comskip although I'm fine with the BTV adscan - it's fairly accurate for what I need at least.
Would be interested to see how you set it up.
Not much of a scripter but I can try to hack my way around in it.
 
Last edited:

bits

New member
Thanks Pat.
However the instructions in that thread are for manually dragging the BTV xml file into VRD to edit cuts. That's works great and I do it all the time when I want to manually edit something. What I was looking for is some way to automate this on each show after BTV finishes doing its Smart Skip scan.

Bits, thanks for the explanation.
I'll take a look comskip although I'm fine with the BTV adscan - it's fairly accurate for what I need at least.
Would be interested to see how you set it up.
Not much of a scripter but I can try to hack my way around in it.
No scripting is required....

1. Download the latest comskip http://www.kaashoek.com/files/ comskip80_007.zip
2. Unzip the file to any location you desire. comskip is an executable and does not require installation.
3. The comskip.ini file is where you customize the settings for comskip. You edit it by opening it in notepad. Below is my comskip.ini file:

My comskip.ini file:

detect_method=255 ;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=420 ;maximum length in seconds to consider a segment a commercial break
min_commercialbreak=25 ;minimum length in seconds to consider a segment a commercial break
max_commercial_size=125 ;maximum time in seconds for a single commercial or multiple commercials if no breaks in between
min_commercial_size=5 ;mimimum time in seconds for a single commercial
min_show_segment_length=125 ; 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=20
skip_b_frames=0 ; Set to 1 to force Comskip to skip frames for higher processing speed.
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=0 ; set to 1 if you want comskip to tidy up after finishing
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=1
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_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=1 ; 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=1 ; only used for dvr_ms
standoff=0 ; change to 8000000 when using live_tv in BTV
cuttermaran_options="cut=\"true\" unattended=\"true\" muxResult=\"false\" snapToCutPoints=\"true\" closeApp=\"true\""
mpeg2schnitt_options="mpeg2schnitt.exe /S /E /R25 /Z %2 %1"
avisynth_options="LoadPlugin(\"MPEG2Dec3.dll\") \nMPEG2Source(\"%s\")\n"
dvrcut_options="dvrcut \"%s.dvr-ms\" \"%s_clean.dvr-ms\" "
windowtitle="Comskip - %s"

4. Download Dirmon2 http://www.dragonglobal.biz/download/.
5. Install Dirmon2
6. Below are my settings for Dirmon2:

My configuration settings in Dirmon2

[Global]
Polling Time = 600
Available Resources = 90

[Service]
Start Automatically = 1
Run as Local System = 1
Allow Interaction With Desktop = 1
Run as User = 0
User Name =
User Password =

[Job Description 1]
Name = Jake-PC
Processor = C:/Users/Jake/Desktop/Downloads/Comskip/comskip.exe
Targets Are Paths = 0
Targets Are Extensions = 1
Command Line Options = --ini="C:\Users\Jake\Desktop\Downloads\Comskip\comskip.ini"
Must Exist 1 =
Must Exist Logic = OR
Must Exist 2 =
Must And Or Must Not Exist Logic = AND
Must Not Exist 1 = txt
Must Not Exist Logic = OR
Must Not Exist 2 =
Directory 1 = D:/recorded tv
Target 1 = mpg
Target 2 = dvr-ms
Resources Needed = 90
Timeout Enabled = 0
Timeout = -1
Priority Boost Due To Job Description = 0
Priority Boost Due To Age = 1
Priority Boost Due To Name = 0
Process Subdirectories = 1
Wait Until File Is Finished = 1
Wait Until File Is Idle = 1
Wait Until File Is Not Growing = 1
Wait Until File Is Not Growing Time = 3
Wait Until Drive Is Idle = 0
Wait Until Drive Is Idle Time = 2
Hide Console = 1
Blackout Enabled = 0
Blackout Start Time = 0
Blackout End Time = 0
Avoid Hidden Files = 1
Avoid Large Files = 0
Avoid Files Larger Than = -1
Avoid Small Files = 0
Avoid Files Smaller Than = -1
Avoid New Files = 0
Avoid Files Newer Than = -1
Avoid Old Files = 0
Avoid Files Older Than = -1

Notes for Dirmon2

In the Job Management tab there is a field called 'Where'. This is where you specifiy what folder for Dirmon2 to watch. I have mine set to the folder that BTV is set to put its recordings in. When BTV completes a recording Dirmon2 will automatically start comskip. When comskip is done it will output a .vprj file to the same folder that the video is in.

Processor is location of the comskip folder and the comskip exe

Command Line Options is what provides the comskip exe with the processing instructions from the comskip.ini.

When changing parameters in Dirmon2 be sure to stop the process (Global Settings tab) and uninstall (Global Settings tab). Make the changes, save and then install (Global Settings tab) and start the process. If you do not follow this sequence then any changes you make will not take affect.

Target 1 and Target 2 are entered into the Targets section on the Job Management tab as: mpg,dvr-ms you can add other extensions like ts or ps.

Note: comskip has a version that provides the ability to scan h264 files but is only available if you make a donation.

This should get you started. Let me know if you need more information.
 

emagin

New member
Ok so it ran last night on my /DAILY folder which is where BTV records my shows (analog cable to mpg).

I see a bunch of 1k text files such as the one attached.
But what happens next?
Do I have to engage in some kind of processing of that to snip them with VideoRedo or not?
I still see the source MPG file and they are not altered.
Admittedly I watch mostly PBS programs, which only have 'ads' in the first 2 minutes and the last 5 min, but I thought this setup would do something to remove at least something in there.

Sorry, I think i must have missed a step.

I think I need to reactivate the VRD bat file in the first part of your post, maybe that's what I'm missing.
 

Attachments

Last edited:

bits

New member
Ok so it ran last night on my /DAILY folder which is where BTV records my shows (analog cable to mpg).

I see a bunch of 1k text files such as the one attached.
But what happens next?
Do I have to engage in some kind of processing of that to snip them with VideoRedo or not?
I still see the source MPG file and they are not altered.
Admittedly I watch mostly PBS programs, which only have 'ads' in the first 2 minutes and the last 5 min, but I thought this setup would do something to remove at least something in there.

Sorry, I think i must have missed a step.

I think I need to reactivate the VRD bat file in the first part of your post, maybe that's what I'm missing.
I think you have missed the point of my guide. The point is to remove the commercials entirely. My method, which I stated is semi-automatic. Dirmon2 + comskip find the commercials automatically but conformation of cut points is done manually as is putting the confirmed files into the batch processor. (Take the .vprj file and load it into VRD. Confirm the cut points and then load into the batch processor.)

No commercial detection software on planet earth is even close to 100% accurate therefore unless you are willing to have the occassional missing parts of a show then easy fast manual conformation of cut points is required.

Also, my method is not intended for marking BTV recordings for commercial skipping.
 
Last edited:

emagin

New member
Yes, I get it. So unlike a couple days ago, now I see full .vprj files
The accuracy of the adscan is fairly impressive, so I'm quite sold on Comskip.
I fell guilty I just swiped your settings, I don't quite get all the details but will start to study.

VRD does a great job of saving off the files quickly after I drag the .vprj file onto the VRD window -- the ads appear right away.

I really do need to automate this. I'm not concerned with accuracy, I'm concerned with my time!
 

bits

New member
Yes, I get it. So unlike a couple days ago, now I see full .vprj files
The accuracy of the adscan is fairly impressive, so I'm quite sold on Comskip.
I fell guilty I just swiped your settings, I don't quite get all the details but will start to study.

VRD does a great job of saving off the files quickly after I drag the .vprj file onto the VRD window -- the ads appear right away.

I really do need to automate this. I'm not concerned with accuracy, I'm concerned with my time!
I recently added additional recording capability, so now I have two PCs that I record stuff on and even though it only takes me 15-30secs per video to confirm cuts I am starting to look around for a fully automated approach. The biggest obstical however is that my new PC is vista and vista is a bugger when it comes to deleting files...so file cleanup will be a challenge. And then there is the VMC--DVR-MS thing to deal with....
 

halsboss

New member
I really do need to automate this. I'm not concerned with accuracy, I'm concerned with my time!
emagin, want a bet on your changing your mind following the 1st family viewing where a critical plot element is missing and everyone "lost the plot" ? (Assuming you can ever figure out that was the cause, rather than an ongoing collective scratching of heads) :D
 

Untechnoman

New member
I've been trying to implement the DirMon2 and Comskip solution according to the setup Bits outlined back on 12/12/08. Unfortunately I have not been able to get it to work properly. I believe Comskip is set up properly; when I drag-n-drop a BTV file, it processes the file and provides an Vprj file. However, when the Dirmon2 executes, it processes (The Task Manager shows the file being processed, the application, under Current Status shows an active job), but I get nothing at the conclusion but in one instance a txt file with the ABC logo.

I think that maybe my settings for Dirmon2 are not correct, vis-a-vis Bits. I've attached a screenshot of the Job Management tab from my Dirmon2 setup if that helps.

When I set it up I assumed that the "Processor = C:/Users/Jake/Desktop/Downloads/Comskip/comskip.exe" in Bits' directions was ment to be the location of the comskip.exe file in the "Program to run" under the [What] section (also that the "/" were ment to be "\").

Any assistance would be greatly appreciated. I would like to get this working.

Thanks
 

Attachments

bits

New member
I've been trying to implement the DirMon2 and Comskip solution according to the setup Bits outlined back on 12/12/08. Unfortunately I have not been able to get it to work properly. I believe Comskip is set up properly; when I drag-n-drop a BTV file, it processes the file and provides an Vprj file. However, when the Dirmon2 executes, it processes (The Task Manager shows the file being processed, the application, under Current Status shows an active job), but I get nothing at the conclusion but in one instance a txt file with the ABC logo.

I think that maybe my settings for Dirmon2 are not correct, vis-a-vis Bits. I've attached a screenshot of the Job Management tab from my Dirmon2 setup if that helps.

When I set it up I assumed that the "Processor = C:/Users/Jake/Desktop/Downloads/Comskip/comskip.exe" in Bits' directions was ment to be the location of the comskip.exe file in the "Program to run" under the [What] section (also that the "/" were ment to be "\").

Any assistance would be greatly appreciated. I would like to get this working.

Thanks
This is my most recent Dirmon2 setup:

[Global]
Polling Time = 600
Available Resources = 90

[Service]
Start Automatically = 1
Run as Local System = 1
Allow Interaction With Desktop = 1
Run as User = 0
User Name =
User Password =

[Job Description 1]
Name = Jake-PC
Processor = C:/Users/Jake/Desktop/Downloads/Comskip/comskip.exe
Targets Are Paths = 0
Targets Are Extensions = 1
Command Line Options = --ini="C:\Users\Jake\Desktop\Downloads\Comskip\comskip.ini"
Must Exist 1 =
Must Exist Logic = OR
Must Exist 2 =
Must And Or Must Not Exist Logic = AND
Must Not Exist 1 = txt
Must Not Exist Logic = OR
Must Not Exist 2 =
Directory 1 = D:/recorded tv
Target 1 = mpg
Target 2 = dvr-ms
Resources Needed = 90
Timeout Enabled = 0
Timeout = -1
Priority Boost Due To Job Description = 0
Priority Boost Due To Age = 1
Priority Boost Due To Name = 0
Process Subdirectories = 1
Wait Until File Is Finished = 1
Wait Until File Is Idle = 1
Wait Until File Is Not Growing = 1
Wait Until File Is Not Growing Time = 3
Wait Until Drive Is Idle = 0
Wait Until Drive Is Idle Time = 2
Hide Console = 1
Blackout Enabled = 0
Blackout Start Time = 0
Blackout End Time = 0
Avoid Hidden Files = 1
Avoid Large Files = 0
Avoid Files Larger Than = -1
Avoid Small Files = 0
Avoid Files Smaller Than = -1
Avoid New Files = 0
Avoid Files Newer Than = -1
Avoid Old Files = 0
Avoid Files Older Than = -1

Your setup looks correct. In your screenshot it looks as though you have a space in word comsk ip.ini that is contained in [ini="C:\Users\Jake\Desktop\Downloads\Comskip\comskip.ini"], there should not be a space there. Looking at the configuration I posted for Dirmon2 it has a space and I do not know why. As you can see by my posting of my current setup there is a space that should not be there...for some reason when I paste it into this thread a space appears.

I hope that solves the issue. Maybe someone out there knows why pasting comskip.ini ends up being comsk ip.ini?!
 
Last edited:
Top Bottom