Cut 1 frame before Keyframe

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
menno
Posts: 4
Joined: Mon Nov 10, 2014 12:49 pm

Cut 1 frame before Keyframe

Post by menno »

I got comskip and a join script working to my satisfaction.
There is only one thing left. When I remove the ads and stich the part*.ts files together
I witness artifcats. This is due to first frames not being I frames (keyframes).
Could comskip be programmed so that the ending of each commercial ends 1 frame before a new keyframe?

This will insure that my cuts made based upon the edl file will always start with an I frame (keyframe).
erik
Site Admin
Posts: 3368
Joined: Sun Aug 21, 2005 3:49 pm

Re: Cut 1 frame before Keyframe

Post by erik »

When you enable
output_timing=1
you get an output file "basename.timing.cvs" that lists one line per frame, last character signals I/P/B frame.
Does that help?
Otherwise I need to add something to trace the cutpointsback/forward to I frames which is a very special wish
menno
Posts: 4
Joined: Mon Nov 10, 2014 12:49 pm

Re: Cut 1 frame before Keyframe

Post by menno »

I am thinking along the lines;

1. We all want to cut commercials
Two groups:
a. Just flag them so my playback software skips them
b. Flag em to cut em and than stich em.

Cutters and stichers wouldnt like artifacts I suppose. But yes I am aware I am talking 1 sec of artifacts here. But hey when we can go for gold
why wouldnt we.

The cut at the end of any section could be any type of frame but the 1st frame of every cut piece should be an I frame to avoid artificats.
Why all this might seem pretty elaborated for most and especially for group a. I figure it would be kind of expected behaviour for group b.

Now your command will help me to identify the I frame but I am thinking why not put this logic into comskip itself.

Right now I am working around it by getting;
1. A frame number based edl file (can I switch form seconds to frames easily?)
2. Probe either the integral input file or the cut parts for I frames
3. Match the iframe closest to second 0 (start of each cut file)
4. Remove all non - I frames before that frame

So a solution could be found working around it, but then I though hey why doesnt comskip make sure that on every cut section
it auto flags the first I frame and put that in the .edl.

Now of course I understand this as implications because the primary goal here is to flag commercials here and not to have that be overruled
by a guy who thinks sometimes this should be overruled by an iframe.
Frankly I have no clue as to how many frames in a file on average are keyframes. Let's exaggerate and say 3 in 50 minutes of footage. Than of course
I understand my whole idea is bull*it. But if there are many more... why not not make the cuts cleaner....

Maybe it is some food for thought Erik. In the end this should lead to seamless joints!
For now Ill try to workaround it through some post processing scripts and probing :)
Post Reply