Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 AVC / H.264

Reply
 
Thread Tools Search this Thread Display Modes
Old 7th February 2008, 05:47   #1  |  Link
Vetal
Registered User
 
Join Date: Jul 2003
Posts: 28
Bits per pixel value for quality x264?

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!
Vetal is offline   Reply With Quote
Old 7th February 2008, 05:53   #2  |  Link
Dark Shikari
x264 developer
 
Dark Shikari's Avatar
 
Join Date: Sep 2005
Posts: 8,667
Bits per pixel is not a valid measurement. Some sources need more bits than others.
Dark Shikari is offline   Reply With Quote
Old 7th February 2008, 06:02   #3  |  Link
Vetal
Registered User
 
Join Date: Jul 2003
Posts: 28
Quote:
Originally Posted by Dark Shikari View Post
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

Last edited by Vetal; 7th February 2008 at 06:06.
Vetal is offline   Reply With Quote
Old 7th February 2008, 08:00   #4  |  Link
putnam
Registered User
 
Join Date: Oct 2007
Posts: 3
Quote:
Originally Posted by Dark Shikari View Post
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?
putnam is offline   Reply With Quote
Old 7th February 2008, 08:04   #5  |  Link
Dark Shikari
x264 developer
 
Dark Shikari's Avatar
 
Join Date: Sep 2005
Posts: 8,667
Quote:
Originally Posted by putnam View Post
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.
Dark Shikari is offline   Reply With Quote
Old 7th February 2008, 08:36   #6  |  Link
Don_Genaro
Registered User
 
Don_Genaro's Avatar
 
Join Date: Nov 2007
Location: Chile
Posts: 22
Ive been wondering the same thing for a while.

After observing several samples of high quality xvid encodes and then transcode them to h264 Ive 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 its 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.
Don_Genaro is offline   Reply With Quote
Old 7th February 2008, 08:59   #7  |  Link
Dark Shikari
x264 developer
 
Dark Shikari's Avatar
 
Join Date: Sep 2005
Posts: 8,667
Quote:
Originally Posted by Don_Genaro View Post
Ive been wondering the same thing for a while.

After observing several samples of high quality xvid encodes and then transcode them to h264 Ive 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 its 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.
Dark Shikari is offline   Reply With Quote
Old 7th February 2008, 09:06   #8  |  Link
Sagittaire
Testeur de codecs
 
Sagittaire's Avatar
 
Join Date: May 2003
Location: France
Posts: 2,485
Quote:
Originally Posted by Dark Shikari View Post
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.
__________________
Le Sagittaire ... ;-)

1- Ateme AVC or x264
2- VP7 or RV10 only for anime
3- XviD, DivX or WMV9
Sagittaire is offline   Reply With Quote
Old 7th February 2008, 09:49   #9  |  Link
Don_Genaro
Registered User
 
Don_Genaro's Avatar
 
Join Date: Nov 2007
Location: Chile
Posts: 22
Quote:
Originally Posted by Dark Shikari View Post
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?

Quote:
Originally Posted by Sagittaire View Post
... 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??
Don_Genaro is offline   Reply With Quote
Old 7th February 2008, 09:51   #10  |  Link
Dark Shikari
x264 developer
 
Dark Shikari's Avatar
 
Join Date: Sep 2005
Posts: 8,667
Quote:
Originally Posted by Don_Genaro View Post
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?
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).
Quote:
Originally Posted by Don_Genaro View Post
Could you explain why the ^0.75 of your formula??
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.
Dark Shikari is offline   Reply With Quote
Old 7th February 2008, 18:24   #11  |  Link
Vetal
Registered User
 
Join Date: Jul 2003
Posts: 28
Quote:
Originally Posted by Dark Shikari View Post
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?
Vetal is offline   Reply With Quote
Old 7th February 2008, 18:55   #12  |  Link
Sharktooth
Mr. Sandman
 
Sharktooth's Avatar
 
Join Date: Sep 2003
Location: Haddonfield, IL
Posts: 11,768
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

Last edited by Sharktooth; 7th February 2008 at 19:04.
Sharktooth is offline   Reply With Quote
Old 7th February 2008, 19:36   #13  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,235
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.
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊
LoRd_MuldeR is offline   Reply With Quote
Old 7th February 2008, 19:37   #14  |  Link
cogman
The Crazy Idahoan
 
Join Date: Jun 2007
Location: Idaho
Posts: 249
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.
cogman is offline   Reply With Quote
Old 8th February 2008, 20:12   #15  |  Link
Vetal
Registered User
 
Join Date: Jul 2003
Posts: 28
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
Vetal is offline   Reply With Quote
Old 8th February 2008, 20:23   #16  |  Link
Egladil
Registered User
 
Join Date: May 2004
Posts: 68
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.
Egladil is offline   Reply With Quote
Old 8th February 2008, 20:55   #17  |  Link
Sagekilla
x264aholic
 
Join Date: Jul 2007
Location: New York
Posts: 1,752
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.
Sagekilla is offline   Reply With Quote
Old 8th February 2008, 21:02   #18  |  Link
Dark Shikari
x264 developer
 
Dark Shikari's Avatar
 
Join Date: Sep 2005
Posts: 8,667
Quote:
Originally Posted by Sagekilla View Post
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.
Dark Shikari is offline   Reply With Quote
Old 9th February 2008, 10:26   #19  |  Link
DarkZell666
aka XaS
 
DarkZell666's Avatar
 
Join Date: Jun 2005
Location: France
Posts: 1,122
Quote:
Originally Posted by Sagekilla View Post
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.
__________________

Q9300 OC @ 3.2ghz / Asus P5E3 / 4GB PC10600 / Geforce 8600 GTS
DarkZell666 is offline   Reply With Quote
Old 25th August 2008, 01:15   #20  |  Link
boombastic
Registered User
 
Join Date: Oct 2003
Location: Ascoli Piceno-Italy
Posts: 279
Quote:
Originally Posted by LoRd_MuldeR View Post
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?
boombastic is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:33.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, vBulletin Solutions Inc.