Comskip specifications

Here you can ask your questions on how to use Comskip for the detection of commercials. Also questions on how to remove commercials are welcome
Post Reply
edro
Posts: 2
Joined: Thu Jul 27, 2023 9:43 pm

Comskip specifications

Post by edro »

Hi! I'm an old (>65 years old) UNIX 'C' Language programmer from the early 1980's. After cancer/chemo/transplant -- my mind is too foggy to do any programming these days. So I know some things (still using 'vi' visual editor okay) and other things ('C' language, all other languages) -- those things are gone.

Now I'm interested in donating in order to use Comskip but I have some questions.

My programming skills are dismal limited to simple bash shell scripts. Trying to understand ffmpeg is daunting. I muddle through these things the best that I can. I'm embarrassed to have anyone look at my code. It's that bad.

I found out how to identify commercials from some online searches. Using this ffmpeg command:

Code: Select all

ffmpeg -ss 20:45 -t 13 -i "INPUT.mp4" -map 0 -c copy -c:v libx264 -b:v 2400K -vf drawbox=x=740:y=962:w=416:h=44:c=red:t=1 "OUTPUT.mp4"
yields these results:

Code: Select all

  Chapter #0:0: start 0.000000, end 10.382000
    Metadata:
      title           : Advertisement
    Chapter #0:1: start 10.382000, end 356.143000
    Metadata:
      title           : Video
    Chapter #0:2: start 356.143000, end 465.896000
    Metadata:
      title           : Advertisement
    Chapter #0:3: start 465.896000, end 885.507000
    Metadata:
      title           : Video
    Chapter #0:4: start 885.507000, end 965.477000
    Metadata:
      title           : Advertisement
    Chapter #0:5: start 965.477000, end 1648.772000
    Metadata:
      title           : Video
    Chapter #0:6: start 1648.772000, end 1736.859000
    Metadata:
      title           : Advertisement
    Chapter #0:7: start 1736.859000, end 2519.980000
    Metadata:
      title           : Video
    Chapter #0:8: start 2519.980000, end 2552.074000
    Metadata:
I can verify that these results are accurate for the video source.

What I would like to have is a script that takes these results and concatenates all the "title : Video" into a single .mp4 file, retaining the embeded subtitles if they exist and adjusting the subs timecode to reflect the new position of the video segments.

So far I'm able to extract the subtitles embeded in the mp4 container/stream to a separate .srt file. That makes it easier to edit the subs if I want to. Thus many of my .mp4 files no longer have the embeded subs but an associate .srt file for the video. But there are still ads in the .mp4 file...

So the script would need to be able to retain the embeded subs in the /mp4 container/stream OR use a separate .srt file so that when advertisements are "cut", the subs line up with the video.

Can Comskip do anything like this or do I have the usage of Comskip all wrong? If Comskip will do this then sign me up, and if not then would anyone know how to help me?

Thank you!
Edro
erik
Site Admin
Posts: 3369
Joined: Sun Aug 21, 2005 3:49 pm

Re: Comskip specifications

Post by erik »

The only thing comskip can do is output a file in various formats with a list of where it thinks the commercials are
Typical the output file of comskip is used by a video player that uses it to skip over the commercials.
edro
Posts: 2
Joined: Thu Jul 27, 2023 9:43 pm

Re: Comskip specifications

Post by edro »

Thanks. Guess I'll have to study up on ffmpeg.
Post Reply