On Sat, 18 Sep 2004 [EMAIL PROTECTED] wrote:

> I need a little math help.

        1 + 1 = 2

        Oh - you mean more than that :-)

> How do I use mpeg2enc to get maximum quality and still have it fit on one dvd?

        Want your cake and eat it too, eh? <grin>

> I use Canopus ADVC-300 to capture from VHS tape.

        Been waiting for your status report on how that's worked out for you...

> The tape is about 90 minutes.

        Ok - that right there gives the maximum bitrate that you can use.  The
        default rate of 7500 in mpeg2enc should be fairly close to being ok.

> I've tried playing with -q -b to vary quality but I'm just guessing.

        The KEY option when trying to fit to a specified size is "-b".  With
        a given "-b" the '-q' tells the encoder how hard to push up against
        the bitrate.  At the extreme the encoding becomes effectively CBR
        (Constant Bit Rate).  The encoder will automatically increase the 
        effective "-q" to stay within the given bitrate.  For general use
        "-q 6" (or perhaps "-q 5") is fine.  On ia32 systems "-q 4" is ok but
        below that you _may_ run into artifacting caused by arithmetic 
        precision (overflow I think) problems in the DCT/iDCT (Altivec systems
        appear to not have this problem so '-q 3' is fine there).

> I tried tcrequant from the transcode package but the results were really bad.
> Any scenes with a lot of motion were very "blocky".

        I've wondered what the resultinig video looked like after a requant
        operation.  My initial thought was that a modest (10%) decrease in
        size wouldn't look too bad but I haven't tried it.

> Is there a method for calculating the final size for mpeg2enc output?

        Not "exactly" since the video's rate is Variable.  It's possible to
        get close (with the goal of being smaller than the max of course).

        The oft quoted figure of "2 hours" for a DVD is based on a bitrate
        of about 5000Kb/s.  At the max bitrate (10Mb/s) allowed for a DVD 
        the play time is 1 hour.  For 90 minutes you're about halfway between 
        those two and so the max rate you can use is about 7500 (which is
        the default for mpeg2enc) or _less_.

        Menus take some space (a few motion menus can take 100MB or more),
        and audio of course takes some space (at 224Kb/s the audio is about
        100MB per hour so for 90 minutes you'll have about 150MB of audio).

        To account for the audio, menus, filesystem structure, and so on I'd
        subtract ~3% from the video rate and use "-b 7300" or 7200.  Another
        thing you can do to is use the TMPGEnc quantization matrices 
        ("-K tmpgenc") - allows the encoder to use fewer bits in most cases
        which will help keep the average slightly lower, if possible, than
        the specified max.

        If there's a good bookstore around then even though you're not using
        DVD Studio Pro you might find some of the chapters in the book by
        Martin Sitter "DVD Studio Pro for MAC OS/X" (ISBN 0-321-16784-8)
        interesting reading.  Especially Appendix A "Surviving on a bit
        budget".

        Doing a "bit budget" goes something like this (and we'll assume DVD-5 
        media):

            Reserve 5% of the media size for overhead (the eventual .ifo files,
            UDF filesystem overhead, etc).  This is a bit generous but can help
            account for slight rate spikes from the encoder and so on.
            
            Calculate how much space is needed for all of the audio stream(s)

            Calculate how much space will be used by the subtitle stream(s)

            Calcuate how much space the menus will use (if unknown then use
            10MB or so)

            Calculate the amount of extra (DVDROM, data, etc) space will be
            added (in directories alongside the VIDEO_TS and AUDIO_TS 
            directories)
                
        For simplicity let's not worry about subtitles and motion menus.

        Using 224Kb/s MP2 audio (I tend to use 192Kb/s AC3) the audio will 
        be ~100MB/hr or 150MB for 90min.

        A DVD-5 disk has 4,700,000,000 bytes.

        Subtract 5% leaving 4465000000 bytes.

        Subtract the audio of 150,000,000 leaving 4315000000 bytes.

        Take out 10MB for all the menus leaving 4305000000 bytes.   For 90
        minutes (5400 seconds) that gives a BYTE rate of 4305000000/5400
        or 797222 bytes/sec of 6377776 bits/sec.

        So you can safely use "-b 6400".  The overhead/safety-margin numbers
        are conservative so going with "-b 6700" would probably work - but
        beyond that you run the risk of the file being too large.

        I'd try "mpeg2enc -f 8 -q 5 -b 6400 -K tmpgenc ...".

        Only way to really increase the quality via the bitrate is to put 
        less on a DVD  - but you knew that already :)

        Good Luck!

        Cheers,
        Steven Schultz



-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
Mjpeg-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mjpeg-users

Reply via email to