View Full Version : Bits per pixel value for quality x264?
Vetal
7th February 2008, 05:47
I'm using bit per pixel koeffitient to calculate target size or bitrate:
Size (kb) = W * H * Num_frames * k/ (8 * 1024)
Where W* H * N total number of pixels. k - bits per pixel
Bitrate (kbit/s) = W * H * fps * k / 1024
Which gives me clear quality-to-koeffitient dependency, independent from resolution or fps. I.e. for XVid I use k = 0.15-0.4 bit per pixel for h263 quantization, 0.5 for MPEG quantiztion.
____________________
Based on that, what k (bits per pixel) should be for x264?
From what I've got, for 1920x1080 used 10000kbit/s,
k = 0.16-0.17. Could you express your feeling about good x264 hiqh quality rip. What k are you using?
Just want to put it to my Excel. I don't feel like using 1000 kbit/s from profiles for different resolution is a good thing
Thank you!
Dark Shikari
7th February 2008, 05:53
Bits per pixel is not a valid measurement. Some sources need more bits than others.
Vetal
7th February 2008, 06:02
Bits per pixel is not a valid measurement. Some sources need more bits than others.
Yes, I understand. That's why I used bpp = 0.15-0.4 for xVid.
I.e. for tripod based, low details (night shot video) goes to 0.15. Hand-taped, high detailed (faces, leaves, etc), lots of movement went to 0.4. And other values between.
I general I put 0.35-0.4 because size is not an issue, so I get around worst cases. But to put something like 0.7 is impractical in case above, right? That's what I'm looking for x264. Hight quality, but not overkill. Assuming I taping nature from hand, crowds, beach with moving waves.
Forgot to mention, for x264 I use automated 2-pass, trellis etc. - all settings at max quality-longer compression time
Thans
putnam
7th February 2008, 08:00
Bits per pixel is not a valid measurement. Some sources need more bits than others.
I have a similar question myself. If you're using x264 for encoding many different types of sources and you need to target a particular bitrate, it becomes useful to come up with some formula for determining bitrate based on pixel space.
A good starting point for me has been selecting my maximum bitrate and pixel space, and then minimums for both, and linearly scaling the bitrate. But this probably has some issues maybe due to dimensions/sizes of macroblocks affecting the quality of the encode, etc. What would be a more consistent formula for IQ? Perhaps accounting for "unused" space on the blocks would be in order, anything else?
Dark Shikari
7th February 2008, 08:04
I have a similar question myself. If you're using x264 for encoding many different types of sources and you need to target a particular bitrate, it becomes useful to come up with some formula for determining bitrate based on pixel space.
A good starting point for me has been selecting my maximum bitrate and pixel space, and then minimums for both, and linearly scaling the bitrate. But this probably has some issues maybe due to dimensions/sizes of macroblocks affecting the quality of the encode, etc. What would be a more consistent formula for IQ? Perhaps accounting for "unused" space on the blocks would be in order, anything else?Use CRF.
Don_Genaro
7th February 2008, 08:36
I´ve been wondering the same thing for a while.
After observing several samples of high quality xvid encodes and then transcode them to h264 I´ve reach these values:
Resolution, Bitrate
512X384, 800
640X480, 1249
352X480, 687
352X240, 344
384X288, 450
720X480, 1405
I consider that bitrate to be very safe to transcode high quality material and retain it´s transparency.
Always using two passes and these settings:
--ref 5 --mixed-refs --no-fast-pskip --bframes 16 --b-pyramid --b-rdo --bime --weightb --direct auto --filter -2,-1 --subme 7 --trellis 2 --analyse all --8x8dct --threads auto --thread-input --progress --no-dct-decimate --no-psnr --no-ssim --output "output" "input" ("--me tesa" if you can or "--me umh")
...Or to transcode xvid material I found that CRF 21 is enough, sometimes even CRF 24, for lower quality xvids.
Dark Shikari
7th February 2008, 08:59
I´ve been wondering the same thing for a while.
After observing several samples of high quality xvid encodes and then transcode them to h264 I´ve reach these values:
Resolution, Bitrate
512X384, 800
640X480, 1249
352X480, 687
352X240, 344
384X288, 450
720X480, 1405
I consider that bitrate to be very safe to transcode high quality material and retain it´s transparency.
Always using two passes and these settings:
--ref 5 --mixed-refs --no-fast-pskip --bframes 16 --b-pyramid --b-rdo --bime --weightb --direct auto --filter -2,-1 --subme 7 --trellis 2 --analyse all --8x8dct --threads auto --thread-input --progress --no-dct-decimate --no-psnr --no-ssim --output "output" "input" ("--me tesa" if you can or "--me umh")
...Or to transcode xvid material I found that CRF 21 is enough, sometimes even CRF 24, for lower quality xvids.Those are definitely overkill settings... and moreso, --trellis 2 is actually known for its tendency to kill off fine detail.
Sagittaire
7th February 2008, 09:06
Bits per pixel is not a valid measurement. Some sources need more bits than others.
... and don't work for different resolution with same source (or comparable source). Bitrate / ( H x W x Fps ) ^ 0.75 is a very better HVS value.
Don_Genaro
7th February 2008, 09:49
Those are definitely overkill settings... and moreso, --trellis 2 is actually known for its tendency to kill off fine detail.
Do you recomend to turn trellis off on a two pass encode to gain more fine details? or to turn it on, in what cases? :thanks:
... and don't work for different resolution with same source (or comparable source). Bitrate / ( H x W x Fps ) ^ 0.75 is a very better HVS value.
Could you explain why the ^0.75 of your formula?? :thanks:
Dark Shikari
7th February 2008, 09:51
Do you recomend to turn trellis off on a two pass encode to gain more fine details? or to turn it on, in what cases? :thanks:Trellis 1 is fine. --trellis 2 inherently allows much more decimation of blocks to reduce bit cost, and can potentially destroy detail (but still increase PSNR).
Could you explain why the ^0.75 of your formula?? :thanks:It represents the fact that higher framerates do not need linearly higher bitrates (due to the motion being smaller and simpler between frames) and the fact that higher resolution video also doesn't need linearly higher bitrates.
Vetal
7th February 2008, 18:24
Trellis 1 is fine. --trellis 2 inherently allows much more decimation of blocks to reduce bit cost, and can potentially destroy detail (but still increase PSNR).
It represents the fact that higher framerates do not need linearly higher bitrates (due to the motion being smaller and simpler between frames) and the fact that higher resolution video also doesn't need linearly higher bitrates.
Very nice advice! Just have to normalize my empiric BPP toward default resolution (720x480).
Is it more x264 specific and XVid should be more or less 0.75?
Sharktooth
7th February 2008, 18:55
BPP is useless. as it has been said it doesnt take into consideration the source material compressibility.
also, what you dont understand is your eyes are not an encoder. there are other things other than motion and details that could vary the complexity of a movie.
every movie has it's own complexity and compressibility. you cant just throw a number based on incomplete informations and think it will be correct.
use a proper compression test instead, and you will have a way more accurate result.
if you dont know what im talking about, have a look here (https://forum.doom9.org/showthread.php?t=133833)
LoRd_MuldeR
7th February 2008, 19:36
Why do you need a "bits per pixel" value anyway ???
* If you are targeting for a certain level of quality and don't care much about filesize, then CRF is the best choice (for the time being)
* If you are targeting for a certain filesize (e.g. CD-R or DVD-R), then use the 2-Pass mode with the appropriate target average bitrate.
cogman
7th February 2008, 19:37
There really is only one reason to use 2 pass encoding and that is that you need the film to be under a certain filesize.
Appart from that, if quality is the most important thing then CRF + some AQ is the best way to go to get a good mix of best bitrate for a given quality.
Vetal
8th February 2008, 20:12
Thanks to everyone! I did some tests with CRF and found how wrong am I with BPP. Some video (Baby Einstein, lots of water video, bubbles etc.) went below in BPP, while my DV video got high above my empiric coefficient.
So, my strategy is, to pick some CRF, 16-25 (based on 'x264 explained' link). Get the compressibility estimate with CRF
Then do 2-pass if I really inclined and video is important. Though, there is some controversy in forum about CRF vs 2-pass: If small gain in quality of 2-pass worth extra processing time. And is there any gain at all.
Please, let me know if there are conceptual mistakes in this approach.
Thank you
Egladil
8th February 2008, 20:23
several people have already said that: if you want specific quality, use CRF, and only use 2-pass if you need a specific filesize.
The time where you needed 1000 passes with 10000 compressibility checks is long over! One (1) pass with crf will give you the desired quality, and it is efficient. you'll not get better quality by using 2-pass, only by using more bitrate.
Sagekilla
8th February 2008, 20:55
Exactly.. and there'll be situations in 2-pass where a scene will be starved of bits and quality will drop, or in others where far too many bits are allocated and are completely unnecessary.
Dark Shikari
8th February 2008, 21:02
Exactly.. and there'll be situations in 2-pass where a scene will be starved of bits and quality will drop, or in others where far too many bits are allocated and are completely unnecessary.No... the entire point of 2pass is to avoid those situations.
DarkZell666
9th February 2008, 10:26
Exactly.. and there'll be situations in 2-pass where a scene will be starved of bits and quality will drop, or in others where far too many bits are allocated and are completely unnecessary.
That's what happens with 1-pass bitrate-based encoding. 2-pass takes the "useless" bits from low-motion scenes and gives them back to the high-motion scenes. If a 2-pass-encoded video looks ugly, the second pass simply doesn't have enough bits to play with. It's like asking for The Lord Of The Rings in HD to fit into 700MB when in fact it needs over 3GB to start looking good. There, the whole movie is craving for more bits and 2-pass can't do anything about it.
boombastic
25th August 2008, 02:15
Why do you need a "bits per pixel" value anyway ???
* If you are targeting for a certain level of quality and don't care much about filesize, then CRF is the best choice (for the time being)
* If you are targeting for a certain filesize (e.g. CD-R or DVD-R), then use the 2-Pass mode with the appropriate target average bitrate.
I use to backup my Blu Ray discs to mkv with x64 for video to a size of a DVD-9. I need an adivce for a range of bpp in order to choice a possible resolution to use....
In other words,if i need a certain size which resoltion should i resize to?How can i determine it with megui?
Ranguvar
25th August 2008, 02:39
Experience. Which is gained by trial and error. But since you're doing HD to a large size, it's pretty much 720p or 1080p. 1080p should be fine for almost everything except very long or hard-to-encode movies.
Sharktooth
25th August 2008, 04:35
@boombastic: if you read the whole thread (only 1 page... it's easy) you'll understand BPP is completely useless.
boombastic
25th August 2008, 07:50
@boombastic: if you read the whole thread (only 1 page... it's easy) you'll understand BPP is completely useless.
Yes i understand it, but anyway when i'm going nto encode a movie let's say of 1200 minutes to a dvd-9 from a bluray source, how can i decide which resolution to use?
I ncoded some to 1080p and they look pretty well on my Samsung 24'' LCD PC-TV Monitor (horizontal resolution 1650) but how they will look on a (i hope!!) future bigger lcd tv?
wyti
25th August 2008, 13:07
1080p will look better on a bigger screen if you have enough bit to encode it.
if you have a whole dvd-9, I think 1080p is better cause you have (with a 120min film) about 9 mbps of bitrate wich is enough on almost all sources.
Sharktooth
25th August 2008, 13:35
compression test...
Sagekilla
25th August 2008, 15:49
@boombastic, you meant 120 minutes right? 1200 minutes is a bit of a stretch to put on anything short of blu-ray ;) Anyway, my recommendation would be to encode 2 short samples of your movie using your normal settings @ 1080p and 720p. See which one you like better and use that. You might have enough bitrate to have good looking 1080p on a dual layer, you might not. Beauty is in the eye of the beholder, as they say.
FWIW: If you use a single dual layer DVD for one movie, you get about 9.9 mbps for 120 minutes, or around 9 mbps if you use a really high bitrate audio track. I know bitrate varies per movie as we all have said, but 1080p on CRF 19 tends to hover around that value for me which should be very good quality.
F J Walter
28th August 2008, 05:06
As far as I understand, 2-pass ABR is equivalent to 1-pass CRF in quality and in allocation of bits to frames. The first pass is just the equivalent of calculating which CRF value can give you that specific file size, then the second pass uses that value as if you picked that CRF at the beginning. Remember that 2-pass ABR places no additional restraints on how much bitrate can vary than CRF does, it just has the benefit of having picked a suitable rate factor based on the experience in the first pass.
Therefore, 2-pass is very much unnecessary if you are aiming for a certain quality and you are flexible on bitrate. It is only when bitrate becomes a factor (ie, fitting something onto a CD/DVD without overshooting or undershooting a specific file size) that 2 passes makes sense.
Yes i understand it, but anyway when i'm going nto encode a movie let's say of 1200 minutes to a dvd-9 from a bluray source, how can i decide which resolution to use?
Unfortunately, this varies wildly (probably by an order of magnitude) depending on characteristics of the source such as noise, whether it is fast-paced editing or slow paced, whether it used fixed cameras or hand-held, whether it was shot on film or video and what type of post-processing was done when mastering, and more. It varies too much to have a rule of thumb based on resolution vs time alone. If you did have such a rule, you will likely find that noisy, high paced film (300, saving private ryan) are significantly lower quality than other more gently edited films, and of course documentaries with lots of interviews (talking heads) will have quality to spare.
It sounds like what you need is some way of determining, for a given lengthy encode, what type of resolution would produce acceptable quality on a certain sized media. The "certain sized media" part implies you need 2-pass ABR. The resolution part would need an extra step: you will need to actually do the encode at a certain size, look at what kind of quantizers it was using, and then do the encoding at a different resolution if the quantizers are way above or way below what you would prefer to use (ie for a CRF value). Resolution will only roughly relate to bitrate; intuitively, increasing the resolution by 10% in both directions will result in approximately 1.21 times the bitrate at same quality, which results in about 1.65 points higher Q at the same bitrate. So to drop the quantizers by about 1.6 points, drop the resolution by about 10% in both directions. It will not by any means follow this exactly, but you may get an idea. Not sure if anyone else has a better suggestion.
If you wanted to save heaps of time you could get a really noisy, high motion film and see what resolution gives you the desired quality at 2 pass ABR, then use that as your 'worst case' scenario and base every other encode on that, but you would still probably raise the resolution a bit for low-motion, less noisy films intuitively.
If you don't know how to "look" for quality or tell when something is acceptable quality then all of this can be difficult. Perhaps look up close at the original and the compressed on a high res computer monitor and look for the differences. Or you can go on numbers; many people say 18 CRF is the quality level to aim for, for something to be acceptably compressed but still looking enough like the original. I wouldn't dare suggest a particular CRF value to aim for, or PSNR or SSIM, as this is controversial and differs according to taste, while others swear by never using a particular quantizer or a particular quality metric but only going by your eyes.
DarkZell666
28th August 2008, 08:41
Or you can go on numbers; many people say 18 CRF is the quality level to aim for, for something to be acceptably compressed but still looking enough like the original.I'll add to that that even though this is subjective, the general trend is that HD content can take higher CRF/quantizers and still "look good", since the artefacts are visually much smaller than the useful info in the picture.
boombastic
28th August 2008, 08:54
Many many thanks for your hints!
I store my hd-copies on a hard disk so i set the final size to a dvd-9 just to not have a backup that has a size very close to the original!
From what i've read and understood i see that a 1-pass encoding with a quantizer of 19 should give me a very good quality and less time to encode respect to a 2-pass one.
What d oyou think?
Ranguvar
28th August 2008, 09:24
Test yourself :) People's tastes vary. So do encode settings and sources.
Encode a sample at different CRF's, and choose the highest CRF you can bear.
Experience gained by testing will save you time later.
aviadr1
27th January 2009, 16:07
Hi guys,
I'm writing a streaming application which takes arbitrary live content and resizes it to a predefined WxH and encodes at some predefined bitrate.
so:
1. bitrate and resolution are fixed and cannot be changed according to content.
2. because this is a streaming application, I need constant bitrate, so I can't use CRF
3. because this is live, I can't do a 2-pass, so I'm using 1-pass ABR
I read the entire thread and understand that using bpp rule of thumb is silly, and that using 1pass ABR is the worst option for quality.
however I do need some rule of thumb to determine what bitrate is appropriate to which resolutions.
currently I'm using kbps = (WxHx4)/1000
as the formula for determining suggested bitrate for each resolution.
advice welcome
:thanks:
cpelliott
27th January 2009, 17:25
I use to backup my Blu Ray discs to mkv with x64 for video to a size of a DVD-9. I need an adivce for a range of bpp in order to choice a possible resolution to use....
In other words,if i need a certain size which resoltion should i resize to?How can i determine it with megui?
Scaling the video down to some arbitrary resolution, encoding it and then having your decoder scale it for your TV is IMHO not a good idea. Here's my practical experience with encoding Blu-Rays. 80 minute animated movies (such as Kung Fu Panda, Igor, etc) will encode to a SL DVD and still look great. 120 minute typical movies will encode to a DL DVD and still look great. If you want to put a very long/high action movie on a DL DVD, you could scale the width from 1920 to 1280 (and height in proportion), especially if you have a 720P TV.
I'm using encoding settings for x264 that take a day or more. Also I don't step frame by frame or press my eyeball against the plasma looking for artifacts. I only keep a single audio track (core AC3 or DTS) since I have a 5.1 setup. 95% of Blu-Rays will encode very well to DL DVD size with HP@L4.1 encoding settings.
Videophiles/audiophiles will probably revolt in horror to what I have said. My experience is that despite great protest they can't tell the difference in blind tests.
Sharktooth
28th January 2009, 01:43
Hi guys,
I'm writing a streaming application which takes arbitrary live content and resizes it to a predefined WxH and encodes at some predefined bitrate.
so:
1. bitrate and resolution are fixed and cannot be changed according to content.
2. because this is a streaming application, I need constant bitrate, so I can't use CRF
3. because this is live, I can't do a 2-pass, so I'm using 1-pass ABR
I read the entire thread and understand that using bpp rule of thumb is silly, and that using 1pass ABR is the worst option for quality.
however I do need some rule of thumb to determine what bitrate is appropriate to which resolutions.
currently I'm using kbps = (WxHx4)/1000
as the formula for determining suggested bitrate for each resolution.
advice welcome
:thanks:
there is no exact rule. it depends on the stuff you're going to stream.
in such cases, i think the "worst case scenario" rule would be the way to go.
that means, find the hardest possible sequence to encode, do a comp test or try several different bitrates and choose the one which gives an acceptable quality to you. use that bitrate for the rest of your encodings.
Esurnir
28th January 2009, 01:56
in such cases, i think the "worst case scenario" rule would be the way to go.
300 blu-ray ?
Or maybe some archived public domain footage.
vBulletin® v3.8.4, Copyright ©2000-2010, Jelsoft Enterprises Ltd.