SubFix v2.914

A subtitle repair tool for Vidomi-encoded media


Instant-use directions:

    First, read the very last section of this file, "Other
    Information".  If you don't, don't bother whining to me
    that you just managed to destroy the file that took six
    hours to encode and since your dog ate the DVD you can't
    re-rip it.  I will laugh heartily at you if you do.

    Just run it.  It will prompt the user for an input and an
    output file.  If it doesn't put up any error messages, just
    click the giant "Begin" button.  When the text window says
    the program has finished, just close the window.



What SubFix does:

    Vidomi, while a *great* program for backing up one's DVDs
    to a much more convenient and space-efficient format such
    as XviD or DivX, has a number of known flaws.  One of the
    more serious of these involves its handling of subtitles.

    For various reasons, people usually crop and/or scale the
    original DVD frame down to something more efficient.  While
    Vidomi handles cropping and scaling of the main video track
    fairly well, it does not process subtitles in the same
    manner.  Rather, it copies subtitle tracks verbatim from
    the original media, leaving it in many cases with a larger
    frame size than the encoded movie.

    Until now, this left a user only two choices - Don't use
    subtitles (or use an external subtitle file and a player
    other than Vidomi's); or, play the movie in GDI mode, which
    still doesn't *entirely* fix the problem, doesn't allow a
    transparent background color, and runs very very slowly.

    SubFix simply fixes the subtitle data present in a
    Vidomi-style AVI file, making Vidomi correctly display
    subtitles in in overlay mode.

    Because of the way SubFix works, the user does not need 
    to completely reencode their movies.  Furthermore, the
    output of SubFix complies with the DVD subpicture standard,
    so should not cause any incompatibility with future versions
    of Vidomi, or with any other programs that adopt support
    for the Vidomi-style subtitle channel.



How to use it:

    Just run it.  It will prompt the user for an input and an
    output file.  If it doesn't put up any error messages, just
    click the giant "Begin" button.  When the text window says
    the program has finished, just close the window.

    Subfix will also take the input and output files as command
    line arguments (respectively), though that functionality
    exists mostly for testing purposes and probably matters
    very little for normal, "real" use.

    SubFix's window consists mostly of a large text box that
    displays a lot of mostly useless information about the
    current status of a conversion.

    Above the edit window, SubFix displays the name of the
    input file, the name of the output file, and the free
    space available at the path of the output file.  The free
    space calculation may fail on an original version of
    Windows 95, so SubFix will warn the user that not enough
    space exists at the destination (That will also happen if
    the destination really does lack enough free space).  The
    user can ignore that warning, but for everything after
    Windows 95 OSR2, ignoring it *will* fill the destination
    drive and possibly have "bad" side-effects.

    To the right of the file names, two corresponding buttons
    exist.  "Select Input" will change the file to convert *from*.
    "Select Output" will change the file to convert *to*.  Simple
    'nuff, really.

    Below the file selection buttons lies a checkbox labelled
    "Only Scale".  This disables crop-mode, and forces SubFix
    to always scale the subtitle image to fit the frame.  This
    option exists because some movies use very position-specific
    subtitle images to convey information to the viewer.  For
    example, some director's commentary will draw circles around
    objects in the scene, or arrows, or the like.  Forcing Subfix
    to only scale will preserve the relative position of such
    subtitles.  However, this has two drawbacks.  First, scaling
    down causes a loss of information.  A small scale doesn't
    hurt much, but a 50% scale can start impacting readability
    of subtitle text.  Additionally, Vidomi's player will not
    correctly position subtitles anyway.  It always centers
    subtitles, removes all blank horizontal lines, and pushes
    everything to the bottom of the screen.  However, for those
    who wish to consider the possibility of future improvement
    to Vidomi, SubFix has this option.  For ordinary text, or
    anything without a *strong* dependance on position, leave
    the "Only Scale" option unchecked.  Incidentally, the user
    can change this *during* a conversion, and it takes effect
    immediately.  For more information, see the "Conversion Modes"
    section below.

    In the center of the right side, SubFix displays a large
    button labelled "Begin".  Pressing this starts converting
    subtitles from the source file to the destination file.
    Once pressed, the text on the button changes to "Pause",
    and pressing it will, not surprisingly, temporarily stop
    the conversion.  Pressing "Begin" again while paused will
    resume (NOT restart) the conversion.  The pause feature
    exists mostly to allow the user to review something
    interesting that may have gone by in the the text window.

    Finally, at the bottom-right of the window, Subfix displays
    a few simple statistics about its current conversion.  See the
    "Conversion Modes" section below for more info on what some of
    these mean:

        "Done" indicates the percent progress made so far.

        "Total" shows how many subtitle frames SubFix has processed.
        
        "Cropped" counts the number of frames SubFix has cropped.

        "Scaled" counts the number of frames SubFix has scaled.

        "Failed" indicates how many subtitles did not convert well.

    Note that "Cropped" and "Scaled" do not always have to add up
    to "Total".  Unless the user has "Only Scale" checked, SubFix
    will always try to crop first, then scale, to attain the
    needed frame size.

    Okay, that about covers it.  To exit the program, press the
    "X" button in the top-right corner.



Conversion Modes:

    Crop

        Cropping means a bit more in this context than just trimming
        empty borders.  SubFix uses an adaptive blank-space removal
        method that attempts to preserve the relative proportions of
        the original frame as much as possible.

        Cropping does not result in any loss of information (other
        than blank space).  It gives a result as close in quality
        to the original as possible, while squeezing everything
        in a bit tighter.

        Since cropping does not throw away any non-blank space, it
        may not always succeed in reaching a small enough result.
        At 80% of the original (DVD) size, cropping alone will work
        on almost all images.  Below 50% scale, cropping will fail
        to reduce the frame enough most of the time.

        SubFix will (unless the user enables "Only Scale") always
        crop as the first attempt to reduce the dimensions of a
        subtitle frame.  If the image still needs further reduction
        in size, SubFix will then scale down to the right size.  It
        uses this order to preserve the maximum possible quality in
        the subtitle image - by cropping first, it needs to scale
        less (and ths throw away less) to achieve the desired size.

    Scale

        SubFix uses a simple linear projective mapping technique
        to do its scaling.  This goes very very fast (faster even
        than the form of cropping implemented in SubFix, although
        disk access limits total time far more than the size
        reduction technique used).

        Some people will no doubt ask why SubFix doesn't use bicubic
        or some other favorite "high quality" interpolation method
        to do scaling.  DVD subtitle data, while technically a
        4-color format, does not use "ranked" colors.  Thus, any
        operations on that data have to consider it essentially
        as four seperate monochrome images, mixing between which
        gives meaningless results.  So, it turns out, a projective
        mapping gives the same results as doing an upsample, then
        and arbitrarily-high-quality scaling, then a downsample back
        to monochrome.  As a bonus, however, projective mapping has
        one advantage over more complex methods, for the specific
        use at hand - It can "favor" one of the four colors.  This
        allows, for example, the foreground color to always show
        through (nice strong lines), or the background color to
        never simply vanish (in spaces that should remain hollow,
        such as the loop on the letter "P").



Other Information:

    Legal:

        I will release this as GPL'd once I get some feedback and
        fix all the glaringly obvious bugs that would embarass the
        hell out of me if the whole world could see them.  ;-)
        Figure within three months or so (unless no one gives me
        any feedback, in which case I will assume no one uses this
        program, leaving me no motivation to make any further changes
        to it, since it works fine for me).

        For the moment, however, I release this (the SubFix binary
        and this text file) as a non-PD-but-freely-distributable
        executable-only package.  You can give it away, but not
        modify it, sell it, or use it for anything other than the
        intended private use of "fixing" subtitles in Vidomi encoded
        media files.

        So, for its current status, the following disclaimer applies:

        This program exists for research purposes only.  By using
        SubFix, you agree to assume all responsibility for its use.
        This program has no guarantee of suitability for any purposes
        whatsoever, including but not limited to any and all primary
        functionality described in this documentation.  Furthermore,
        by using this program you agree to pay for any and all legal
        fees incurred by myself as a result, directly or indirectly,
        of your actions.

    Bug reports:

        SubFix works correctly on every movie I have on my file
        server (quite a few).  I have done my best to break it
        through normal use and such, and it currently stands up
        to everything I can think to do to it.

        However, I don't seriously expect SubFix has no bugs in
        it, just that I believe, in "good faith" it at least won't
        destroy anything.  Just in case, though, I *would* suggest
        you watch the converted movie fully before deleting the
        original unconverted file.  If you don't, well, I'll still
        try to address your bug, but can't do much if you end up
        with a completely trashed movie.
     
        So anyway...

        Send all bug reports to pla@stone.tmok.com        

        Since I get a *TON* of spam there (over 100 messages per
        day, MAKE SURE to include the word "SubFix" in the subject
        line.  Also, do !NOT! send me attachments unsolicited.  For
        one thing, you'd just waste your time, since cannot decode
        attachments sent to that email address.  If you need to
        send me something, I will respond with an address to which
        you *can* send attachments, or an FTP site you can upload
        to in the case of very large files.

        As a warning, most bugs I expect will involve "unusual"
        subtitle data, something I do not have any examples of
        in my archive, and thus could not deal with.  If possible,
        *if* you need to send me a short clip of a movie (ONLY if
        I request it!  Do not send me *any* media unsolicited),
        please try to reencode just a very short (<1 minute)
        section that exhibits your problem.  Additionally, encoding
        quality has no effect on subtitle data, so squeeze that
        sucker down to nothing (ie, fixed quant of 31, fixed bitrate
        of 1, fixed size of 1Mb (set a big overflow in this case,
        because it will <G>), whatever seems appropriate for your
        codec of choice).

    Notes:

        SubFix currently opens a console window when you execute
        it.  I have done this deliberately to help people help me
        fix any problems they may have.  If you invoke SubFix
        from a command prompt as "subfix.exe > subfix.log", it
        will record all that text to a file you can email me
        (only if I request it).  Ofcourse, if you just want to
        see some funky low-level information about the way DVDs
        and Vidomi store subtitles, change the width of the console
        window to 200 columns, and enjoy half a meg of almost
        meaningless data (Hey, I did include a column header,
        that has to count for something <G>).

        I would reccommend that people only use this initial
        release to convert movies right before watching them,
        and not try to "fix" their entire collection all at
        once.  SubFix takes under five minutes to convert a
        full length movie (on any reasonably modern machine),
        so you won't really waste any time, and if someone
        finds a major bug, you haven't risked damaging any
        movies in your archive.



Okay.  Enjoy.
