Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[mpeg2] GOPchop



Hey, I just wanted to thank everyone who helped me with the MPEG2-PS 
format information, and to let anyone here know about the tool I wrote 
this week:

http://outflux.net/unix/software/GOPchop/

This is a GTK+ application that uses "mepg2dec" for viewing GOPs, and will 
let you splice together sections of GOPs from an MPEG2-PS file and 
re-write them to another file.  I use it to cut commericials out of Kfir 
captures.

If anyone has use for it, please give it a try and send me some feedback.  
:)

Things I've still got to do, but I don't really know _if_ I should do 
them:

1) Change the GOP header...
Should I set the "broken link" flag on the first re-written GOP of a
section?  I tried it, and it didn't seem to change how the decoder handled
the transition.


2) Handle "dropped" frames?
In several Kfir captures, I've noticed that something happens, and the 
stream suddenly jumps forward, and the resulting file is missing a portion 
of the kfir stream once in a while.  I noticed it when a GOP (and an 
I-frame and several B/Ps were just missing, and I suddenly didn't find a 
system packet header where it should have been).

A normal sequence would be:

pack, ..., GOP, I, B, B, P, ..., B, B, P, end, pack (repeat...)

But what the file shows looked like this:

pack, ..., GOP, I, B, B, P, ..., B, B, P, end, garbage, B, P, ..., end

(the garbage appears to be the tail end of frame data...)

>From the decoder's perspective, I assume it just scans for picture 
headers, and processes them in order.  As a result, the missing I-frame 
results in the B and Ps after the unsync to be processed and produce some 
artifacts.

In GOPchop, I can do two things: throw out everything until the next good 
GOP, or just include all the B and P's into the last recognized GOP (which 
is what it does now).

I figure method two reproduces what I think a decoder would do (lost time 
due to kfir glitch+artifacts from missing I-frame), and method one would 
be free of artifacts, but produce a larger chunk of missing time (kfir 
glitch time+time lost from dropped B/Ps).  Method one also drops 
potentially valid audio data...

Any thoughts?


-- 
Kees Cook                                            @outflux.net



Home | Main Index | Thread Index