vobcut v1.0, (c) by Bernhard Oemer <oemer@tph.tuwien.ac.at>, 2009-2011

analyse and cut mpeg2 program streams without decoding and 
demultiplexing.

  http://tph.tuwien.ac.at/~oemer/vobcut.html
 
features:

- locates the starts of mpeg2 sequences and their
  associated audio packages in an mpeg2 program stream.

- command line interface, run vobcut -h for details.

- identifies and makes it easy to extract and concatenate
  homgenous chunks which share the same format.

- hard format features include:

  * mpeg video format (esp. switches between 4:3 and 16:9)
    by decoding mpeg SEQ, GOP and 
  * mpeg audio format (usually remains constant for a channel)

- soft format features include:

  * letterbox (i.e. black bars to widen the aspect ratio)
    by comparing the encoded size of the outer scanlines to
    the inner scanlines. except for finding the slice header,
    no decoding takes place.
  * stereo encoded mono (mp2 audio only) by partially
    decoding the mp2 stream and comparing the spectra of
    left and right channel.

  reliability depends on content and also varies considerably 
  between channels, so the heuristics can require tuning or
  might even fail. Generally, when in doubt (e.g. dark scenes, 
  silence) the sequence gets classified als lbox or stmono.

- rewriting of CSR, PTS, DTS and ESCR timestamps to avoid
  discontinuities and clicks when cutting out scenes

- trimming of incomplete audio packed to avoid clicks by
  invalidating the header prefix, so players ignore them.
  (while this violates the standard, it works just fine)

- supports caching of block information to speed up subsequent 
  calls on the same file

- small, fast and standalone (no external decoders, etc.)

- uses only standard includes and standard c++ libraires

installation:

g++ -O2 vobcut.cc -o /usr/local/bin/vobcut -lm

limitations:

I have written the program to cut PAL DVB-S program streams from
my sat receiver after having ruined some recordings with a
graphical video editing program (loss of A/V-sync). While it might 
work with other mpeg2 PSs, this is not tested.

The philosophy of vobcut is to change as little as possible from the
original stream and avoid repacking, so no errors are repaired and
concatenations lead to incomplete audio packets as - other than the
start of sequences - audio packets are not pack-aligned.

vobcut only deals with the first mpeg2 video (0xe0) and audio (0xc0)
stream and expects those to be present.

letterbox detection assumes that slices are top down, 16-pixel wide 
and cover the full width, which this is not required by the standard. 
It also assumes that the black bands compress significantly better 
than the rest, which is not always the case.

audio has to mpeg audio, non-mpeg audio in private streams is not
supported. stereo encoded mono detection only works with mp2.

lbox and stmono detection produce lots of false positives so they are 
really only useful if you want to extract (as opposed to cutting away)
letterboxed or mono content.

the default scanning strategy which consists of many short scans with
long gaps in between which only get read when necessary might not only
overlook scenes but can in fact take longer than a complete scan (option
-e). This happens esp. when doing lbox/stmono detection is active on
content that is mostly full-screen/stereo.

vobscan:

Vobscan is a quick and dirty bash script to create an two-level html-index of
mpeg2 file using mplayer (www.mplayerhq.hu).

The screenshots contain the time offset as alt-text in the form of the vobcut 
option "-f&lt;secs&gt;" which can be cut-and-pasted into the commandline.
The script needs to be run in the directory containing the mpeg2-files, 
expectes the directory ".vobscan" to be present and takes the name of the 
files to be index as aruments.
Files with existing indices are skipped, so it's safe to run "vobsscan *.vob"
in your VCR directory from time to time.

licence:
  
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  

See http://www.gnu.org/licenses/gpl-3.0.txt for mor details.
