Looking for guidelines for resolution versus bitrate.

Discussion in 'DivX / XviD' started by uart, Jun 23, 2006.

  1. uart

    uart Member

    Joined:
    Feb 11, 2005
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    11
    Hi. I was just wondering if anyone has some guidelines for estimating what resolution (eg 320x240 or 512x384 or 640x480 etc) is the best choice when the video bit rate is to limited to some specific value.

    For example, say I'm trying to do encode a movie to 700MB and that means I have to limit the video bitrate to perhaps 730kbps (one pass). I've noticed that under these conditions that selecting an output resolution of more than about 512x384 does not result in any quality improvement. Even though it takes longer to encode the quality may actually be worse with a higher resolution setting.

    I know this makes sense, there has to be a compromise between the resolution and the number of bits per pixel, but does anyone have any good guidelines or a "rule of thumb" to use here.

    Thanks.
     
    Last edited: Jun 23, 2006
  2. celtic_d

    celtic_d Regular member

    Joined:
    Jan 23, 2005
    Messages:
    3,352
    Likes Received:
    0
    Trophy Points:
    46
    Varies depending on the compressability of the source. You really need to run some tests to see.
     
  3. uart

    uart Member

    Joined:
    Feb 11, 2005
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    11
    Yes I know that, but that's why I'm looking for guideline rather than strict rules.

    Here's the dilemma. If you are encoding to achieve a certain quality level then you can choose the number of pixels (resolution) required and then adjust the bitrate to get the desired quality level at the chosen resolution. As you say, this required bitrate can vary depending on the compressibility of the source, so some trail an error may be needed.

    The above scenario is fairly straight forward, BUT if you are encoding to achieve a certain file size and therefore have to stick to a particular limited bitrate (say 730kbps for example) then this is where I get unsure about what resolution to choose. ON one hand I know that if I choose a very high resolution then the number of bits per pixel per frame will be too low and the encoding will not be so good. But on the other hand I also know that if I choose a very low resolution to get a goodly number of bits per pixel then the quality will also be poor because there's no escaping the loss of detail inherent in using a low resolution. I know it’s a no win situation but I was hoping someone may have some guideline for making the best of it.

    So far I've found it difficult to judge where the best compromise lays because quite frankly I can't seem to find any optimum setting under these conditions. In other words, I find that if the bitrate is a little low then it doesn't seem to make too much difference what resolution I choose. Whether I encode at 320x240 with a nice plump bit rate of 0.38 bits/pixel/frame or whether I encode at 640x480 with an anaemic rate of 0.095 bits/pixel/frame it looks about equally bad. I'm sure there's an optimum setting somewhere between those two but it seems like a fairly broad peak.

    I've just taken a look at "nitros bitrate/resolution calculator" to try and glean some information on what criteria he uses. The bottom line with this program is basically this :

    - Less than 0.2 bits/pixels/frame is not a good idea.
    - 0.2 to 0.26 bits/pixel/frame is a good choice for a once CD backup.
    - 0.27 to 0.35 bits/pixel/frame is a good choice for a 2 cd backup
    - Greater than 0.35 bits/pixel/frame may be overkill.

    Do most people agree with the rational of Nitro calculator or would you modify the recommendations in certain cases?
     
    Last edited: Jun 25, 2006
  4. aldaco12

    aldaco12 Active member

    Joined:
    Nov 6, 2002
    Messages:
    2,544
    Likes Received:
    0
    Trophy Points:
    66
    My 'rule of thumb' is : keep a DivX bitrate of at least 700 kbps for a 640x360 movie.

    You can even reduce slighly audio's bitrate, if it helps (112 or 96 kbps).

    From VirtualDub's Bitrate Calculator, 700 kbps is the bitrate:
    - of a 1h 56' 50" movie with an audio 128 kbps or
    - of a 1h 59' 10" movie with an audio 112 kbps or
    - of a 2h 1' 30" movie with an audio 96 kbps.


    If you have a bigger length, you can:
    1) backup it on a 2 * CD-R (so you can even raise the bitrare, 192 kbps being 'optimal' and 384 kbps being Dolby Surround.

    2) 'palying' with resolution. Note that 640*360 = 230,400 pixels , so that if you 'rescale' the movie by 80% you have: 512x288.
    Please note: DivX can compress a XxY movie only if X is a multiple of 4 and Y is a multiple of 2.

    In you have a fractional value must round it up. Scaling the 'minimum bitrate' as X*Y I made this table:

    BITRATE
    >846 704x396
    846-772 672x378 [772=700*(672*378)/(640*360)]
    771-700 640x360 <--- my 'rule of thumb'
    699-632 608x342 [632=700*(608*342)/(640*360)]
    631-567 576x324
    566-506 544x306

    In general, having a resolution too low is bad. Please note you can bypass this 'rule of thumb' and pray.
    But what you find everywhere on the net is that 'a DivX movie on 2 * CD-R is almost perfect'.

    You choose. This is my 'rule'.

    Ah, you can even make 4:3 movies.

    For 16:9 , like on http://www.afterdawn.com/guides/archive/dvd2divx_anamorphic.cfm , you make those processes on VirtualDub, after loading the 'pseudo-AVI' file:

    1) crop using the filter Null Transform
    2) resize into a (16*A) x (9*A) movie (for instance, 640x360, for A=40)

    For 4:3 movies, like on the modification shown on http://www.afterdawn.com/guides/archive/dvd2divx.cfm , you:
    1) resize the 720x480/576 into a 640x480/512 movie (or submultiples, like on my 'rule of thumb')
    2) crop using the filter Null Transform

    This is what I apply. Of course '700 kbps' is NOT a threshold which aplies to any movie. It depends on the movie's type. That number is, for me, an 'average'.
    On a Bruce Lee's movie will need a greater bitrate than 'Pride and Prejudice', to have the similar result.

    It's you the one hich must decide which 'correction factor' should be applied to 700 kbps on 'fast motion' or 'slow motion' movies.
    (for instance: 800 kbps for 'fast motion' and 600 kbps 'slow motion'? You decide.)
     
    Last edited: Jun 26, 2006
  5. uart

    uart Member

    Joined:
    Feb 11, 2005
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    11
    Thanks for the info aldaco12. So according to your figures I should be ok to increase the resolution and let the bits/pixel drop at little under these limited bit rate conditions. Your figures actually correspond to a rate of only about 0.1 to 0.12 bits per pixel per frame.

    I just tried encoding a two hour movie at 740kbps using a resolution of 640x480 (4:3) and I must say that I'm finally very pleased with the result. I found that the biggest mistake that I was previously making was in doing only a one-pass encode. I dunno, I think somewhere back in the distant past I tried using two-pass (not even sure what encoder or version) and decided that it wasted a lot of time for not much gain. Today I decided to give it another try on the latest xdiv codec and this time I'm very pleased with the results.

    Yes the two pass procedure now does an excellent job of distributing the bitrate amongst the easy to encode and the hard to encode portions of the movie. It was really interesting to watch it encode and see the "projected file size" change all over the place as it encountered scenes of differing complexity. First I saw it look like it was ballooning out of control (from 700MB up to over 900MB) during the fast action scenes. Then I saw it plummet back down to something like 550MB once it shifted to simple “indoor talking scenes” with static backgrounds. Fortunately, after a lot of ups and downs, in the end it came out pretty close to the 700MB that I was expecting. I've got no doubt that it was getting it right this time. :)


     
  6. The_OGS

    The_OGS Active member

    Joined:
    Feb 18, 2004
    Messages:
    1,461
    Likes Received:
    0
    Trophy Points:
    66
    Hi guys, hey howzit going Sir Aldaco?
    Uart I wanted to tell you '2-pass!' as I read through - but I see at the end you figured it out, LoL :^)
    This is a fascinating topic, the bits/pixel equation, it is a catch-22 like you say. Interestingly 640x480 is very difficult, being 307200 pixels, while 672x304 (my preferred widescreen ratio) is actually much easier at 204288 pixels.
    I backed up Star Wars: Sith (>140 minutes) to 1 - 700MB XviD AVI. It has VBR MP3 audio @ 192kbs and looks (and sounds) fantastic!
    Uart, you should use GKnot:
    http://www.afterdawn.com/software/video_software/dvd_rippers/gordian_knot.cfm
    You probably don't need that other 'system pack' thing they offer with it.
    Anyway, GKnot has a compression testing mechanism built in - it runs a sophisticated test because, as noted, movies very so much in compressability - but I don't use the test regularly.
    I do widescreen (2.35:1) films @ 704x304 and 35mm (1.85:1) films @ 640x352; if they are really long then the bitrate will plunge. If too low, then it's 1400MB rip... simple. The 2 x 700MB can use the AC3 5.1 audio, directly (bonus).
    There is a trick in GKnot where, if you crop ~12 pixels off each side while setting size, it will jump from 704x304 to 672x304 while putting ~2% 'stretch' on the film (from 2.35:1 to ~2.20:1).
    But that 'fullscreen' 4:3 stuff is toughest, pixel wise. I will use 512x384, just to remain similar to a widescreen bitrate.
    Regards
     
    Last edited: Jun 29, 2006

Share This Page