[FFmpeg-user] How to detect commercials in recorded TV stream?
Peter White
peter.white at posteo.net
Sat Mar 27 13:39:00 EET 2021
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.
>
> To remove the commercials I have written a video editing program with which I
> can scan through a video and put markers for sections to keep, then finally use
> these markers to have ffmpeg extract the "good" sections into a final
> commercial-free video to watch.
>
> But even though I have speed buttons to jump around in the video while finding
> the start and end positions of the commercials it gets tedious to do manually...
>
> So I wonder if there is any function in ffmpeg I can use to extract scene change
> points which I can then use when setting the cut points?
One thing that springs to mind is skipping non-key frames. Since modern
codecs put keyframes where they detect a scene change, the odds are good
that there will be a keyframe at the start and end of commercials. Of
course there will be a lot more keyframes for the normal scene changes
in the content you do want, but skipping through those should be quicker
than skipping by a fixed amount of time.
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.
Cheers,
Peter
More information about the ffmpeg-user
mailing list