Thursday, March 27, 2008

How to Replace Smartskip with Comskip in BeyondTV

If you're a BeyondTV user you already know that it comes loaded with its own commercial detection they call SmartSkip.  I've used Smartskip with BeyondTV and it works, but its not perfect and what they give you is what you get.  If you want a commercial skipping engine that is constantly updated, more configurable and can run while your still recording the show then I recommend you give the excellent comskip program a try.  I'll show you how to set up comskip within BeyondTV - it's not too difficult and you'll be happy you put in the extra effort.

smartskip2

Comskip is a program developed by Erik Kaashoek.  It's freeware (donations accepted) and its continually updated to work with all of the popular HTPC programs and detect the latest in TV commercial methods.

ADVANTAGES OF COMSKIP OVER SMARTSKIP:

  • Commercial detection process is faster
  • Commercial detection is more accurate and methods are updated with new version often
  • Comskip is very configurable.  Detect only certain channels or shows, detect during recording or after or only during certain times if  you want.

NOTE: This tutorial is for BeyondTV users only.  Please read this post for the tutorial on installing comskip with other HTPC software programs.

INSTALLING COMSKIP WITH BEYONDTV:

1. Download Comskip from here 

2. Unzip Comskip to a directory on your BTV PC.

3. Edit your comskip.ini file (this is where the settings are kept).  I have a copy of my comskip.ini file below with those settings I changed highlighted in bold red:

detect_method=111
validate_silence=1
validate_uniform=1
validate_scenechange=1
verbose=10
max_brightness=60
test_brightness=40
max_avg_brightness=25
max_commercialbreak=600
min_commercialbreak=25
max_commercial_size=125
min_commercial_size=4
min_show_segment_length=125
non_uniformity=500
max_volume=500
min_silence=12
ticker_tape=0
logo_at_bottom=0
punish=0
punish_threshold=1.3
punish_modifier=2
intelligent_brightness=0
logo_percentile=0.92
logo_threshold=0.75
punish_no_logo=1
aggressive_logo_rejection=0
connect_blocks_with_logo=1
logo_filter=0
cut_on_ar_change=1
delete_show_after_last_commercial=0
delete_show_before_or_after_current=0
delete_block_after_commercial=0
remove_before=0
remove_after=0
shrink_logo=5
after_logo=0
padding=0
ms_audio_delay=5
volume_slip=20
skip_b_frames=1
max_repair_size=200
disable_heuristics=4
delete_logo_file=0
output_framearray=0
output_videoredo=0
output_womble=0
output_mls=0
output_cuttermaran=0
output_mpeg2schnitt=0
output_mpgtx=0
output_dvrcut=0
output_zoomplayer_chapter=0
output_zoomplayer_cutlist=0
output_edl=0
output_edlx=0
output_vcf=0
output_bsplayer=0
output_btv=1
output_projectx=0
output_avisynth=0
output_vdr=0
output_demux=0
sage_framenumber_bug=0
sage_minute_bug=0
live_tv=0
live_tv_retries=4
dvrms_live_tv_retries=300
standoff=0
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" play_nice_sleep=12
play_nice_start=1
play_nice_end=2359

4. You'll now need to download the customprocess.xml file from Snapstream.  This file is used to define the processing tasks to be run on recordings and how & when these tasks are run.  Put the customprocess.xml file into the "C:\Documents and Settings\All Users\Application Data\SnapStream\Beyond TV" directory.  If you need more detail on this step read this Snapstream knowledge-base article

5. Download the BTV DLL file ssppcmd.dll from Snapstream and place this file in the "C:\Documents and Settings\All Users\Application Data\SnapStream\Beyond TV\Plugins" directory.  If you need more detail on this step read this Snapstream knowledge-base article

6. Edit "CustomProcess.xml" (see copy of the file below) and replace "ENTER THE PATH OF YOUR COMMAND HERE" with the absolute path of an executable that takes a filename as a command line argument.   In our case our command-line file will be called "batch.bat" so if you put it in C:\Program Files\BTVComskip\, you'll make this path "C:\Program Files\BTVComskip\batch.bat"

This executable will then be run on every file generated by Beyond TV.

<CustomTasks>
<Task>
<GUID>531E0175-87F4-4d6f-B464-E603BC641DAE</GUID>
<Priority>Deferred</Priority>
<PropertyCollection>
<Property>
<Name>Command</Name>
<Value>ENTER THE PATH OF YOUR COMSKIP BATCH FILE HERE</Value>
</Property>
</PropertyCollection>
</Task>
</CustomTasks>

This program (batch.bat) is executed for every recording in BeyondTV. Because it is set to Deferred it will execute immediately after a show finishes recording (as long as you have "time constraints" disabled in BTV Webadmin Settings.

EDIT:  Per Snapstreams post-processing steps, if you change Deferred in the Priority tags with Immediate, the script will run regardless of the time constraints.  Thanks to Nick Burns for this reminder :)

7. Download the comskip playback script HERE (created by cmcquistion) [Note: this script is updated occasionally by cmcquistion so be sure and check this thread for the latest updates.

Again, be sure you change the line (in bold) of "Enter The Path of Your Comskip Batch Folder Here" to whatever folder you have the comskip.exe installed to.

@ECHO OFF
::
::
:: Comskip script to commercial detection on Videos, using Comskip
:: (Last Edited 03-22-07)
::
::
SET COMSKIPFOLDER=ENTER THE PATH OF YOUR COMSKIP BATCH FOLDER HERE
::
::
IF EXIST "%~pdn1*log*" DEL "%~pdn1*log*"
IF EXIST "%~pdn1*txt" DEL "%~pdn1*txt"
IF EXIST "%~pdn1*index.dat" DEL "%~pdn1*index.dat"
IF EXIST "%~pdnx1.chapters.xml" DEL "%~pdnx1.chapters.xml"
IF EXIST "%~pdn1.chp" DEL "%~pdn1.chp"
IF EXIST "%~pdn1.vprj" DEL "%~pdn1.vprj"
ECHO .
ECHO Running Commercial Detection, using Comskip
ECHO .
"%COMSKIPFOLDER%\comskip.exe" "%~pdnx1"
::
:: clean up log and txt files
IF EXIST "%~pdn1*log*" DEL "%~pdn1*log*"
IF EXIST "%~pdn1*txt" DEL "%~pdn1*txt"
IF EXIST "%~pdn1*index.dat" DEL "%~pdn1*index.dat"
::
::

Note from the creator of the script:  "For all of these scripts to work, you should NOT have any MPG, TP, or VPRJ files on the root of your video drive. The QSF and CUT scripts actually output video to the root of the drive, as a temporary location. They also check the root of the drive, to see if MPG, TP, or VPRJ files already exist there. This is done as a crude method of determining whether another QSF or CUT job is already running."

Credit to cmcquistion who worked all of this process out and continues to update his thread on the topic here.  cmcquistion outlines a process to include cutting the commercials and fixing OTA recording errors as well, but for simplicity (and the fact I didn't need to do it) I've kept that portion of the process out of this post.

 

If you need further assistance with comskip, head over to the comskip forums.  For help on the Snapstream side of things check out this snapstream forums thread