
	Mpg2Cut2 - http://www.geocities.com/rocketjet4/




MPG2CUT2 - FAULT TOLERANT, GOP LEVEL, BINARY CUTTER 
         - FOR MPEG-2 PROGRAMS STREAMS 
         - ESPECIALLY WITH DIGITAL TELEVISION (DTV) CAPTURES





         *** DEVELOPMENT VERSION ***

         *** USE AT YOUR OWN RISK ***

         Remember to do a virus check


--------------------------------------------------------------------



APPLICATION DESCRIPTION
=======================

Mpg2Cut2 - Enhancement of Mpeg2Cut v 1.6 - based on DVD2AVI

Copies selected portions of an MPEG-2 Program Stream.

Only supports Mpeg-2 - NOT Mpeg-1 nor Mpeg-4.

If you have a transport stream, 
then convert it to a Program Stream using PVAStrumento.

Ability to correct a small range of errors in the program stream,
such as missing headers or incorrect aspect ratio.

User tailorable reminder messages.



USAGE
=====

The basic approach is to mark the "FROM" and "TO" points 
of the clip that you want to keep, 
and then save that selection to a new file.  

Repeat this for each clip that you want.

If you are working with Digital Television files,
run each of the saved clips through a correction program,
such as ProjectX or PVAStrumento.

Drag and Drop the resulting clips into your DVD Authoring package.
This way each clip becomes a separate scene, 
with it's own thumbnail on the DVD menu.

(Your DVD Authoring package may be different to this.)



ALTERNATE APPROACH
------------------

If you are NOT planning on using the clips as individual DVD scenes,
you can perform multiple clip selections before saving them ALL together
as a SINGLE output file.

BUT, at this stage the joining of clips is very crude,
so this approach MAY NOT work in your environment.
Some players do not like the rough joins.

See notes below regarding Multi-Clip output.


-----------------------------------------------------------------

FEATURES
--------

Detects and attempts to fix missing Pack and System headers
when creating the output file.


Does *NOT* support MPEG-1 format.  NOR Transport Streams.
You MAY be able to view these unsupported formats,
you MAY be able to save a single selection cut,
but DO NOT assume that unsupported formats will be usable.


There is NO decryption capability,
it will only work on non-encrypted files.
So if you are trying to use it on a commercial DVD,
and just get rubbish out, don't be surprised.

This is NOT a converter.
Although there are some adjustments to control information,
the actual Mpeg data itself is just grabbed directly from the input.
Naming a file as a VOB will NOT convert it a a DVD compatible file.
Use other utilities like "PVASTRUMENTO" or "PROJECT X" for that.

There IS an option to output as Demuxed Elementary Streams,
but it is still essentially the same underlying Mpeg codec,
only the container has changed, there is no recompression.


------------------------------------------

Mpg2Cut2 is essentially a GOP level editor.

A GOP is a "Group Of Pictures", which is usually around 13 frames,
lasting around half a second when played.  This is an important
part of the way MPEG compression works.

Selection is made at the GOP level,
so accuracy is typically limited to about half a second of time,
in the typical situation of "SEQ/GOP/KEY-FRAME/DELTA-FRAMES".

The program does NOT check for "Open GOPs",
so you can get spoilage of the first and last GOP in a selection.
The impact of this can be minimized by enabling the menu option:
                 "Include TO frame"
which will extend the clip to include the terminating Key frame.
HOWEVER, this decreases compatibility with set-top DVD players.

The program has only LIMITED support for compensating audio delay 
relative to the video stream, and is a controlled via
Menu Output options:
            - "PARSING ENABLED" 
            - "AUDIO MATCHING"
You need both these options on for audio adjustment to take place.

As this feature is experimental, 
I suggest you leave some extra fat 
at the start and end of your edit selection, 
to avoid losing some audio.

The Audio delay, which is shown in milliseconds (ms), 
typically will be of the order of 200ms, 
but over 1 second is common,
especially on High Definition files.

So add AT LEAST one GOP at the end of the clip selection.
For safety, , especially on HD streams, add 3 GOPs.

Also remember that change of scene is NOT likely to coincide with a GOP 
boundary, so you should also add a padding GOP at the start of the clip.
I.E. Start the selection BEFORE the scene change.

These are rules of thumb - adjust based on your own experience

--------------------------------------------------------------------



**** CURRENT KNOWN PROBLEMS :-

*1:  Joins are very rough, when saving multiple clips into a single file.

    However, smoother joins are more likely with files encoded with 
    Closed GOPs and with Sequence Headers aligned to Packets.

    To allow for the possibility of rough joins,
    I STRONGLY suggest adding an extra GOP
    at the start and end of each clip. 

    Options are available to make the join smoother.
    (See "Output Controls" below).
   
    Audio sync problems after joins, on some players.
    Try using the experimental Parsing option: "Match Audio".

    Multiple selection ranges basically works, at least in MY environment.
    It MAY NOT be acceptable to YOUR system.
    If you have problems with the output, pass it through a clean-up
    utility such as PVAStrumento or ProjectX.
    
    Those clean-up utilities adjust Mpeg files into a format required for
    DVD standard VOB files, or convert to elementary streams for input to
    DVD authoring software.

    If this doesn't fix problems arising from multiple selections,
    then save each selection to a SEPARATE file, 
    and use a different utility to perform the joins. 

    As mentioned above, in some DVD Authoring packages,
    you may find the the easiest way to create chapters,
    is to save each clip SEPARATELY.
    This way each clip becomes a separate chapter.





LESSER ISSUES:

  - Multiple input files - not fully tested.
    It is quite usable if you are not too fussy.

  - Preview function is a bit rough.

    Mpg2Cut2 is not intended to be used as a player.
    No attempt is made to provide audio lip-sync during preview.
       (Maybe one day though....)
      
    Also the preview of Private Stream 2 Audio is terribly unreliable.
    All I am doing is chucking the raw data at the audio interface.
    The fact that ANY PS2 sound sometimes comes out during preview 
    is just fortuitious.

  - Forward single frame does not show B frames in sequence.
    Sometimes gives bad pictures.
    (One day I may look into this.)

  - "BACK" command sometimes stops.
    In this situation, either use the key combination Shift+Back,
    or use the Scrollbar to scroll back.
    This problem has been reduced, but may still occur.

  - "BACK" command sometimes skips an extra GOP.
    Trade-off against the problem, still working on this.


------------------------------------------------------------------

MINIMUM REQUIREMENTS
====================

Windows 98 SE or later

	Win98SE is what I am running on. 
      Win2K - seems to run OK (maybe faster ?).

	I expect it would work on other modern versions of Windows...


Celeron or better CPU

	Editing:
		The basic editing function does not use much CPU,
		so you could get away with using a very basic machine.

		I use a P-III 800 Mhz and this is plenty fast enough
            for editing Standard Definition files. 

            For High Definition, 800 Mhz is OK for editing, 
            but maybe a little slow.


	Previewing:
		The preview function chews up a lot more CPU than editing does.

            600Mhz P3 would probably be minimum for previewing a 
            Standard Definition (SD) file without dropping frames.

            If you are using a slower machine,
            consider turning off adjustment of Luminance and Audio.

            For smooth High Definition preview, probably need at least 
            2 Ghz even for a moderate bit rate HD file. 
            But for the seriously high bit rates that some countries have, 
            probably need more than 3Ghz.

            HD Preview will run OK on more humble machines,
            but the display will be jerky due to skipping frames.


	Slow Machines:

            Turn on the Menu-Preview option "Skip Frames If Behind", 
            which allows HD preview on a much more humble machine,
            albeit with somewhat jerky video.

            For HD preview on Pentium II or earlier CPU, 
            try turning on ALL the Drop options,
            to get more aggresive performance.
            See below for more info.


      NOTE - Frame dropping does NOT impact the output file.
             It only controls the preview display.

      There is NO special exploitation for other CPUs (eg 3dNow).


------------------------------------------------------------------------

CONTROLS
========

The keyboard is the most fastest, most flexible way to navigate,
using the cursor arrow keys.

But if you prefer to use the mouse, then you can
navigate along the time line using either the slider
or the toolbar buttons. 

TOOLBAR BUTTONS :-

B = BMP Snapshot of current frame.
+ = Add selection to Clip List
L = Luminance Adjust
Z = Zoom

 [ = Mark "IN" point (START of clip)
<< = Jump Back 
 < = Move back 1 GOP
>> = Jump Forward 
 ? = Move forward 1 GOP
 ] = Mark "OUT" point (END of clip)



KEYBOARD COMMANDS :-

To allow for people with different habits,
there are 2 different configurations for keyboard commands:

   1) Classic Mpeg2Cut

   2) VirtualDub compatible (well... sorta)

         Not quite, because VDub has frame level navigation,
         while Mpg2cut2 is GOP oriented.



    Arrow keys navigate along time line

	ACTION               CLASSIC       VIRTUALDUB

	Forward one GOP       UP            RIGHT
	Back    one GOP       DOWN          LEFT 
	Back a lot            LEFT          UP
	Forward a lot         RIGHT         DOWN
	Next File Start       Ctrl RIGHT
	Previous File Start   Ctrl LEFT	

	SHIFT - Magnifies each of the above keys

	Forward 1 Frame        /     (NB. NO MARKING in the middle of a GOP)

	GO TO Clip#        0..9

	Mark "IN"             [             Shift [
	Mark "OUT"            ]             Shift ]
	Go to "IN"        Shift [           [
	Go to "OUT"       Shift ]           ]
	ADD clip         +


	Open file         F3 Ctrl-O
	Append file       alt-O       
	Append Like       alt-L       
	Save clips        F4 Ctrl-S
	Save This clip    Ctrl_T
	Play              F5 P
      Preview SELECTION F8
      Preview END Sel   ALT-F8 (Plays last 3 seconds of current selection.)
      Preview ALL Clips SHIFT-F8
	Pause Play        Space
	Stop Play         ESC

	Snapshot          B or Shift-B   (result dependant on option setting)

      Toggle Toolbar    F11

	L = Luminance Boost 
      M = Mute
      K = Karaoke

----------------------------------------------------------------

MULTIPLE INPUT FILES.

   Reinstated the ability to concatenate multiple input files.
	   Menu - File - Append. 
   Multiple files can be selected during File Open or Append,
   but be patient as it takes time to open a number of files.

   NOTE
   ====
   This is a primitive binary join,
   with NO analysis of the Mpeg attributes.
   It is up to you to ENSURE that the files are COMPATIBLE.
   Otherwise, expect strange results.

   EG Does *NOT* detect:-
       - Broken GOP at join boundary (maybe fix in a future release)
       - Different bitrates
       - Different Height or Width
       - Different chroma sub-sampling.
         HEALTH WARNING: - Mixing 4:2:0 with 4:2:2 may trigger Epilepsy,
                           due to psychedlic flashing patterns.

   *** ESPECIALLY do *NOT* intermix ELEMENTARY streams with PROGRAM streams!

   You can choose to sort the file list by :-
             -  File Name,
             -  File Creation Date,
       *OR*  -  Mpeg Time Stamp (System Clock Reference - SCR).

   Each approach has it benefits and limitations.
   Mpeg Time Stamp is good when joining segments created on the same day,
   but may have been edited on different days.

   Otherwise, File Creation Date would probably be better.


   Do any sorting *BEFORE* you start selecting edit points, 
   because the Edit Decision List is *NOT* updated after the sort.
                (May fix this in a later release.)

   For files split with HJSPLIT, or similar non-mpeg utility,
   Use "Sort by NAME" in this case.
   Do *NOT* sort by Time Stamp, 
   as the segments may not be split on exact MPEG PACK boundaries.  

   Multiple input files are treated as if they were one big file.
   But to help navigate, keyboard commands allow skip to next/prev file.
   Also, a beep will sound whenever a file boundary is reached.

   Files can be appended either through the File Menu,
   or using Drag-And-Drop from Windows Explorer.  

   By default the program will ask whether dropped files are to appended
   to those already opened.  This pop-up can be controlled via :-
   MENU - Misc - PopUps - Dropped Files.


-------------------------------------------------------


MULTI-CLIP selection (NEW FEATURE IN VERSION 2)
====================

You can select multiple clips to be written to a single output file,
but the resulting file is LESS COMPATIBLE with other software.

Select one clip at a time to be included in the output.

IE - MARK the "FROM" point, 
     MARK the "TO"   point,
     ADD the selection to the list using the  + symbol.

As mentioned above, leave some extra fat 
at the start and end of your edit selection,
to protect against open Gops and audio offsets, etc.

If you just change you mind about the "FROM" or "TO" position,
of the most recently added clip,
then just MARK the new point and do another ADD.
It will recognize that the other is the same,
and optionally ask you if you want to replace the previous selection.

To REMOVE the last clip added,
use MENU - EDIT - REMOVE CLIP.

The ADD action can be automated,
so that as soon as you mark the "OUT" point,
it will add the clip to the list.

An intermediate level of automation is "REMIND",
where it will remind you if you forget to manually add a clip.

At the end - REMEMBER TO *SAVE* THE CLIPS:
 
    MENU - FILE - SAVE ALL   (or press F4).
     
Mpeg "Sequence End" codes can be added at the end of each clip,
if this menu option has been enabled.

Some players may pause at joins - try hitting PLAY.
If this becomes a headache, or you have other player problems,
then you can try using "PVAStrumento" or ProjectX to reset time stamps.


The Edit Decision list can be saved and later reloaded.
The EDL includes both the list of input FILES and the
list of selected CLIPS.

At this stage the EDL Save and Load options are very primitive.



----------------------------------------------------------------------


EXPLANATION OF PROGRAM MESSAGES

===============================
 
MESSAGE: "MISSING FIRST %s header on input file
          Input file starts PART WAY THROUGH GOP/SEQ.
          SKIP TO BETTER START POINT ?"

   Common with DTV capture files. 

   OK - Positions to the first "clean" start point :-
        MPG - Sequence header Pack
        VOB - PrivateStream2 NAV Pack

   CANCEL - Accepts messy start of file ASIS,
            and temporarily turns off VOB Preservation.

   If you are editing a SEQUENCE of files that are actually
   a single stream, then ONLY click "OK" on the FIRST one.

   Best approach for editing split files is to use the "File-Append" command
   to concatenate fragments in a single edit session,
   to avoid losing frames from GOPs that have been split across files.  

   For ease of finding files when you have a lot in the same folder,
   use "File-Append-Like", which restricts the File display
   to those with a similar prefix. (Not supported on DBCS)





MESSAGE: "Need VOB NAV PACK" and no picture is showing.

   Maybe your VOB file is NOT TRULY a DVD VOB file ?

   If this happens on a lot of files, 
   TURN OFF the Output option "VOB preservation",
   to stop it looking for VOB Navigation Packs.




MESSAGE: "DISK PROBLEM" 

   The length of time taken for the system to deliver data from the input
   file was suspiciously long.

   Could be any of the following causes :- 

   1) Drive had powered down since last used.  Not much to worry about.
   2) Other tasks are slowing performance.     Not much to worry about.
   3) The disk may need Defragmenting.
   4) Hard Drive may be failing, causing poor I/O performance thru retries.
                                               Be afraid - be very afraid.


MESSAGE: "NON-MPEG2 FORMAT DATA"

If you try to use the program on an UNSUPPORTED file type,
such as Mpeg-1 or a Transport Stream,
it will likely crash at some stage, maybe lock up your system,
and even if it does not crash, any saved files will probably be rubbish.

But if you are lucky, you MIGHT be able to see part of the picture.

If you insist on using it, NOTE THESE MAJOR LIMITATIONS:
- Single selection ONLY. NOT multiple clips.
- Cutting is binary mode ONLY. NO output parsing.
- MONO audio will not decode properly (pre-existing bug).



---------------------------------------------------------------------

OUTPUT CONTROLS
===============


VOB Preservation.
-----------------

   This feature is still primitive, as it needs a LOT more work !

   The menu option VOB Chunks allows Mpg2Cut2 to do special processing when
   handling files with the name extension ".VOB".

   VOBs are a specially styled form of MPEG file.
   They should conform to a number of extra restrictions :-

   Private Stream 2 NAV pack entries at frequent intervals.
   The program will lock to these points when navigating,
   effectively looking past intervening Key-Frames between PS2 entries.

   2k boundary required on VOB Mpeg Pack. 

   At this stage of development, this option will pad the data at specific
   points, but this is not very thorough.  

   It pads out any EXTRA packs arising when control headers are created,
   and will retain existing pack sizes in the audio PTS matching area. 

   Turning on this option may allow some testing of interoperability.

   *WARNING*
          This option should ONLY be turned on for a FINAL compilation VOB.
          NOT for intermediate edits.
          IT IS *NOT* TRUE DVD CONFORMANCE
          only a help along the way.

   For proper DVD conformance, use "PVAStrumento" by Offeryn
   or the open-source "ProjectX" to reblock *ALL* the Mpeg packs to 2k.





Include TO frame  (previously known as Pad OUT Position).
----------------

   Minimizes the impact of picture break-up at the end of a clip,
   by adding an extra key-frame at the end of the selection.

   If you don't like manually adding an extra GOP at the end of the clip,
   then this is a compromise position that MAY be of use. 

   May also be useful for "I-frame only" files, 
   which some capture cards produce.

   If Output Parsing is enabled, then it can also add
   some succeeding 'b' frames with appropriate Presentation Time Stamps 
   as might be found in "Open GOP" files, which are common.

   The main drawback is that it creates a GOP with only a single frame.
   This is not an illegal structure in itelf, 
   but some players may cough up at the join, 
   because of the bitrate hit, 
   which is likely to be non-conforming.

   Also it can dilute the effect of the AUDIO PTS Matching function.

   If Timestamps are not present and DIFFERENT on EVERY frame, 
   then "TO" frame padding should NOT be combined with Audio PTS matching.
   This is because some Mpeg encoders only update the PTS info at GOP
   boundaries, thus making partial GOP functions very haphazrd.

   "Include TO Frame" is NOT recommended when trying to preserve VOB format,
   NOR if Audio PTS matching is desired.





PARSING OPTIONS.
----------------

    Work is underway to make the joins smoother,
    by parsing (analysing) the underlying Packet headers,
    but this is not yet complete, nor widely tested.

    The amount of parsing requested can dramatically impact output speed.
    With parsing turned off, only the headers at the start of the file 
    will be corrected. 
 
    If you are not sure whether your Mpeg streams are Aligned,
    then activate Deep Parsing.  The output summary will show
    if the Deep Parsing is unnecessary.  If you find this message
    always comes up, then you can probably turn off Deep parsing.

   
   Audio Matching - Compares the Video and Audio Presentation Time Stamps
                    to trim excess audio from the start of each clip,
                    and include trailing audio at end of clip.
                    This is instead of doing a basic binary cut.
                    Insignificant overhead.
   
   Parse All Packets - The program will analyse the headers of every packet,
                       not just the start and end of the clip.
                       This intermediate setting is somewhat slow,
                       but is a good compromise when working with Aligned
                       streams, which are common in some countries.

   Deep Parse - The program will look for headers THROUGHOUT every packet,
                rather than just the start of each packet.
                This is significantly slower, 
                as every video byte is examined,
                but the process is more thorough.

   Adjust Time Stamps - Still under development - NOT READY YET.
                        The eventual aim is to smooth joins by adjusting
                        internal Mpeg Time Stamps at each join.
   
   Align Video End Packets - *NOT FULLY IMPLEMENTED YET*
                    Pads the last Video packet of each clip
                    in case the last pic encroaches onto the next packet.

                    *PLANNED: In future, may extend this to Start packets,
                    to ensure alignment of Mpeg SEQ/GOP/PIC Header 
                    to packet boundary. Maybe.

                    Intended for streams where sequences are not aligned
                    to a pack boundary.
                    Only boundary packs are corrected, 
                    NOT the entire file.

   Align Audio End Packets - *NOT FULLY IMPLEMENTED YET*
                    Adjusts the first Mpeg Audio packet of each clip
                    to ensure alignment to a syncword.

                    Intended for streams where Audio frames are not aligned
                    to a pack boundary.
                    Only boundary packs are corrected, 
                    NOT the entire file.

                    *ONLY TESTED ON MPEG LAYER 2*
                    *NO EFFECT ON NON-MPEG AUDIO*



SEQUENCE HEADER CORRECTION
--------------------------

There are 2 types of video sequence header correction :-
        a) BitRate specification
        b) Aspect Ratio code.

The details of these 2 options are discuessed below.

NOTE:-  To correct ALL headers,
        you *MUST* also enable BOTH :-
             - "PARSING" 
        AND use one of the following :- 
             - "DEEP PARSE"  (If you are not sure about alignment)
          OR - "PARSE ALL PACKETS" (If you know video packets are aligned)

       OTHERWISE it will only fix some of the headers.


Limit SD Headers
----------------

Can be used to patch the bitrate headers at the start of each clip.

For files with a canvas wide within Standard Definition limits,
the bit rate in the headers at the start of the output file
will be check, and kept within the SD limit.

This is useful with Nebula DTV capture cards, 
where the rate field contains the TS rate rather than the PS rate.

This function will also fix missing bitrate info in pack headers,
by inserting the same arbitrary value used when limiting.


ASPECT RATIO (in VIEW menu)
---------------------------

Some Mpeg Streams contain the WRONG apsect ratio sepcification.
If you override tge Aspect Ratio in the VIEW menu,
then you will also be asked if you want to force the output
to match the new Aspect Ratio that you have chosen.



PREAMBLE.
--------

   Can copy control info from the start of the input file.
   This is very crude, but may help some people, sometimes.
   Previous version did not copy control info from start of file.

   PREAMBLE = SMALL  (RECOMMENDED)

      Good for NEBULA DigiTV files to remove crud from start of file,
      thus improving compatibility with other utilites such as TMPGENC.   

   PREAMBLE = MAXIMUM

      This is a more conservative setting that allows for files
      with complex control information at the start.
      Try it if you have trouble editing VOB files.
      Personally, I no longer use this setting.

   PREAMBLE = NONE
      This is the old approach used in version 1 of MPEG2CUT,
      except that the System Header is slightly more general.
      Retained for those who may still want it,
      but has been moved into the "obsolete" preferences sub-menu.

  

Seq End codes - HIGHLY EXPERIMENTAL.

   At the end of each clip, this inserts an MPEG SEQUENCE END code (B7) 
   to indicate the end of a video sequence.  
   This may aid some players, at very little overhead.




DEFAULT OUTPUT FOLDER 

  Allows you to set the current output folder as the future default
  to be displayed when an output file is to be created. 

  For Windows 98 users, the facility is more sophisticated still :-
  The INPUT folder name is still provided in the filename,
  to allow easy override of the default folder.

  Windows 2000 does not seem to be quite as flexible, 
  so use the menu to toggle the function on or off *BEFORE* the save.
  


DEFAULT EXTENSION

This control the 3 letter file type on the end of the file name.

For use with Premier Pro, you will want the default to be MPG.





TIDY NAME
  NO BLANKS = Change imbedded spaces in file name to underline "_"
              Allows for utlities that cannot tolerate imbedded spaces.
              EG  ALL GOOD THINGS.mpg  becomes ALL_GOOD_THINGS.mpg

  MIXED CASE = Converts file name to mixed case,
               based on word separation.
              EG  ALL_GOOD_THINGS.mpg  becomes All_Good_Things.mpg

NOTE: The Tidy Name function occurs at when files are loaded,
      so when first turned on, it will begin form the NEXT file opened.


UNMUX
-----

The selected clips will be demuxed into Elementary Streams,
rather than copied as a Program Stream.

Some authoring tools use Elementary Streams as input.

*NOT* recommended for DTV files,
since they need PVAStrumento or ProjectX 
to replace missing data and fix time stamps.

Only the Video, Audio and Subtitle streams are demuxed.
Any other streams are skipped.

Q. Why did I call it UNmux rather than DEmux ?
A. To avoid confusion in keyboard shortcuts.
   D=DELETE  U=UNMUX



POST-PROCESS
------------

Allows you to automatically run another program whenever an output file
is saved.  The name of the output file is passed as a parameter.
You can specify whether the file name needs to be in quotes,
to allow for names with imbedded spaces.

As well as entering the FULL NAME and PATH of the program to be executed,
you should also tick the ENABLE box.  

The Path to the program can be omitted if it resides in the system path.


-------------------------------------------------------------------------


VIEW OPTIONS
============

View options do NOT impact the output Mpeg file.
Some settings may impact BMP snapshots, where noted.



LUMINANCE CONTROLS
------------------

If the image is too dark on your monitor,
you can boost the display using this facility.

This does NOT impact the output MPEG file,
but can optionally be applied to BMP snapshots as well.
The choice is yours.

GAMMA - Increases brightness and contrast in dark areas.
        This is the main difference between TV and PC systems.
        Adjust this first.  130 is a common starting point,
        but different systems will need different values.
        

CONTRAST - Same as an analogue TV contrast control.

BRIGHTNESS - ditto.

LOCK - Automatically adjust contrast and brightness together.

BMP - The changes will also be applied to BMP snapshots.
      Be careful, as some video cards (like mine) 
      have DIFFERENCES in the Gamma settings
      between Overlay and BMP (DIB-RGB) interfaces.

NOTE:- PLAY/PREVIEW SPEED PERFORMANCE HIT
       The new version with GAMMA control has a slight performance impact,
       when using "Preview" or "Play".



ASPECT RATIO
------------ 

The display will use the aspect ratio specified in the MPEG file.
This is needed for most Mpeg files, as they are compressed more
in one direction than the other.

Overlay (YUV) gives the best results, as the system does the work.

In RGB mode, aspect ratio conversion is quick and dirty,
so a non-overlay image can look a bit rough.

If the View Aspect Ratio is NOT set to "Standard",
then when saving the output you will be asked if you want to 
force the bew file to the new Aspect Ratio.


DE-INTERLACE
------------

De-interlace option is useful on non-cine material,
or traditional NTSC telecine (29.97fps),
and also for poor PAL telecine.

But for standard PAL telecine, it should not be needed.

Sadly some PAL material contains both PAL and NTSC interlacing,
due to very poor conversion.  I cannot remove double interlacing.


ZOOM
----

If the picture is wider than the screen,
you can ZOOM OUT to see the whole picture.

Otherwise, it will display the middle of the picture,
and you can scroll by pointing and clicking with the mouse
on the area of interest to centre it. 

There are 4 zoom settings, which the Zoom button can cycle through.

Zoom OFF      = Width is stretched to create correct aspect ratio. 
Zoom CompactF = Height is squeezed to create correct aspect ratio. 
Zoom / 2      = Half the size of "Compact".
Zoom / 3      = Third the size of "Compact".

The Zoom button will skip "Zoom Off" when it is wider than the screen,
but it can still be selected on the View Menu.

If the window is Maximized while in Compact mode,
then the zoom factor will be set to match the width of the screen.


ANGLE   (EXPERIMENTAL)
-----

This is untested, as I have not come across a multi-angle file yet.
Theoretically, it should allow you to choose which Video stream to view.

The default is the video track zero (internally hex E0).

"AUTO" means that it will play the first angle that it finds.


         ANGLE SETTING DOES NOT IMPACT THE OUTPUT FILE.




PID   (EXPERIMENTAL)
-----

This is unsupported at this stage, 
as it only applies to TRANSPORT STREAMS,
which are NOT supported.

PID = ALL (default)

      When searching, this shows ANY I-Frame with a Video PES Header, 
      so you can se what is on each PID.
      BUT when playing, it is ignored, so as to play the current PID.

PID = AUTO

      Plays thge first PID found with a Video PES Header.

The PID numbers on the menu are relative.
ie. The first PID found is PID number 1,
the second PID found is PID number 2.




TECHNICAL VIEW OPTIONS
----------------------

These should not normally make much difference,
but are included just in case.

Field Correction - Alters display to allow for strange encodes.
                   Try fiddling with this if De-Interlace does not help.

PC/TV Scale    - Minor technical change in display, 
                 because TV black is not identical to PC black.

iDCT Algorithm - Minor technical change in display,
                 with some performance trade-off.




---------------------------------------------------------------------------

PREVIEW OPTIONS
===============


Summary - When previewing the clips, only shows start and end of each clip.

Fast - Playback speed is increased. (Roughly 2X, if no audio.)

Slow - Playback speed is reduced.
       One click = half speed.
       Two clicks = third speed.
       Third click - return to normal.



FRAME RATE
-----------

Controls how the preview function plays the file.

It has a number of sub-options :-


LOCK TO AUDIO
--------------

Because preview does not attempt to buffer all the video frames
required for the audio delay, there is a trade-off between
having jerky audio versus jerky video.

This is relevant on files with "chunky" interleave of audio and video.
It is not so important on files that are "finely" interleaved.
(Planned future enhancements to buffer handling may supersede this.)

Earlier versions played the video smoothly, but audio was choppy
on "chunky" files. 

This new option allows the program to play audio smoothly,
and adjusts the video frame rate to keep up with the audio.

The choice is yours.  Smooth Audio or smooth Video, but not both.

Locks frame rate to audio by default.

You can use the "Statistics" panel to determine whether the file
has "chunky" or "fine" interleaving.  
See description of Stats panel for more info.



FAST 4:2:0 DECODE
-----------------

For most files, this offers more efficient conversion
into the format required for overlay on the video card.

4:2:0 is probably the most common format for domestic use.

The professional format 4:2:2 can also be done fast.

Other formats, such as 4:4:4 continue to use the unaccelerated decode. 

If the input file is Mpeg-1 or a Transport Stream,
then Fast Decode is temporarily DISABLED,
to reduce the chance of crashing.
The program really is only meant to be used with Mpeg-2 PS.


SKIP FRAMES WHEN BEHIND
-----------------------

If preview is slow, try turning this on.

This should help when previewing High Definition on a slow machine, 
but it's a bit ugly, so only use it if you need it.

Typically this will drop delta frames if PLAY mode is too slow.
Conservatively set, so that Key frames always show, even if behind.

If your PC is too slow even for SD, then turn SD skipping on too.

Dropping options can be adjusted to suit your environment :-



PTS BASED SKIPPING (Aggressive Experimental setting)
-------------------

If you are working with files that are FINELY interleaved
or finely time-stamped, then you can try turning on this
option for more efficient skipping when frames are dropped.

*BUT* beware of using this on "chunky" files, 
as it will lead to excessive frame dropping.
See description of Stats panel for more info.

It also decreases the amount of statistics shown,
as more control information is skipped.



FIELD DROPPING  (Experimental)
--------------

If you are working with Field-Encoded pictures,
then this will allow more efficient de-interlacing.

NOTE:- Surprisingly, it is RARE to find files suitable for this feature,
       as a lot of interlaced material is NOT field-encoded !
       I don't know why they encode like that.


-------------------------------------------------------------------

BMP snapshot of current frame.

By default, BMPs will be created in the current input folder.
You can override this using MENU - OUTPUT - BMP Folder. 
 
There are 2 different capture styles:
	1) Grab FRAME asis
	2) Grab FIELDS separately (NEW)
	    Use this where interlacing artefacts are a problem.

By default, if the overlay display is de-interlaced,
then BMP snapshots will be too.

Override this with the SHIFT key when you press B,
or change the view to turn it off for that session.

Overlay de-interlacing can be turned off in MENU - VIEW
and this will change the Snapshot default at the same time.


Grabs have NO Aspect Ratio Correction,
so you will have to use an an imaging program 
like irFanView or Paint Shop Pro to do BiCubic resampling
of the snapshot to correct the aspect ratio.

Any good imaging program can be used to resample the image
to give the correct Aspect ratio:

PAL EXAMPLES:
    720x576 16:9 
             Full FRAME Grab - Resample WIDTH  from 720 to 1024
             FIELD Separated - Resample HEIGHT from 288 to  405. (Alive !)

    720x576 4:3 
             Full FRAME Grab - Resample WIDTH  from 720 to 768
             FIELD Separated - Resample HEIGHT from 288 to 540.


Programming note:-
    If someone wants to send me some open-source "C" code
    for a generalized bicubic resample, then I can add it in,
    otherwise, it will be a whle before I get around to 
    correcting the BMP aspect ratio.
    DVD2AVI has something like this, but it's written in assembler,
    making it a bit hard for me to adapt for the BMP processing.



========================================================================

AUDIO preview controls
----------------------


Boost Volume - Quick and dirty audio boost during preview.
               If overflow occurs, boost is temporarily disabled.

Anti-Phase   - Adjustment for bad audio equipment
               that inverts the singnal on one channel.
               Try this if your audio sounds muffled.
               Only basic correction -  
               Does not compensate for lag between channels.
               If this does not work, try Karaoke instead.

Karaoke      - Attempts to remove vocals from STEREO music track.
               Only basic function, no lag compensation.

               Can sometimes be used to improve playback of poor audio, 
               making muddy vocals CLEARER, 
               by emphasising any channel lag, 
               which impacts treble more than bass.



PS2 Audio    - Needed for Australian DTV HD with Nebula Card
               which uses Private Stream 2 for Audio.
               Different to DVD VOBs, which use PS2 for navigation info.
               This feature is very crude and unreliable,
               but better than nothing. 

48kHz = 44.1kHz - MAY be useful if an annoying whistle comes from your 
                  sound card gives when playing some files.  
                  Slows preview by about 10%.

Decoder - If the default Audio decoder does not work on your CPU,
          you can override it.

CRC Checking - Can be turned off to allow for cruddy files.


Audio Track  
       - Allows for selection of different language tracks,
         on files that have parallel concurent audio.

Audio Track - Auto 
       - Defaults to first track found when play begins. 

Audio Track - Auto Default 
       - Resets Audio track to Auto on each launch.
         Otherwise remembers last specific audio track number used. 

Mute - Turn audio on or off.  Keyboard shortcut = "m".

If a crash occurs in a module name starting with "MPA",
then turn the audio off.
The Mpeg Audio Modules are: MPA_SSE1.dll, MPA_SSE2.dll, 
                            MPA_MMX.dll,  MPALIB.dll.

I not in a position at this time to support the Dark Avenger audio modules,
since I cannot get them to compile on my system.
Any volunteers ?
 


=======================================================================

NAME LIST

+ = Add another file to the list
- = Exclude selected file from the list

REN = Rename the selected file

INFO = Show file details.
       Creation Date is in "International" format (YEAR-MMMDD_HHMM.SS)



=======================================================================

HARDWARE menu

DirectDraw Overlay - indicates whether program is using DirectDraw overlay.
 
Auto-Release - Program will release the Overlay when not required.
                  - During File Save
                  - When Minimized
                  - When file/s closed.
RGB/YUV - Allows you to manually select whether the video display will
          use RGB mode(slow but works on most video cards
          or YUV mode (fast but requires reasonably modern card).

YUV swap - Swap colours on overlay.  Ue this if people have blue skin.

SIMD Technology - Stop the program using cetain CPU functions.


 
=======================================================================

Miscelleaneous
--------------

JUMP SIZES

The amount by which the navigation "Jump" commands will jump,
can be overridden.  

Eventually a dialog will be written to allow this to be changed easily,
but for now, the settings are available in the INI file line :-

             JumpSpan=2,20,50,-2,-20,-50

The 6 values correspond to the following Jump commands:-
              Forward - Small  (2), Big  (20), VeryBig  (50)
             Backward - Small (-2), Big (-20), VeryBig (-50) 

Notice that the backward jumps are NEGATIVE numbers.
Make sure that you use commas, not dots, not semi-colons.
Do *NOT* reposition the line higher or lower,
as the INI file scanner is very fragile.

 
=======================================================================

STATISTICS PANEL
================

This panel is getting very crowded, 
so many fields are not self-explanatory :-


Avg and Nom Bitrates are for the VIDEO stream only. 
Mux rate is the Maximum for the combined Video+Audio.



NON-FIELD PIC - Although the file may be marked as interlaced,
                the pictures are NOT encoded as separate fields.

FINE AV - Smooth interleaving of Video and Audio data, 
          *AND* unique Presentation Time Stamps per frame.

FINE A  - Smooth interleaving of Video and Audio data.
          *BUT* PTS is NOT updated for every frame. (See "@" below)

ROUGH - Many video frames before audio is interleaved.

CHUNKY - File interleaving and PTS resolution are BOTH chnky
         IE Many video frames before audio is interleaved.
            Many video frames before PTS changes.

Mpeg-2 PS    - Mpeg-2 Program Stream. 
Mpeg-2 ES    - Mpeg-2 Elementary Stream.
Vob n Cell m - DVD VOB. 

TS PID nnn - Transport Stream.          *NOT SUPPORTED*
Mpeg-1 PS  - Mpeg-1 Program Stream.     *NOT SUPPORTED*
Mpeg-1 ES  - Mpeg-1 Elementary Stream.  *NOT SUPPORTED*
Mpeg-3 PS  - Decoder is confused.       *NOT SUPPORTED*

If you try to use the program on an UNSUPPORTED file type,
it will likely crash at some stage, maybe lock up your system,
and even if it does not crash, any saved files will probably be rubbish.

4:2:2 = Professional level chroma format
4:4:4 = VERY Professional level chroma format



"Timers" section
----------------

Note that PTS, DTS and GOP timecodes can be all different !
This section shows each in detail.
Values of time stamps are shown in the format "hh:mm:ss.ff".

"V" line is Video information. 
"A" line is Audio. 
"-" line is the relationship between Video and Audio.


In the second column of the timers section:

  "@" = Video PTS Granularity 
      = how many frames between increment of Video PTS. 
          @ 1 = very fine.

  "i" = Audio Interleave 
      = number of video frames before an audio interleave.
          i 1 = very fine. 





==========================================================================

INSTALLATION
============

1)   Download TWO (2) Zip files from http://www.geocities.com/rocketjet4/

     You will need BOTH the main MPG2CUT2 zip file
     AND the AUDIO DLL zip file.


2)  Unzip the downloaded files and do a VIRUS SCAN !

3)  Copy the Mpg2Cut2.EXE file and this TXT file to an appropriate folder.

    AND copy the AUDIO sub-routines into the Windows System folder,
    or into a Dos PATH folder :-

            libmmd.dll,
            mpalib.dll,   mpa_mmx.dll,   mpa_sse1.dll,   mpa_sse2.dll

4)  Create shortcuts to both the EXE and this TXT file
    and put the shortcuts either on the desktop or in your Start Menu.

3)  Under Windows 2000 or later, set security to allow dumb users
    to update the file "Mpg2Cut2.INI".



WINDOWS EXPLORER CONTEXT MENU
=============================

This can be either done manually using Windows Explorer Options
or semi-manually using a REG file.

If you don't know anything about REG files,
use the following manual method in Windows 98 :-

	- Check what Windows Explorer calls mpeg files
	- Menu - View - Folder Options
	- File Types
	- Scroll down to the entry name relating to mpeg files
	- Click on the "Edit" button
	- Click into the retangle labelled "Actions"
	- Click on the "New" button
	- Create a new action called "EDIT"
	- "Browse" button to navigate to the folder
        where you have put the Mpg2Cut program
      - Highlight the file named "Mpg2Cut2.exe"
	- Click "OK"
	- Click "OK"
	- You may want to repeat the whole process for "VOB" files
	- Click "OK"


ALTERNATIVELY
=============

If you are quite familiar with REG files,
AND you have a current BACKUP of your System Registry,
try the following:- 

Edit the supplied file MPG2CUT2.REG

Change the path to match where you have installed Mpg2Cut2.EXE
Note that back slashes must be DOUBLED within the quoted string.
REPEAT FOR ALL OCCURENCES.

Save the changes and open in Regedit.

NOTE:  To avoid accidentally laumching the supplied sample REG file,
       it has been shipped with a dummy extension of .TXT


------------------------------------------------------------------

HOME PAGE: 

     http://www.geocities.com/rocketjet4/


------------------------------------------------------------------

COMPATIBILITY WITH OTHER UTILITIES.

Check that the following OUTPUT options are turned on in Mpg2Cut2 :-

 - Parse Enabled
 - Parse options - Audio Matching  
 - Parse options - Align Audio start packets
 - VOB Preservation (If you are using true DVD vobs.)
 - Default Extension - MPG  (If you are using Adobe.)
 - Preamble - Small



ADOBE PREMIERE - "Unsupported Audio Format".

As I understand it, Adobe Premiere support for AC3 format
is handled by a plug-in.  If you do not have that plug-in,
or it is not installed correctly, Adobe may issue a message :-
"Unsupported Audio Format", or such like.

To determine whether your clip uses AC3 format for audio,
perform the following in Mpg2Cut2 :- 

Bring up the stats panel by pressing F6,
play the clip for a few seconds.
The stats panel will describe what format the audio is.
EG   mp3, mp2, mp1, DD.

If the type is "DD", then for direct import to Premiere 
you will need an AC3 plug-in.

If you do NOT have that plug-in, then do the following :-

- Unmux the clip to separate the audio and video.
  (Menu - File - Unmux)
  The Video is created in an "M2V' file.
  The Audio is put into an "AC3" file.

- Use HeadAc3he to convert the AC3 file to WAV format.
- Drop the M2V and WAV files into the Premiere timeline,
  at matching positions. (Starting at the SAME time.)



------------------------------------------------------------------


CHANGE NOTES (since Version 1.5 of Mpeg2Cut)
============

1) Multiple clips into a single file. 
   After making a selection, click the "+" button
   to add the clip into the Edit selection List.

   When you have selected all your clips,
        Menu - File - Save ALL   to save all the clips.

   If you just want to save ONLY the current selection,
        Menu - File - Save This   to save just the current selection.

   Players may pause at joins - try hitting PLAY.
   This is because I am not rebuilding the internal Time Stamps.

   Preview function of multiple clips (SHIFT-F8)
    is a bit rough around the edges.

2) Multiple Input files.

   Reinstated the ability to concatenate multiple input files.
   Added a menu command to DELETE all the input files.
   This is a REAL delete - *NOT* a recycle.

3) Compatibility improvements.

   Overcomes most of the problems reported by users regarding
   Mpeg2Cut incompatibility with other software:

   Output Format controls to standardise start and end of file.
   Preamble options to copy headers from original file.
   Padding option to pad out end of clip or file.

   Clip scoping changed from I-Frame start block number
   to instead use SEQ/GOP header start address.

4) More Fault Tolerance.
   Much less vulnerable to transmission errors.
   This is especially important when working with cruddy DTV captures.

5) Interface with Windows Explorer 
   Now accepts file name via parm area.
   Output file names are now based on input file name.

6) Toolbar changed.
   Moved to top to allow for picture height > display height
   Extra buttons for ergonomic reasons.
   Button size scaled according to screen resolution. 
   Extra buttons and info on progress window.

7) BMP snapshot no longer requires RGB24 display.
   Option to separate interlaced fields.
   Name now based on input file name and frame time stamp.

8) Display Enhancements.
      - Aspect Ratio Correction 
      - Fast De-Interlace
	- Align view window based on primary mouse click within image area. 
      - Zoom-Out through toolbar button or secondary mouse click;
	// not yet:- Zoom-In at double-click position (Max=1:1)
		     - Release overlay when minimized 
      - Attempt to reacquire overlay after DisplayChange 
                or Mpeg canvas size increase.

   Most MPEG files have anamorphic (squeezed) pixels.
   Program now allows for this,
   so even Cinemascope looks almost sensible.

   HDTV (1080) viewed on low-res screen (640) will ZOOM OUT by default.
   Amount of Zoom can be controlled through "Z" button on toolbar.

   To allow for previewing HDTV on a small processor,
   option to skip frames when behind, during play/preview processing.
   This is rather rough, so only turn on when really needed.

   RGB mode support for view enhancements is very basic. YUY2 is better.

   Gamma control added to Luminance dialog.

   This allows you to adjust for the difference in luminal linearity
   that exists between TV standards and PC video cards.
   Also, the gain control now acts more like classic TV contrast control.

   This slows down "PLAY" mode, as it is less efficient than the basic
   controls that existed in the previous version, which used MMX.

9) Navigation Keys.
   SHIFT key speeds up the arrow keys. Other new keys defined.
   Because I am impatient.
   "Fast Back" option to speed up backward stepping.

10) Intelligent reset of OUT point
    on subsequent IN selection.
    Now resets OUT to END.

11) Shows how many MegaBytes are selected out of total MB.
    Also checks amount of free space on output FAT drive.
    Estimated time left when outputing large file.

12) Default Output folder and Extension.

13) Visual EOF Indicator.
    Display now shows a visual indicator of EOF reached,
    to clearly distinguish it from the last image shown. (YUY2 mode).

13) Frame Rate Controls.

14) Sped up Mpeg decoder a little bit.
    Still scope for trimming fat from the processing of component buffers.
    Also installed the new version of IDCTMMX containing SSE2 code by
    Dmitry Rozhdestvensky.

15) Reduced tendency to swamp the system when copying large selections.
    Can be adjusted using the "Slow" option or buffer size Menu control.

16) Shows Time Co-ordinates.
    Current position is shown as time relative to start of file.
    Assumes timestamp sequence is unbroken.
    
    Alternatively co-ordinates can be shown as the actually internal value
    of the Mpeg time stamps, or just a block number within the file.
    Swap formats by clicking on the time display.

    Preference is given to GOP based time codes,
    but can fall back to PTS basis when GOP time missing.

17) MPAlib interface more intelligent.
    Hardware specific versions chosen autiomatically.
    The user no longer needs to understand the difference in hardware
    between models of CPU with different hardware features.

    Repackaged the "Dark Avenger" Audio DLLs into a single ZIP file,
    downloadable from the same page as Mpg2Cut.
    People did not like having to search 2 different sites for downloads.
    However, the actual content of the DLLs has not changed.

    Detect aand correct out-range values returned from MPAlib 
    when in audio format is 16bit.

18) Cleaned up code for grabbing Private Streams.
    but there is more to do on this, especially on Stream 2.
    More info displayed about mpeg audio layer.

19) More info in Title bar and Stats panel.
    Progessive/Interlaced indicator (p/i) after vertical line count
    Field encode structure (Top first/Bottom first/p=progressive encode)
    EG  576ip means interlaced original, encoded progressively).
    
    I wonder why so many files from interlaced field sources
    are encoded as NON-FIELD (Full Frame) pictures, 
    as if they were from a progressive source ?

20) Garbage Collection Command.
    So you've deleted a file and it ain't in the recycle bin.
    You've even looked in the Norton Proctected bin 
    and it ain't there either.
    The File-Garbage-Reclaim command converts free space on disk 
    into a file, to allow browsing of very deleted data.  

    All very wobbly though.
 
 
+ Miscellaneous little changes.


--------------------

ACKNOWLEDGEMENTS

"WeWantWideScreen" for sample code for field expansion.

Many thanks to Brent Beyeler for his "BBtools" package.
This has been very helpful in figuring what the heck is going on !

--------------------




OTHER KNOWN BUGS & LIMITATIONS
===============-==============

0) Files larger than 2GB may *NOT* be accepted by the host file system.
   Although Mpg2Cut2 can create large files,
   the File System may not accept it.
   ISO DVD-ROM files must NOT exceed 2GB,
   but you won't find out UNTIL you try to burn it.

1) Timestamps are not corrected at joins.
   Some players will pause at the join,
   or become confused in other ways.
   
2) Buffer Bitrate limits are not checked.
   Players with limited capabilities may not like the joins.

3) Bad MPEG data MAY still cause crashes,
   BUT it's a LOT less frequent in this version.

   Since the macro-block decoder is a mystery to me,
   there are still problems that I haven't allowed for.

4) Always puts an MPEG header at the front,
   even if  you don't really want it to.
   However, you can set "preamble" to SMALL
   to reduce the amount of crud.

   Setting preamble to NONE corresponds to ver 1.15 of Mpeg2Cut,
   except that the System Header is slightly more general.

5) After applying SP5 service pack, EXE grew by 20% overnight,
   and I started getting more crashes. Don't like this.

6) In DirectX9, when overlay unavailable, 
   not automatically falling back to RGB. 
   Use the Hardware menu to manually select RGB mode.

7) Luminance control might benefit from being rewritten in MMX.

8) Some Mpeg audio tracks don't play properly.
   EG low-bit-rate mono.

9) Scrollbar - drag is unreliable.
   Some subtle bug - I need to learn about scroll bar handling.



MPEG DECODE ERROR CODES
=======================

Fault_Flag = 1;   // Invalid DCT table code
Fault_Flag = 2;   // Invalid Macro Block type for this Picture type
Fault_Flag = 3;   // Invalid Coded Block Pattern
Fault_Flag = 4;   // Invalid macroblock_address_increment
Fault_Flag = 5;   // Invalid motion_type
Fault_Flag = 10;  // Invalid motion_code

Fault_Flag = 11;  // Invalid start code within Picture data
                     BUG - Triggered when STOP PLAYING 

Fault_Flag = 42;  // Unknown Pic type - not I,P,B


