silence.preset settings for short commercial breaks

Have a MythTV related problem? Ask for help from other MythTV users here.

Moderator: Forum Moderators

Post Reply
halucigenia
Senior
Posts: 114
Joined: Tue Nov 11, 2014 11:03 am
Great Britain

silence.preset settings for short commercial breaks

Post by halucigenia » Sat Apr 27, 2019 7:27 am

I have been using slilence.py for some time now but it often has trouble finding the commercials in late night shows that tend to have shorter commercial breaks than during the day/evening on the same channel e.g. the Paramount channel the commercials on late night shows can be less than 50s and evening shows can be up to 160s or more.
It's more of a hassle to manually find short commercials as they are harder to find but that's what I have been having to do on many recordings.

I have been using the preset file for the UK channels and can set a preset up for the channels in question but I am having a hard time figuring out just what the values represent and which ones should be changed for a desired result.
for example the preset file has the following preset

Code: Select all

# title/callsign, threshold, minquiet, mindetect, minbreak, maxsep, padding
# defaults          -75,       0.16,       6,       120,     120,    0.48,

channel 4 news,        ,       1.00,       1,        55,        ,       0, short advert, many silences
seeing it was for "short advert" I have tried those settings for the Paramount channel but it did not help.
I have tried changing various values but just feel that I am stabbing in the dark.
Any assistance would be greatly appreciated.

halucigenia
Senior
Posts: 114
Joined: Tue Nov 11, 2014 11:03 am
Great Britain

Re: silence.preset settings for short commercial breaks

Post by halucigenia » Sat Apr 27, 2019 11:20 am

Concentrating on what the wiki https://www.mythtv.org/wiki/Commercial_ ... h_silences states
Algorithm
An advert is defined as a cluster of silences, at least <minbreak> long, that is composed of at least <mindetect> silences that occur within <maxsep> of each other.

In practice, silences are detected as a consecutive series of frames having an average audio power below <threshold> for at least <minquiet>. If the interval between a silence and the previous one is less than <maxsep> then they belong to the same cluster; otherwise they lie in different clusters. Clusters that are shorter than <minbreak> or composed of less than <mindetect> silences are ignored. Adverts are shortened by <padding> on both sides.
and looking at what the commercial breaks consist of - on the Paramount channel late at night they tend to be short overall breaks but consisting of longish promos for series (which, confusingly for manual editing, can be for the same show that is airing) or upcoming movies, rather than short commercials, has helped me figure out what I might try.
For longish individual advert/promo (during late night shows) and a short overall commercial break with 2 noticeable silences start and end of break so minidetect set to 2, short overall break so minibreak set to 40, longish silences so miniquiet set to .25

Code: Select all

# title/callsign, threshold, minquiet, mindetect, minbreak, maxsep, padding 
paramount,             ,       0.25,       2,        40,     ,       0, 
This seems to work but I am still not quite sure if I have understood how the values for the parameters work?

User avatar
dizygotheca
Developer
Posts: 267
Joined: Wed Sep 03, 2014 9:02 am
Great Britain

Re: silence.preset settings for short commercial breaks

Post by dizygotheca » Mon Apr 29, 2019 12:59 am

Looks like you have the right idea.

Many short clips is the best identifier of an advert. It's hard to identify a single promo without producing lots of false positives as well.

Running silence.py manually on some samples with --loglevel=debug --preset=",0.25,2,40" should help you discover the optimum values.
Try pushing the threshold down and the minquiet up to reduce any false adverts.

That channel characteristics can change throughout the day is a good point though.
Maybe you could use presets based on show name rather than channel name.

Post Reply