I'm doing a lot of MPEG2 to Xvid conversions using (good quality) source files from my DVR or digital camcorder. When converting I can choose to achieve either a target bitrate or a target filesize. Opting for one determines the other - irrespective of the selected video resolution. Though I am well aware that selecting a higher video resolution will leave less bits/pixel for the encoding process which eventually leads to "lower" quality...
In case you don't know what I'm referring to: By bits/pixel I mean the value that one can calculate by using this formula:In GSpot this value is displayed as "Qf" (frame quality in bits/pixel-frame).Code:[bits/pixel] = (bitrate[in kb/s] * 1000) / (width * height * frames/s)
My question is: Can I use the bits/pixel-value as an indicator of quality when encoding my MPEG2-files to Xvid? Can I use it to quickly determine a "good" combination of bitrate and resolution? If so, what is a good value (or range of values) to aim for?
Also, if you deem the bits/pixel-value as inappropriate to determine quality then how do you proceed when selecting a matching bitrate/resolution-combination? I'm looking for a (quick) way to do this without compression-tests which I find very time-consuming when doing a lot of conversions.
I'm looking forward to some insightful replies.
(By the way, to avoid discussion about the video content (if possible in this context) consider that my source files do not contain still images or extreme motion.)
+ Reply to Thread
Results 1 to 12 of 12
Bits per pixel is only the very vaguest of quality indications. Look at the videos in this post:
Compare their bits-per-pixel values. Which would you rather watch?
Keep in mind that resolution is a part of quality. Bits-per-pixel doesn't take this into account. For example, if you have a video that's 640x480 and another video that's 64x48 with the same bits-per-pixel rating the larger one will look far better when viewed full screen because of the greater resolution.
If you're interested in quality just use constant quality encoding. You'll always get the quality you want. The file will turn out whatever size (bitrate) is necessary to deliver that quality.
Thanks for the reply, jagabo. The link to the video-comparison is quite interesting and it pretty much eliminates bits/pixel as an indicator of quality...
You are right, I am - first and foremost - interested in quality (although I don't have "endless" disc-space). What exactly do you mean by "constant quality encoding"? Is that 1-pass encoding with a predefined quantizer? If so please enlighten me here: I always thought that 2-pass encoding delivers the best quality because of the source file-analysis that takes place in the first pass.
I always used 2-pass to encode my videos so do you have any recommendations on what value to use for the quantizer in 1-pass (considering the MPEG2 source files)?
Also, this might be a bit off-topic but how much of an influence do B-frames have on quality/size?
Originally Posted by Information
...what value to use for the quantizer in 1-pass
I usually use q=3. Sometimes q=2. At q=3 you can see a little macroblocking if you look at enlarged still frames. But it's not really noticeable at normal playback speeds. At q=2 you get almost no macrblocking but the files sometimes get nearly as big as the DVD source (so why bother) and bitrates can get too high for some playback devices.
With Target Quantizer (constant quality in a mathematical sense) mode you select the quality. Xvid uses whatever bitrate is required at each frame to deliver that quality. The final average bitrate (and hence file size) is unknown until the encoding is finished.
With 2-pass VBR you specify an average bitrate. The encoder has to examine the video first to determine which frames require more bitrate and which require less. Then during the second pass it allocates bits based on what it learned during the first pass and delivers the requested average bitrate. You don't know beforehand what the quality will be at that bitrate, simply that it's the best quality Xvid can give you at that bitrate.
When the two methods deliver the same average bitate the quality is pretty much identical. You want to use 2-pass VBR encoding when you need a fixed file size (like 700 MB to fit on a CD). That way you get the best quality for that file size. If your main interest is maintaining a certain quality level, and your not too concerned about file size, then you should use Target Quantizer encoding.
B-frames reduce the bitrate requirement in two ways: they are encoded at a higher quantizer (lower quality) and they are bi-directionally encoded.
The idea behind encoding them at a higher quantizer is that you will not notice a frame or two of lower quality as long as the picture is cleaned up again by the following P or I frame. I find this to be the case as long as you don't overboard with the higher quantizers (the standard settings are fine).
Bi-directional encoding usually makes very little difference from what I've seen. If you set Xvid so that b-frames use the same quantizer as I and P frames the bi-directional encoding only makes a tiny difference in file size (target quantizer mode) or quality (bitrate mode).
@manono: Thanks for chipping in. The more opinions the better.
@jagabo: Thanks for the detailed and insightful reply. It helped a lot in my understanding of 1-pass/2-pass encoding. I will look more into constant quality encoding from now on.
Eliminating bits/pixel would be a mistake.
That's negligent, and it's why so many DVD recorders do 720x480 at 3-hour bitrates, which looks like blocky crap. If they were to use the guideline of bits/pixel in the overall consideration process, that would have never happened.
Comparing 640x480 to 64x48 is a fallacy example in this case. Considered realistic comparisons, such as 640x480 to 480x480.
Professional video encoders always keep this in mind. If you don't believe me, pick up most of last year's issues of Broadcast Engineering, as it was discussed multiple times in encoding articles.
It's not the only consideration, but it is in the mix when making decisions on compression.
Originally Posted by lordsmurf
Originally Posted by lordsmurf
Professionals usually work in a limited set of resolutions (e.g. 1920x1080, 1280x720, 720x480) and fixed channel bit rates, so bits/pixel is helpful for setting or comparing say multiple subs on an ATSC channel. At least it is a starting point for bit rate allocation.
For example, a typical PBS local broadcasts a 720p primary and two 480i subs. Equal weighting of bit rate per pixel would result in average allocation as follows:
Primary 1280x720/59.94 = 921600x2 pixels/frame, 72.8% x 19.28Mb/s = 14.0 Mb/s
Sub 1 704x480/29.97 = 337920 pixels/frame, 13.6% x 19.28 = ~ 2.6 Mb/s
Sub 2 704x480/29.97 = 337920 pixels/frame, 13.6% x 19.28 = ~ 2.6 Mb/s
From there average bit rate can be skewed per sub as desired. The better equipped stations will have bitrate sharing (statistical multiplexing) to share variable bit rates across the subs.
A QAM channel has approximately 36Mb/s to share over subs.Recommends: Kiva.org - Loans that change lives.
Quantizers of 2 or 3 are typical for the commonly used codecs in 2009: DivX and Xvid. Quantizers used in AVC (H.264) and HEVC (H.265) are about 6 times as large.
BTW, don't forget the "f" in "bppf" (bits per pixel and frame), because it also depends on the frame rate (fps = frames per second). "Generous" values for Xvid used to be near 0.3.
Last edited by LigH.de; 24th Sep 2018 at 05:52.