Greetings -

        As promised earlier here is an moderately exhaustive table showing
        the interaction between the "-q" and "-N" options to mpeg2enc.

        The standard (default) matrices were used (-K was NOT used), no
        denoising or medianfiltering was done.

        Source material was a 12962 (NTSC) frame (7m12s) cartoon captured 
        from laserdisc using a S-Video cable to a Canopus ADVC100 analog->DV 
        converter.  Input file is: 

                1555440000 2003-09-07 08:53 redhotridinghood.dv

        Different material will encode differently (different I/P/B frame
        sizes, and different average bitrate) but I believe that the 
        relationship between -q and -N will remain fairly well intact.   If
        someone else wants to take different material and run 96 encodings
        by all means be my guest :)

        The basic script used was:

--------------
#!/bin/sh
# Takes two arguments: -q and -N:
# Example:
#   ./dvd.sh 4 0.1

smil2yuv -i 2 redhotridinghood.dv | \
    y4mshift -b 12,4,696,476 | \
    y4mscaler -O chromass=420_MPEG2 | \
    bfr -b 10m | \
    mpeg2enc -f 8 -M 2 -q $1 -K default -N $2 -o foo.m2v
---------------

        The default bitrate used by mpeg2enc for -f 8 is 7500.

        The 4:1:1 (NTSC DV) to 4:2:0 conversion was done in 'y4mscaler',
        thus the use of "smil2yuv -i 2" (y4mscaler seems to produce better
        output than doing the conversion in smil2yuv+libdv).   Other than that
        no other conversion/manipulation of the data was done.

        Audio was prepared manually ahead of time with the usual 'smil2wav'
        and toolame.

        The I/P/B frame sizes and average bitrate reported in the tables below
        were extracted via perl scripts from the output of 'mplex -f 8 -o 
        /dev/null foo.m2v foo.mp2".

        The bitrate is in kbits/sec (1000) and is the number reported by
        mplex in the 'Average bit-rate' field divided by 1000.

        I/P/B frame sizes are in bytes.

        The 'ratio' column is the current -N's average bitrate divided by the
        avearage bitrate for -N 0.0 within a given -q table.

        There were 6 values of -q used ranging from a quite low (high quality)
        of 4 and up to and including 9 (8 is the default used by mpeg2enc for
        DVD (-f 8)).   For each -q the -N parameter took on 16 values starting
        at 0.0 and incrementing by 0.1 up to a maximum of 1.5

        The primary observation is that the degree of influence -N has
        increases as the quality is lowered (-q increases).  At a high quality
        setting (-q 4) changing -N has very little effect while a somewhat
        lower quality setting (-q 6) it can be seen that altering -N has 
        a much larger influence on the average bitrate.   While at first tis
        may seem counterintuitive it really makes sense - at low -q values
        the encoder is going to use every bit it can and thus modifying the
        high frequency quantizers with -N has a relatively small effect.

        Also demonstrated is the effect of changing just the -q value on the
        average bitrate.

        Hopefully the tables below will be useful as a guide.  The tables are
        organized to make access by awk, perl, etc easy - simple space separates
        the columns.

        It was fun, but I think it'll be a while before I do it again ;)

        I'll keep the raw data files (output from mplex) - if any one wants
        a copy (to check if I made errors in the scripts that produced the
        tables ;)) drop me a line.   If the raw DV file is wanted, well - it
        is ~1.5GB but perhaps something could be worked out ...

        Cheers,
        Steven Schultz
q  N    I     P     B   bitr   ratio
4 0.0 32403 32236 30116 7394.4 1.000
4 0.1 33349 32465 29969 7400.8 1.001
4 0.2 33985 32521 29890 7402.4 1.001
4 0.3 33853 32487 29873 7395.2 1.000
4 0.4 34627 32630 29711 7391.2 1.000
4 0.5 34684 32639 29637 7381.2 0.998
4 0.6 34332 32504 29699 7376.4 0.998
4 0.7 34751 32575 29579 7368.8 0.997
4 0.8 34621 32515 29578 7363.2 0.996
4 0.9 34672 32477 29506 7349.6 0.994
4 1.0 34570 32426 29477 7340.0 0.993
4 1.1 34288 32397 29489 7335.6 0.992
4 1.2 34445 32334 29401 7320.4 0.990
4 1.3 34531 32218 29288 7296.0 0.987
4 1.4 34145 32151 29300 7287.2 0.986
4 1.5 34257 31952 29142 7251.2 0.981

5 0.0 31693 32047 30172 7379.2 1.000
5 0.1 32535 32230 30007 7378.4 1.000
5 0.2 33129 32236 29901 7371.6 0.999
5 0.3 33003 32173 29870 7360.8 0.998
5 0.4 33629 32201 29703 7346.4 0.996
5 0.5 33550 32106 29506 7307.6 0.990
5 0.6 33180 31961 29526 7295.6 0.989
5 0.7 33399 31955 29388 7276.8 0.986
5 0.8 33316 31802 29194 7234.4 0.980
5 0.9 32993 31649 29013 7190.4 0.974
5 1.0 32916 31453 28774 7138.8 0.967
5 1.1 32595 31282 28577 7091.2 0.961
5 1.2 32637 31093 28259 7028.8 0.953
5 1.3 32615 30929 28087 6990.8 0.947
5 1.4 32234 30618 27650 6895.2 0.934
5 1.5 32379 30018 26871 6734.8 0.913

6 0.0 31203 31786 30120 7346.4 1.000
6 0.1 31885 31923 29911 7332.8 0.998
6 0.2 32435 31862 29711 7306.0 0.995
6 0.3 32297 31751 29558 7272.4 0.990
6 0.4 32851 31710 29259 7231.2 0.984
6 0.5 32405 31439 28788 7131.6 0.971
6 0.6 31994 31304 28812 7120.0 0.969
6 0.7 32154 30993 28069 6984.4 0.951
6 0.8 31853 30480 27464 6850.4 0.932
6 0.9 32092 29928 26739 6703.2 0.912
6 1.0 31470 28268 25160 6335.6 0.862
6 1.1 31196 28249 25191 6334.4 0.862
6 1.2 31068 27450 24277 6136.0 0.835
6 1.3 30941 26637 23404 5942.8 0.809
6 1.4 30499 26512 23385 5924.0 0.806
6 1.5 30622 24452 21008 5415.6 0.737

7 0.0 30458 31342 29746 7246.0 1.000
7 0.1 30894 31352 29341 7189.6 0.992
7 0.2 31185 31208 28982 7127.6 0.984
7 0.3 30740 30860 28486 7018.8 0.969
7 0.4 31301 30066 27183 6770.0 0.934
7 0.5 31275 28658 25661 6436.8 0.888
7 0.6 31082 28108 25120 6312.4 0.871
7 0.7 30781 27112 24080 6078.0 0.839
7 0.8 30548 25898 22725 5780.8 0.798
7 0.9 30480 24942 21666 5549.6 0.766
7 1.0 29438 23551 20306 5226.8 0.721
7 1.1 28990 23213 20005 5149.6 0.711
7 1.2 28675 23149 20016 5142.4 0.710
7 1.3 28683 21834 18554 4825.6 0.666
7 1.4 28223 21020 17779 4642.4 0.641
7 1.5 26902 19520 16454 4313.2 0.595

8 0.0 29138 30771 28871 7048.0 1.000
8 0.1 29942 30447 27966 6896.4 0.978
8 0.2 30397 29547 26915 6679.2 0.948
8 0.3 30153 28394 25775 6420.0 0.911
8 0.4 30444 26796 23821 6010.8 0.853
8 0.5 29204 24395 21444 5458.0 0.774
8 0.6 28862 24106 21240 5401.2 0.766
8 0.7 28728 23111 20089 5152.4 0.731
8 0.8 27874 21901 18886 4869.2 0.691
8 0.9 27237 20505 17478 4544.8 0.645
8 1.0 26735 20083 17139 4455.6 0.632
8 1.1 26621 19688 16724 4362.8 0.619
8 1.2 26490 18925 15882 4177.6 0.593
8 1.3 26237 18235 15216 4022.8 0.571
8 1.4 25978 17774 14763 3917.2 0.556
8 1.5 25336 16789 13829 3694.8 0.524

9 0.0 27429 24609 22362 5588.8 1.000
9 0.1 27501 23364 20903 5278.0 0.944
9 0.2 27356 21242 18502 4757.2 0.851
9 0.3 26569 19922 17134 4441.6 0.795
9 0.4 25976 19076 16353 4254.0 0.761
9 0.5 25317 17399 14586 3854.0 0.690
9 0.6 25117 17281 14509 3830.8 0.685
9 0.7 24801 16598 13803 3669.2 0.657
9 0.8 24595 15920 13091 3509.2 0.628
9 0.9 23670 15383 12676 3393.6 0.607
9 1.0 23111 14464 11843 3192.8 0.571
9 1.1 22641 14216 11689 3144.8 0.563
9 1.2 22431 13759 11224 3037.6 0.544
9 1.3 22295 13598 11100 3005.6 0.538
9 1.4 21931 13285 10828 2936.0 0.525
9 1.5 21701 12754 10339 2820.4 0.505

Reply via email to