[FFmpeg-user] How to detect commercials in recorded TV stream?

Rob Hallam ffmpeg at roberthallam.com
Sat Mar 27 14:35:18 EET 2021


On Sat, 27 Mar 2021 at 11:39, Peter White <peter.white at posteo.net> wrote:
>
> On Sat, Mar 27, 2021 at 08:15:23AM +0100, Bo Berglund wrote:
> > I am using ffmpeg in scripts to download from a live stream TV channel nightly
> > so I can view the shows in the morning.
>
> I also seem to remember that there are some filters that can detect the
> start of commercials, by leveraging the logo of the station which
> usually is not shown during those breaks. But I have no idea if such
> filters exist for ffmpeg.

Another observation which used to hold true- commercials used to be louder
on average than the main programme, at least in the anglosphere. Perhaps the
list of keyframe candidates to skip between could be narrowed down based on
audio, or a sudden change in audio level.

If you know the rough time interval on which commercials occur, eg
around 15 / 20
minutes, that could also filter out keyframe candidates.

However, as Peter says, it would be worth tracking down other projects that
do advert break detection before coming up with your own heuristics as the
work may already have been done for you!

Cheers,
Rob


More information about the ffmpeg-user mailing list