You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

EyeTV with Commercial Skipping HD DVR Server

I use EyeTV HD and Turbo.264 HD to record and transcode h.264 shows for playback on a Mac, Apple TV, iPad, iPhone. I also use a self-modified version of etvcomskip to detect and mark commercials, which are then automatically skipped at playback. This makes tv viewing a lot more pleasurable and efficient, and is especially helpful controlling advertiser access to children. In case this is useful to others, I've outlined the steps here:


  1. Eric Kaashoek's website Comskip and download his HD-capable Comskip software. "Commercial" commercial-skippingcompanies (ReplayTV, TiVo, Dish, etc.) are quickly sued out of existence or into submission, even if they simply provide a basic "30-second skip" feature. Comskip is open source beerware that you can download, install, and use yourself, and you can't sue anyone for publishing source code. And rather than providing a simple 30-second skip feature, it detects, marks, and provides that capability for automatic commercial skipping.
  2. Comskip a Windows executable, so you'll need WINE (WINdows Emulator) on OS X to run it. First, download and install Xcode (free from the Apple App store), then download and install and install Macports, then in Terminal, run "sudo port selfupdate; sudo port install wine-devel". Finally, make sure that /Applications/Utilities/X11.app is added to your list of applications to run at login (WINE uses X11 to display Windows windows). Yes, this is windows emulation, but on a half-decent box you'll see that commercial skipping runs at around twice real-time for h.264 HD recordings.
  3. Download and install etvcomskip (and PyeTV if you want EyeTV to work with Front Row). The 2010 version of etvcomskip doesn't work with Comskip's latest HD capabilities, and the latest Comskip mpeg libraries do not allow live tv processing, so install these files to get everything working. Once you done this, you'll have a commercial-skipping HD DVR box on your Mac that can stream to Apple TV, iOS, or export to iTunes.

Comskip software

This lives in the directory /Library/Application Support/ETVcomskip.


Edit the file ./comskip/comskip.ini to use these HD-tuned settings, tailored for US cable:


detect_method=127;1=black frame, 2=logo, 4=scene change, 8=fuzzy logic, 16=closed captions, 32=aspect ration, 64=silence, 128=cutscenes, 255=all
max_avg_brightness=21;maximum average brightness for a dim frame to be considered black (scale 0 to 255) 0 means autosetting
non_uniformity=50; Set to 0 to disable cutpoints based on uniform frames
max_volume=20; any frame with sound volume larger than this will not be regarded as black frame
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
intelligent_brightness=1; Set to 1 to use a USA specific algorithm to tune some of the settings, not adviced outside the USA

volume_slip=150

output_dvrmstb=0; Set to 1 if you're running DVRMS-Toolbox
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


Edit the file ./MarkCommercials.app/Contents/Resources/MarkCommercials.py to use WINE to run comskip.exe nicely. Grep for these changes:


EyeTV.launch()


msg = 'Error: unable to communicate with %s\n' % options.app


#cmd = '"/Library/Application Support/ETVComskip/Wine.app/Contents/Resources/bin/wine" "/Library/Application Support/ETVComskip/comskip/comskip.exe" --ini="/Library/Application Support/ETVComskip/comskip/comskip.ini" "%s"' % MpgFile

# MacPorts 64-bit wine

#cmd = '"/Applications/Wine.app/Contents/Resources/bin/wine" "/Library/Application Support/ETVComskip/comskip/comskip.exe" --ini="/Library/Application Support/ETVComskip/comskip/comskip.ini" "%s"' % MpgFile

cmd = '"/opt/local/bin/wine" "/Library/Application Support/ETVComskip/comskip/comskip.exe" --ini="/Library/Application Support/ETVComskip/comskip/comskip.ini" "%s"' % MpgFile


# nice the wine command

cmd = "/usr/bin/nice -n 14 " + cmd


EyeTV software

EyeTV uses the triggered AppleScripts RecordingStarted and RecordingDone in the directory /Library/Application\ Support/EyeTV/Scripts/TriggeredScripts. Open these using the AppleScript Editor and use these scripts instead. You will probably have to Save As... on your desktop, then copy the updated script back into the correct directory to avoid permissions issues.


RecordingStarted.scpt


on RecordingStarted(recordingID)

delay 10

-- comskip81 uses ffmpeg and does not support live tv; put this in RecordingDone.scpt

-- set cmd to "export DISPLAY=:0.0; /usr/bin/nice -n 5 '/Library/Application Support/ETVComskip/MarkCommercials.app/Contents/MacOS/MarkCommercials' --log " & recordingID & " &> /dev/null &"

-- display dialog cmd

-- set cmd to "env > /tmp/etv_test.log &"

-- do shell script cmd


--disable this if you do not want a logfile written

write_to_file((short date string of (current date) & " " & time string of (current date)) & "Recording Started run for ID: " & recordingID & (ASCII character 13), (path to "logs" as string) & "EyeTV scripts.log", true)

end RecordingStarted


on write_to_file(this_data, target_file, append_data)

--from http://www.apple.com/applescript/sbrt/sbrt-09.html

try

set the target_file to the target_file as string

set the open_target_file to open for access file target_file with write permission

if append_data is false then set eof of the open_target_file to 0

write this_data to the open_target_file starting at eof

close access the open_target_file

return true

on error

try

close access file target_file

end try

return false

end try

end write_to_file

RecordingDone.scpt


-- Run the python MarkCommercials script for the given recording

-- this must be run with the RecordingStarted script

-- it will check if there were multiple PIDs for the recording and runs MarkCommercials for each pid

-- requires updated MarkCommercials which allows specifying the pid

-- by Ben Blake, September 2009


-- modified for latest Comskip, which cannot be run until after recording is finished; waits for Turbo.264 HD to stop running as well

-- S.T.Smith


global LogMsg


on RecordingDone(recordingID)


set ProcessName to "Elgato H.264 Decoder"

set DelayTime to 60

set MaxDelays to 4 * 60 -- four hours


-- delay until the process slows down or stops running

repeat MaxDelays times

delay DelayTime -- delay at least once to give it a chance to start

set pcpu to CPUPercentage(ProcessName)

if pcpu is equal to "" or pcpu < 2.0 then exit repeat -- break out of delay loop if it's not running

end repeat


delay 10

-- comskip81 uses ffmpeg and does not support live tv; take this from RecordingStarted.scpt

set cmd to "export DISPLAY=:0.0; /usr/bin/nice -n 5 '/Library/Application Support/ETVComskip/MarkCommercials.app/Contents/MacOS/MarkCommercials' --log " & recordingID & " &> /dev/null &"

-- display dialog cmd

-- set cmd to "env > /tmp/etv_test.log &"

do shell script cmd


set LogMsg to ""

CheckMultiplePIDs(recordingID)


--disable this if you do not want a logfile written

if (count of LogMsg) > 0 then

write_to_file((short date string of (current date) & " " & time string of (current date)) & LogMsg & (ASCII character 13), (path to "logs" as string) & "EyeTV scripts.log", true)

end if

end RecordingDone


-- testing code: this will not be called when triggered from EyeTV, but only when the script is run as a stand-alone script

on run

tell application "EyeTV.app"

set rec to «class Unqu» of item 1 of every «class cRec»


my RecordingDone(rec)

end tell

end run


-- compute the percentage CPU used by ProcessName

on CPUPercentage(ProcessName)

set ProcessPS to do shell script ("ps -axwwc | grep '" & ProcessName & "' | grep -v grep || true")

if ProcessPS is not equal to "" then

set ProcessID to word 1 of ProcessPS

set ProcessPS to do shell script ("ps -xwwco pid,ppid,%cpu -p " & ProcessID & " | tail -1")

set ProcessCPU to word 3 of ProcessPS

return ProcessCPU as number

else

return ""

end if

end CPUPercentage


on CheckMultiplePIDs(recordingID)

--check if there are multiple Video PIDs in the file


tell application "EyeTV.app"

set input_text to my read_from_file((path to "logs" as string) & "ETVComskip" & ":" & recordingID & "_comskip.log")

if (count of (input_text as string)) > 0 then

set logdata to every paragraph of input_text

set logdata_lastrow to (item ((count of logdata) - 1) of logdata) as string


if (items 1 thru 19 of logdata_lastrow) as string = "Video PID not found" then

--multiple Video PIDs, rerun MarkCommercials until successful


set recrdingIDInteger to recordingID as integer

set rec to «class cRec» id recrdingIDInteger

set LogMsg to "RecordingDone found multiple PIDs for recording ID: " & recordingID & ", Channel " & («class Chnm» of rec) & " - " & («class Titl» of rec)


set PIDs to (items 44 thru ((count of logdata_lastrow) - 2) of logdata_lastrow) as string

set delims to AppleScript's text item delimiters

set AppleScript's text item delimiters to ", "

set PID_List to {}

set PID_List to every word of PIDs

set AppleScript's text item delimiters to delims


repeat with pid in PID_List

my launchComSkip(recordingID, pid)

repeat while (my mcIsRunning())

delay 5

end repeat

end repeat


end if

end if

end tell

end CheckMultiplePIDs


on read_from_file(target_file)

--return the contents of the given file

set fileRef to (open for access (target_file))

set txt to (read fileRef for (get eof fileRef) as «class utf8»)

close access fileRef

return txt

end read_from_file


on write_to_file(this_data, target_file, append_data)

--from http://www.apple.com/applescript/sbrt/sbrt-09.html

try

set the target_file to the target_file as string

set the open_target_file to open for access file target_file with write permission

if append_data is false then set eof of the open_target_file to 0

write this_data to the open_target_file starting at eof

close access the open_target_file

return true

on error

try

close access file target_file

end try

return false

end try

end write_to_file


on launchComSkip(recID, pid)

if pid = "" then

set cmd to "export DISPLAY=:0.0; /usr/bin/nice -n 5 '/Library/Application Support/ETVComskip/MarkCommercials.app/Contents/MacOS/MarkCommercials' --force --log " & recID & " &> /dev/null &"

else

set cmd to "export DISPLAY=:0.0; /usr/bin/nice -n 5 '/Library/Application Support/ETVComskip/MarkCommercials.app/Contents/MacOS/MarkCommercials' --force --log " & recID & " --pid=" & pid & " &> /dev/null &"

end if


do shell script cmd

end launchComSkip


on mcIsRunning()

set processPaths to do shell script "ps -xww | awk -F/ 'NF >2' | awk -F/ '{print $NF}' | awk -F '-' '{print $1}' "

return (processPaths contains "MarkCommercials")

end mcIsRunning

<Links Edited By Host>

Mac mini Server (Mid 2010), Mac OS X (10.7.4), Lion Server, EyeTV HD, Turbo.264 HD

Posted on Jun 4, 2012 7:57 AM

Reply
144 replies

Feb 6, 2013 5:55 PM in response to Ste88

I was part of the onslaught of millions who upgraded to iOS 6.1 this week. A really nice improvement in performance and functionality.


But iOS 6 has removed chapter skipping using the left and right skip buttons in video playback. You now must press two buttons to skip commercials: the chapter selection icon on the left, then the specific chapter. What inconvenience! We're not peasants -- please send feedback to Apple requesting the easier functionality. I don't know if this affects Apple TV as well.


http://www.apple.com/feedback/ipad.html


"Would you please revert iOS 6's Video chapter skipping functionality to iOS 5, which used the left/right arrows for chapter skipping within .m4v iTunes files, or provide a Settings toggle to provide this capability?"


Also please send similar feedback to Elgato for their EyeTV app.


http://tickets.kb.elgato.com/?language=en-us


And if anyone knows how to code this into the OS, please let us know. A video playback toggle like this would make a good tweak.

Feb 7, 2013 2:24 AM in response to essandess

Hi

I use a lot the skipping feature in the video on my iphone and me too I've noticed IOS6 is much worst in this regard. However I can skip chapter using the left and right button on the video in the iphone. My problem is I can no more skip chapters through my headset buttons: when I press twice the headset button, it skips to the next video instead of the next chapter. Is anyone aware of an app/tweak that would allow me to use the headset buttons to navigate chapters?

tahnks

Feb 7, 2013 10:54 AM in response to fracnl14

> I can skip chapter using the left and right button on the video in the iphone


That's odd -- are you using 6.0 or 6.1? iPhone 5? This stuff should be consistent, but you never know.


I've done a quick check at the App Store, all the baseline repos, and http://www.cocoacontrols.com/controls, but I don't see anything that will tweak the behavior of the video playback buttons. I'd also appreciate any pointers to the right function calls.

Feb 18, 2013 1:05 AM in response to essandess

Hi Essandess and all!

This may be a bit out of topic but I have been reading all the brilliant posts and thought you guys would be the ones to answer my eyetv/hd pvr question either way.


I have eyetv and would like to know if there is a software or code available for the adding of a text watermark to the videos within it? This will avoid the loss of quality that happens between one software to the next and encoding time. I know there has to be a way for this to be done since the trial of the Turbo.264 came with a superimpossed watermark for all videos. How can I achieve this? Please tell me one of you know because if you guys don't know, nobody will know, LOL!!!


Thanks in advance for your help, and for the posts, awesome read!! :-)


Leylann

Feb 20, 2013 7:43 AM in response to essandess

Hi

this issue of chapter skipping is annoying. to sum up, I have iphone 4 running ios 6.1. I can skip to next chapters on the iphone but not through headset buttons (it skips to next video). Do you know if there is any workaround? by any chance does ios 6.2 fix the issue?

i have another related question. it would be very useful to skip back and forward by 30 seconds (like in podcast audio app) to instant replay or to skip adv. does anyone know if there is an app or a method to skip 30 second back and ahead on the video (or music) app?

thanks

Feb 22, 2013 1:41 PM in response to essandess

essandess,

Here are my questions I submitted to you privately. I wanted to move this conversation to this public forum.


I have some questions about your modified version of EyeTVComskip.


1. You state your comskip.ini has parameters for US cable operators. Do you know if those parameters are the same for over-the-air commercials? I am based in United States in the East Coast


2. Why do you process EyeTV files in both RecordingStarted and RecordingDone? I see same command in both files. Wouldn't be enough just to use RecordinStarted?


3. What are the requirements to run the combination of your files and EyeTVComskip in Lion?

Feb 23, 2013 1:13 PM in response to gardnern

gardnern wrote:


I'm not much for exporting to iTunes however pushing an appropriately named file to Plex would be pretty spiffy.


Does your export process do any renameing and/or file copying to specific locations?


I wrote a little recordingdone script to parse the files for season and episode numbers and stick them into a Plex-friendly directory structure. I'm attaching it below. I wrote it before I saw this thread and knew that comskip could be made to work with HD PVR recordings in the fashion shown.


Everything here in this thread I've installed and it works great. Big thanks to everyone for the help and tips. Great thread. Right now, I'm just manually calling this script I wrote, but I'd love it if I could change my recordingdone script to automate this export process.


My script handles episodes without season or episode numbers but just using the episode title if those number fields are blank. This is necessary for some kids TV I record for my little boy.


I really like Plex, with Roku boxes it handles big libraries much more gracefully than the Apple TV + iTunes (IMHO). Also, they're cheap - as little as $29 for a refurb. I always wished the AppleTV worked better since the iPad/iPhone integration is great and the UI is much nicer.


Anyway, here's my script:


--Run the python MarkCommercials script for the given recording--this must be run with the RecordingStarted script-- it will check if there were multiple PIDsfor the recording and runs MarkCommercialsfor each pid-- requires updated MarkCommercials which allows specifying the pid--byBenBlake,September2009-- modified commander flatus 2/2013-- remember that we're starting from the comskip post-processing script
-- i commented, documented a bit
-- this will directly export the H.264 that a Hauppauge HD PVR generates - very quickly
-- the resulting file is smaller than the iPad transcode and literally takes a minute if you generate recordings with this hardware
-- otherwise, this may be slower ymmv
-- Applescript is a dreadful language
-- Don'
t try to export directly to a network share unless you know what you're doing
-- as best i can tell etvcomskip doesnt do anything to my h.264 recordings
-- there is a donation version but from a cursory search it appears it wont work
-- either. i mostly use this for movies and kids shows so it doesnt matter much for me
-- Some definitions below
-- variable thisTitle - raw title of show ie Seinfeldfrom eyeTV
-- variable ParsTitle - above with illegal filesystem characters removed
-- mcisrunning subroutine to check if markcommercials is running
-- parseout - subroutine to remove illegal filesystem characters
-- CheckMultiplePIDs - subroutine to check if multiple PIDs in one recording
-- variable rec - recordingID from EyeTV
-- variable theRec
-- variable thisEpisode - text episode name ie The Puerto Rican Day Parade
-- variable EyeTvArchiveLocation location of recordings use colons instead of slashes
-- variable ExportLocation location where converted recordings go
-- variable TempLocation location for temporary files
-- variable fname location of eyetvp file for season and episode info
-- variable sid season number
-- variable eid episode number
-- variable tempEp episode title
global LogMsg
on RecordingDone(recordingID)

set LogMsg to ""
--CheckMultiplePIDs(recordingID)

-- set up logfile
-- disable this if you do not want a logfile written
if (count of LogMsg) > 0 then
write_to_file((short date string of (current date) & " " & time string of (current date)) & LogMsg & (ASCII character 13), (path to "logs" as string) & "EyeTV scripts.log", true)
end if


-- Grab some basics from EyeTV. RecoringID, Show name, Episode name. It'
ll be used later. tell application "EyeTV"
set rec to recordingID as integer
set theRec to recording id rec
set thisTitle to title of theRec
setParsTitle to my parseout(thisTitle) set thisEpisode to episode of theRec

end tell

--Customizethis script for yourself.Thenext three variables are locations on your system where we will read andexport to
--Use complete paths, dont put network shares in here

--Setthis value to the location whereEyeTV records to
setEyeTvArchiveLocation to "Macintosh HD:Users:ted:Documents:EyeTV Archive:"asstring
--Setthis location to where you want your exports to write to
setExportLocation to "Macintosh HD:Users:ted:Desktop:Plex:"asstring
--Setthis to a temporary location. A file "temp.plist"is written andthen deleted from here
setTempLocation to "Macintosh HD:Users:ted:"asstring
--Now we're gonna go to the finder, find the show and grab the file out of the package that has the meta data. It'll be written to a temp file and we'll grab the season and episode # from it.
tell application "Finder"

-- Set the alias for the show we just got done recording
-- This gives the script the filename of the eyetv recording in the filesystem
if thisEpisode is "" then
set fpath to EyeTvArchiveLocation & ParsTitle & ".eyetv" as alias
else
set fpath to EyeTvArchiveLocation & ParsTitle & " - " & thisEpisode & ".eyetv" as alias
end if

-- The .eyetv file is a package. We'
re going to read it's contents and find the .eyetvp file. It'll be stored in the fname variable

set eyetvp to do shell script "ls -1 "& quoted form of POSIX path of fpath &"/*.eyetvp"asstring set eyetvp to every paragraph of eyetvp -- paragraph == line
set fname to item 1 of eyetvp

end tell

--Great! now grab Season number andEpisode number out of this temp - eyetvp file and create the sedat variable.This will be used in the file export later. --You can grab more meta data inthis routine and also tweak the way the file name meta data is created. tell application "System Events" set fileRecord to (value of property list file fname) set sid to value of property list item "SEASONID" of property list item "epg info" of property list file fname
set eid to value of property list item "EPISODENUM" of property list item "epg info" of property list file fname
end tell

tell application
"Finder"
--set up directory for a show - ie Seinfeld directory to contain season directories and episode files
--if it doesn't exist, create it
set fileLocation to ExportLocation & ParsTitle
if not (exists folder fileLocation) then
make new folder at alias ExportLocation with properties {name:ParsTitle}
end if

-- set up directory for seasons and if it doesn'
t exist, create one
set fileLocation to ExportLocation&ParsTitle&":"&"Season "& sid
set tempDir to ExportLocation&ParsTitle set tempFolder to "Season "& sid
set tempSid to sid asstring --if season id is blank or zero just put shows in the main directory
if(exists folder fileLocation)isfalseand tempSid isnot""and tempSid isnot"0"then make new folder at alias tempDir with properties {name:tempFolder} endif end tell

--Now, tell EyeTV to set the file name and location andexport the file. -- TODO: I'd like to have an option to just rename the file in place here and/or export using Turbo.264 and/or export in HD720p format.
tell application "EyeTV"
set theDateStamp to (do shell script "date +%Y%m%d.%H%M%S")
-- tempEp is the episode name
set tempEp to thisEpisode as string
if eid is not "" then
set tempEid to eid as integer
else
set tempEid to 0 as integer
end if

set tempSeason to sid as string

-- if title, season, and episode numbers are not blank or zero
-- file will look like Seinfeld:Season 10:Episode 3:Seinfeld S10E3.mp4
-- mp4 is hardcoded because i'
m just sucking out the H.264 if tempEp isnot""and tempSeason isnot""and tempSeason isnot"0"and tempEid isnot"0"and tempEid isnot""then set fileName to ExportLocation&ParsTitle&":Season "& sid &":"&ParsTitle&" "&"S"& sid &"E"& eid &".mp4" elseif tempSeason isnot""and tempSeason isnot"0"then --have season number,useDate AND NAME ie no episode number
set tempEpDate to (do shell script "date +%m%d%Y")asstring set fileName to ExportLocation&ParsTitle&":Season "& sid &":"& tempEp &"-"& tempEpDate &".mp4" elseif tempEp isnot""then --at this point, should have no season number,no episode number, so just use name
set fileName to ExportLocation&ParsTitle&":"& tempEp &".mp4" else --No name,no season,no episode name just use date for filename in directory of shows ie Seinfeld:03061999.mp4 set tempEpDate to (do shell script "date +%m%d%Y")asstring set fileName to ExportLocation&ParsTitle&":"& tempEpDate &".mp4" endif -- change thisif you want, I just want the H.264 video
--if you're not capturing off of a Hauppauge HD PVR or similar this may make things slower, not faster!!!
export from theRec to file fileName as "H.264"
end tell

end RecordingDone
-- one more edit for plex export, only section below.
-- this subroutine isn'
t called from anywhere that i can tell--if i remove it, something will certainly break because Applescriptis a pain in the butt
on readFile
(unixPath) set foo to (open for access (unixPath)) set txt to (read foo for(get eof foo)) close access foo
return txtend readFile--this will not be called when triggered fromEyeTV, but only when the script is run as a stand-alone script-- sets up a loop to run the exportwith all currently selected shows
on run
tell application
"EyeTV" set selectedRecordings to selection of programs window
repeat
with theRecording in selectedRecordings
--display dialog "theRecording ID "&(get unique ID of theRecording as integer) set recordingID to unique ID of theRecording as integer
myRecordingDone(recordingID) end repeat
end tellend run
on
CheckMultiplePIDs(recordingID) --check if there are multiple VideoPIDsin the file

tell application
"EyeTV" set input_text to my read_from_file((path to "logs"asstring)&"ETVComskip"&":"& recordingID &"_comskip.log") if(count of (input_text asstring))>0then set logdata to every paragraph of input_text
set logdata_lastrow to (item ((count of logdata)-1) of logdata)asstring
if(items 1 thru 19 of logdata_lastrow)asstring="Video PID not found"then --multiple VideoPIDs, rerun MarkCommercialsuntil successful

set recrdingIDInteger to recordingID as integer
set rec to recording id recrdingIDInteger
setLogMsg to "RecordingDone found multiple PIDs for recording ID: "& recordingID &", Channel "&(channel number of rec)&" - "&(title of rec)
setPIDs to (items 44 thru ((count of logdata_lastrow)-2) of logdata_lastrow)asstring set delims to AppleScript's text item delimiters
set AppleScript'
s text item delimiters to ", " set PID_List to {} set PID_List to every word of PIDs setAppleScript's text item delimiters to delims

repeat with pid in PID_List
my launchComSkip(recordingID, pid)
repeat while (my mcIsRunning())
delay 5
end repeat
end repeat

end if
end if
end tell
end CheckMultiplePIDs
-- read, write - self explanatory
on read_from_file(target_file)
--return the contents of the given file
set fileRef to (open for access (target_file))
set txt to (read fileRef for (get eof fileRef) as «class utf8»)
close access fileRef
return txt
end read_from_file
on write_to_file(this_data, target_file, append_data)
--from http://www.apple.com/applescript/sbrt/sbrt-09.html
try
set the target_file to the target_file as string
set the open_target_file to open for access file target_file with write permission
if append_data is false then set eof of the open_target_file to 0
write this_data to the open_target_file starting at eof
close access the open_target_file
return true
on error
try
close access file target_file
end try
return false
end try
end write_to_file
-- runs comskip on shows
on launchComSkip(recID, pid)
if pid = "" then
set cmd to "'
/Library/ApplicationSupport/ETVComskip/MarkCommercials.app/Contents/MacOS/MarkCommercials' --force --log " & recID & " &> /dev/null &"
else
set cmd to "'
/Library/ApplicationSupport/ETVComskip/MarkCommercials.app/Contents/MacOS/MarkCommercials' --force --log " & recID & " --pid=" & pid & " &> /dev/null &"
end if

do shell script cmd
end launchComSkip
--is markcommercials running?
on mcIsRunning()
set processPaths to do shell script "ps -xww | awk -F/ '
NF >2' | awk -F/ '{print $NF}' | awk -F '-' '{print $1}' "
return (processPaths contains "MarkCommercials")
end mcIsRunning
--Subroutine to remove troublesome characters
to parseout(stringtoparse)
set illegals to (ASCII character of 60) & (ASCII character of 62) & (ASCII character of 58) & (ASCII character of 34) & (ASCII character of 47) & (ASCII character of 92) & (ASCII character of 124)
repeat with i from 1 to count (illegals)
set testletter to (text i thru i of illegals)
set the_offset to 1
repeat
set the_offset to offset of testletter in stringtoparse
if the_offset > 0 then
set stringtoparse to (text 1 thru (the_offset - 1) of stringtoparse) & "_" & (text (the_offset + 1) thru -1 of stringtoparse)
else
exit repeat
end if
end repeat
end repeat
return stringtoparse
end parseout

Mar 5, 2013 8:07 AM in response to Leylann

@Leylann, is a software or code available for the adding of a text watermark to the videos within it?


Don't know. I'd look in the mp4v2 tools.


@fracnl14, an app or a method to skip 30 second back and ahead on the video (or music) app?


Please try one of these and tell us which, if any, supports embedded mp4 chapter information. ReplayerHD Pro, GoodPlayer, and It's Playing all look like good options, and we really want a player that respects chapter markings embedded in the .m4v files.


@gmartine, parameters are the same for over-the-air commercials? Why do you process EyeTV files in both RecordingStarted and RecordingDone? requirements to run the combination of your files and EyeTVComskip in Lion?


Those parameters are from Erik Kaashoek based on a h.264 video that I sent to him. I don't know how well they will work for ota broadcats, but I'd expect well -- you be the judge. Kaashoek has an entire forum devoted to tuning issues from around the world. The RecordingStarted/RecordingDone scripts are written for dirt simple load balancing. Comskip is run once, after recording and after Exporting, by RecordingDone. I think that the latest and greatest from Kaashoek will allow marking of live tv streams, but I've found that can cause recording and/or transcoding quality issues, so I just set up the process sequentially: record, transcode, mark commercials. I'd expect 2012+ era CPUs/GPUs (if EyeTV even uses the GPU) are a lot less sensitive to HD transcoding/decoding cpu loads than my little box, and these scripts can be modied to process all-at-once if anyone wants to make this mod because they want to watch commercial-free shows now-now-now, rather then the next day or week as I usually operate. I'd recommend a 16 GB box for processing HD files like this, though, especially for sequentially recorded shows. And all this stuff will work on 10.6, 10.7, and 10.8. ETVComskip's built-in Python will eventially need to be upgraded, but that's another story. It all works fine across platforms now.


@commander-flatus, I really like Plex


I tried Plex after Apple killed Front Row, but it always showed the transcoded lower-res shows for iPhone/iPad, rather than the full 1080i recordings. I couldn't get it to work so I gave up on it. Has Plex fixed this How do you get Plex to show the best quality recording that EyeTV has? Will it respect embedded chapter markings?

Mar 18, 2013 11:32 AM in response to essandess

@essandess Those parameters are from Erik Kaashoek based on a h.264 video that I sent to him. I don't know how well they will work for ota broadcats, but I'd expect well -- you be the judge. Kaashoek has an entire forum devoted to tuning issues from around the world. The RecordingStarted/RecordingDone scripts are written for dirt simple load balancing. Comskip is run once, after recording and after Exporting, by RecordingDone. I think that the latest and greatest from Kaashoek will allow marking of live tv streams, but I've found that can cause recording and/or transcoding quality issues, so I just set up the process sequentially: record, transcode, mark commercials. I'd expect 2012+ era CPUs/GPUs (if EyeTV even uses the GPU) are a lot less sensitive to HD transcoding/decoding cpu loads than my little box, and these scripts can be modied to process all-at-once if anyone wants to make this mod because they want to watch commercial-free shows now-now-now, rather then the next day or week as I usually operate. I'd recommend a 16 GB box for processing HD files like this, though, especially for sequentially recorded shows. And all this stuff will work on 10.6, 10.7, and 10.8. ETVComskip's built-in Python will eventially need to be upgraded, but that's another story. It all works fine across platforms now.


Does this means that I can only use RecordingStarted?

Apr 3, 2013 11:51 AM in response to essandess

essandess "I don't understand the question. The scripts available at etvcomskip use RecordingStarted, RecordingDone, and ExportDone. If you're comfortable with AppleScript and Python you can configure them to use however you like, or just use them as written."


It is my understanding that Comskip will execute certain commands based upon certain signals received from EyeTV via triggered scripts. Is it enough to launch the Markcommercials.py script using just RecordingStarted?


I only need to have my .etv files marked on the fly. I dont need to wait until the recording is done. I am not interested in exporting anything yet. Is it clear? Sorry I could be acting out of ignorance.

Apr 3, 2013 3:45 PM in response to gmartine

ExportDone is a NOOP if there aren't any exports. If you want to mark commercials live on HD content, you'll have to: (1) verify that comskip now supports this for HD content—Eric didn't for a while after switching to ffmpeg libraries; (2) modify the existing RecordingStarted/RecordingDone scripts so that MarkCommercials is launched by RecordingStarted; (3) make sure all this concurrent HD video processing doesn't bring your box to its knees, or produce glitchy recordings.

Apr 18, 2013 9:51 AM in response to essandess

I had this working on my older Mac mini (2011) but now that I'm using a 2012 (quad i7 with dual drive) it isn't working well. Here is what I'm using for EyeTV:


Latest version (3.6?)

EyeTV Plus for digital and analog channels

HDHomerun


Both of these record to mpeg2 and not the new H264 format.


For CommSkip I did the following:

Downloaded the 2.0.2 version (not the newer h264 as I believe that does not work with mpeg2 recordings)

Downloaded XCode

Downloaded XQuartz

Downloaded Macports

Ran the sudo commands (both said nothing needed to be done)

Installed CommSkip

Restarted everything


X11 starts up and EyeTV records just fine. I don't get the commercial marking however. One time it did as I was testing (start recording a program, then stop after a commercial break is over). When I set it to record shows in their entirety it has not marked commercials.


Do I need the latest 1.0rc2 for h264?

Should I try downloading Commskipp directly and replacing the files that EyeTV installed?

Any ways to check to see what part of the process is and is not working?

EyeTV with Commercial Skipping HD DVR Server

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.