Thoughts about comskip settings.

Started by DeltaMikeCharlie, June 05, 2025, 04:22:41 PM

Previous topic - Next topic

DeltaMikeCharlie

Comskip is used for detecting and skipping ads and as far as I can tell, the current comskip configuration produces a number of files.  The 3 files of interest are: Recording.edl, Recording.txt and Recording.vdr.

When Kodi loads a recording to be played, it requests the 'cutpoints' from TVHeadend.

TVHeadend will first try to read the cutpoints from Recording.txt.  If it is successful, it will stop there.  If no Recording.txt file is found, TVH will then try to read the cutpoints from Recording.edl.  Recording.vdr is never referenced.

I have been doing some work on TVH that will write 'scene marker' records into an 'edl' file for the start and then end of the EPG event.  If, for example, there are 2 minutes of pre-padding a 30 minute programme and then 5 minutes of post-padding, scene markers will be inserted at 2 minutes and 32 minutes.  These scene markers are written immediately after the recording has finished.

Unfortunately, when comskip runs, it overwrites the scene marker edl records that were just created.

I would like IceTV to consider making a few changes so that these two features can coexist.

comskip.ini
output_default=0    ; Turn off the default comskip 'txt' output.
edl_skip_field=3    ; Use the ad break marker type (3) instead of the cut marker type (0).
output_vdr=0        ; Turn off the unneeded 'vdr' output.

In addition to this, I have written small proof-of-concept script that demonstrates the principle of saving the TVH scene markers before comskip runs and then reapplying them once comskip has created its edl file.

#!/bin/bash
#Get the file name only
BASEONLY=`basename "$1" mkv`
#Get the directory name only
DIRONLY=`dirname "$1"`
#Create the EDL file name
FULLNAME="$DIRONLY/$BASEONLY"edl
#If the EDL file exists, save the scene marker records (type = 2)
if test -f $FULLNAME; then
    cat $FULLNAME | awk '$3 == 2 {print $0}' > "$FULLNAME"_saved
fi

#Run comskip
/usr/share/kodi/addons/service.tvheadendicetv/bin/comskip --ini=dmc_comskip.ini sample.mkv

#If a saved EDL file exists, add that to the end of the new EDL
if test -f "$FULLNAME"_saved; then
    cat "$FULLNAME"_saved >> $FULLNAME
    rm "$FULLNAME"_saved
fi

With a combination of these two features, the user will be able to jump to near the beginning of the programme and then also skip the ads during playback.  Here is what the final result looks like, with annotations.

Comskip.jpg

Thoughts and comments welcome.

IanL-S

On a non-technical level I would appreciate this as have unusually large pre and post padding (to accommodate 7Flix and 9Gem which treat advertised start times as unimportant, they can be up to 40 out, and in one case almost an hour).

Ian
IceTV: IceBox + BYOB IceBox + 2xTRF-2400 + 2xTF7100HDPVRtPlus + SKIPPA [RIP] + T2 + U4 + V2
No IceTV: a few Toppys and T2
Synology NAS
Check out the oztoppy wiki and oztoppy Forum for Toppy help

DeltaMikeCharlie

Quote from: IanL-S on June 05, 2025, 08:31:18 PM(to accommodate 7Flix and 9Gem which treat advertised start times as unimportant, they can be up to 40 out, and in one case almost an hour).

I have seen this before too, but . . . .

No disrespect to IceTV, but have you compared their actual start times to the times advertised via OTA EPG or maybe their web sites?  Could there be a lag in IceTV for last minute changes resulting in the effect that you see?

DeltaMikeCharlie

Quote from: DeltaMikeCharlie on June 05, 2025, 04:22:41 PMwrite 'scene marker' records into an 'edl' file

I have been considering altering this so that these 2 edl records are kept with the DVR entry so that they can be merged with whatever cutpoint files exist.  This would me no change fro IceTV.

IanL-S

Quote from: DeltaMikeCharlie on June 06, 2025, 07:40:31 AM
Quote from: IanL-S on June 05, 2025, 08:31:18 PM(to accommodate 7Flix and 9Gem which treat advertised start times as unimportant, they can be up to 40 out, and in one case almost an hour).

I have seen this before too, but . . . .

No disrespect to IceTV, but have you compared their actual start times to the times advertised via OTA EPG or maybe their web sites?  Could there be a lag in IceTV for last minute changes resulting in the effect that you see?

Recently on 7Filx that the run time of some programs is much shorter that the nominal run time one would expect - in one case it was 40 minutes for program with usual run time including adds of 60 minutes - program length ignoring adds is about 40 minutes. Also saw one instance on early morning SBS One HD - middle episode of 3 episodes of the same program. Not sure that that gets us anywhere.
IceTV: IceBox + BYOB IceBox + 2xTRF-2400 + 2xTF7100HDPVRtPlus + SKIPPA [RIP] + T2 + U4 + V2
No IceTV: a few Toppys and T2
Synology NAS
Check out the oztoppy wiki and oztoppy Forum for Toppy help

Daniel Hall at IceTV

This could be interesting and the changes for comskip are quick to make as we are working on a new firmware now they will be included in that.

But, I am also wondering on how useful this might be (especially the end time of the show) if it's just using the EPG data. If you could make it use the now and next data to key off that would be much better, as it would allow skipping through any unnecessary pre-padding. Right now a 3 minute jump forward will do that anyway (if using the defaults).
Regards,

Daniel.
CTO.

DeltaMikeCharlie

Quote from: Daniel Hall at IceTV on June 06, 2025, 11:05:49 AMThis could be interesting and the changes for comskip are quick to make as we are working on a new firmware now they will be included in that.

Hold off on the script part.  I am (hopefully) redesigning my solution to avoid the need for that.  I think that the comskip.ini changes could be helpful regardless.

Quote from: Daniel Hall at IceTV on June 06, 2025, 11:05:49 AMIf you could make it use the now and next data to key off that would be much better

For TVH in general, I plan to look into how the present/next data can be used to refine this in the future.  For now (phase 1), I am just looking at the EPG schedule data.  It should get fairly close.

For the IceBox in particular, being XMLTV-based, the TVH OTA grabbers are disabled and therefore no present/next data available.  Even with some sort of hybrid model, the EIT event IDs would not match so the present/next data would be ignored.

I have a vague recollection from many years ago that the Australian broadcasters were not actually using present/next correctly.  They were just echoing the schedule without adjusting to their actual broadcasts.  Things may have changed now, or I may be misremembering.

Quote from: Daniel Hall at IceTV on June 06, 2025, 11:05:49 AMwe are working on a new firmware now

Which version of TVH will you be using?  Do you monitor TVH PRs on GitHub?
  • There have been a number of recent bug fixes, particularly in the WebUI regarding FireFox issues and a freeze when trying to start a recording.
  • Someone has also recently exposed the 'is_new' flag for EPG entries.  It will be interesting to see what Kodi does with that one.
  • I've added a way to check when TVH is next due to do something.  If someone accidentally turns off their IceBox, you could make it restart for a recording.
  • I have also added some more metadata to mkv files.

Did you add the Parental Rating Label setup stuff and the episode number fix that I sent you?