Specify video encoding average bitrate in bits per pixel?
Forum rules
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
Specify video encoding average bitrate in bits per pixel?
Is there a way to specify a target average video bitrate for encoding in bits per pixel?
I prefer to encode using a target Qfactor http://en.wikipedia.org/wiki/Quality_fa ... ression%29
rather than specifying a bitrate or target file size.
I think using the same Qf for my movies is the best way to get consistent encoding quality, regardless of the cropped image size or frame rate.
Currently, I am manually calculating the average bitrate by multiplying the cropped height and width by the frame rate and 0.0002
I would like to just specify my desired Qf, like 0.20 bits/pixel, and set everything else on automatic.
Is there a way to do this? Can I set the "Constant Quality" slider bar to a specific percentage that will yield a Qf of 0.20 bits/pixel ?
If there is no way to do this, perhaps this would be a good enhancement to the GUI?
I prefer to encode using a target Qfactor http://en.wikipedia.org/wiki/Quality_fa ... ression%29
rather than specifying a bitrate or target file size.
I think using the same Qf for my movies is the best way to get consistent encoding quality, regardless of the cropped image size or frame rate.
Currently, I am manually calculating the average bitrate by multiplying the cropped height and width by the frame rate and 0.0002
I would like to just specify my desired Qf, like 0.20 bits/pixel, and set everything else on automatic.
Is there a way to do this? Can I set the "Constant Quality" slider bar to a specific percentage that will yield a Qf of 0.20 bits/pixel ?
If there is no way to do this, perhaps this would be a good enhancement to the GUI?
Re: Specify video encoding average bitrate in bits per pixel?
*sigh* No.
Just think about it. All you're using to calculate is the bitrate, resolution, and fps. How can that possibly give you any useful information? Do you seriously think that an XviD and an x264 encode at the same bitrate, resolution, and fps have the same quality? Do you seriously think that an h.264 video with bframes and an h.264 video without bframes, both at the same bitrate, resolution, and fps, are going to have the same quality?
If you want constant quality then use constant quality, it is that simple.
Saying bits per pixel is the best way to get consistent quality is just laughable.
Just think about it. All you're using to calculate is the bitrate, resolution, and fps. How can that possibly give you any useful information? Do you seriously think that an XviD and an x264 encode at the same bitrate, resolution, and fps have the same quality? Do you seriously think that an h.264 video with bframes and an h.264 video without bframes, both at the same bitrate, resolution, and fps, are going to have the same quality?
If you want constant quality then use constant quality, it is that simple.
Saying bits per pixel is the best way to get consistent quality is just laughable.
Re: Specify video encoding average bitrate in bits per pixel?
Thank you for educating me about the other factors involved in bitrate and the fallacy I have been laboring under. I am not very knowledgeable about bframes nor the relative efficiencies of Xvid vs. x264. Perhaps the feature I am looking for might better be termed "Average quality" rather than "Constant Quality". My main desire is to be able to automatically specify a somewhat consistent level of quality, without inadvertently wasting or under utilizing file storage or bandwidth. Though I can grasp the concepts of bitrate and file size, I have been unsuccessful at fathoming the help pages explaining "constant quality" or how best to use it. Any simplification of this concept would be appreciate.
Re: Specify video encoding average bitrate in bits per pixel?
afaict, you are pretty much defining Constant Quality. Just go ahead and use it. For DVD's 68% is pretty much transparent to the dvd source and anything over that is generally accepted as a waste. *Maybe* bump to 70%. I do not want to get into a big dissertation as to why 100% is not the dvd source, you will have to just trust me on this one.
With Constant Quality the quality level will be preserved, damned the bitrate needed. So the same quality level on two different sources *could* yield files with a 3000 abr and one with a 1500 abr which would look identical visually. It will all depend on the source.
With Constant Quality the quality level will be preserved, damned the bitrate needed. So the same quality level on two different sources *could* yield files with a 3000 abr and one with a 1500 abr which would look identical visually. It will all depend on the source.
Re: Specify video encoding average bitrate in bits per pixel?
Basically what you want is CRF, Constant Rate Factor. And it's what the Constant Quality slider controls, when you're using x264.
I hesitate to rename it "Average Quality" because "Constant" is in the name the x264 developers chose to give it, and arguably it is giving a constant quality -- just using a somewhat variable quantizer to achieve it. On the other hand, "Average Quality" is a good analogy to explain what it does in simple terms.
Sorry about the Constant Quality documentation, especially the CRF part. It's getting an overhaul soon.
The problem with using a bpp calculation, over and above the examples I pointed out to you above, is that every source video is going to require a different number of bits per pixel to hit a given quality level. You'll quickly see this in using CRF.
I hesitate to rename it "Average Quality" because "Constant" is in the name the x264 developers chose to give it, and arguably it is giving a constant quality -- just using a somewhat variable quantizer to achieve it. On the other hand, "Average Quality" is a good analogy to explain what it does in simple terms.
Sorry about the Constant Quality documentation, especially the CRF part. It's getting an overhaul soon.
The problem with using a bpp calculation, over and above the examples I pointed out to you above, is that every source video is going to require a different number of bits per pixel to hit a given quality level. You'll quickly see this in using CRF.
Re: Specify video encoding average bitrate in bits per pixel?
I've been experimenting with encoding movies with x264 using a "Constant Quality" of 66%.
I then get the average video bitrate from the encoded file, using GSpot or Mediainfo Mac, and re-encode the file
specifying that average bitrate in a 2-pass encode.
Is there any advantage to re-encode in 2-passes this way? If so, maybe it would be nice to have a checkbox next to the Constant Quality slider to re-encode with the resulting average bitrate in a 2-pass encode. It's kind of a pain to do this manually.
I then get the average video bitrate from the encoded file, using GSpot or Mediainfo Mac, and re-encode the file
specifying that average bitrate in a 2-pass encode.
Is there any advantage to re-encode in 2-passes this way? If so, maybe it would be nice to have a checkbox next to the Constant Quality slider to re-encode with the resulting average bitrate in a 2-pass encode. It's kind of a pain to do this manually.
Re: Specify video encoding average bitrate in bits per pixel?
According to the x264 developers, there is no advantage to this approach.
Rodney
Rodney
Re: Specify video encoding average bitrate in bits per pixel?
There's a script on the forum to do this that I wrote a ways back -- search for PalmRest. But it really is pointless. You can see the metrics yourself. If there is any gain, it's imperceptible to the human eye. CRF is just that good.
On the other hand, the principles behind that technique can be leveraged to pick a bitrate for an entire source off a sampling done at several CRF levels, to derive an average bitrate-for-quality curve on a specific source. Search doom9's forum for "DABR."
On the other hand, the principles behind that technique can be leveraged to pick a bitrate for an entire source off a sampling done at several CRF levels, to derive an average bitrate-for-quality curve on a specific source. Search doom9's forum for "DABR."
Re: Specify video encoding average bitrate in bits per pixel?
I must say I'm confused. I've long believed that 2-pass encoding was the way to go.
CRF encodes fairly quickly in one pass. I'm shocked that the quality is supposed to be as good.
Seems to good to be true. There must be some gotch'a! Is it using a higher bitrate than an ABR
encode that could achieve comparable quality?
BTW, I found that article on the PalmRest script:
http://forum.handbrake.fr/viewtopic.php ... &sk=t&sd=a
mike693 indicated that a 2-pass ABR encode with at bitrate of 65-70% of the CRF encode seemed to yield equivalent quality, but maybe CRF has improved in the last year to give as good compression?
Actually, reading jbrjake's posts put me on to this scheme in the first place:
http://forum.handbrake.fr/viewtopic.php?p=1607
CRF encodes fairly quickly in one pass. I'm shocked that the quality is supposed to be as good.
Seems to good to be true. There must be some gotch'a! Is it using a higher bitrate than an ABR
encode that could achieve comparable quality?
BTW, I found that article on the PalmRest script:
http://forum.handbrake.fr/viewtopic.php ... &sk=t&sd=a
mike693 indicated that a 2-pass ABR encode with at bitrate of 65-70% of the CRF encode seemed to yield equivalent quality, but maybe CRF has improved in the last year to give as good compression?
Actually, reading jbrjake's posts put me on to this scheme in the first place:
http://forum.handbrake.fr/viewtopic.php?p=1607
So, I guess the scheme of using the PalmRest script was over a year ago and I'm wondering if it is still a plausible scheme to get both smaller file sizes and consistent quality, or perhaps the x264 encoder has improved so that this is no longer needed? I'm just wondering why the PalmRest method was advocated in early 2007 but now is defunct. It certainly would be a lot easier and faster to just set the "Constant Quality" slider and do a single pass encode, but if I can get better quality or the same quality at a lower bitrate, using a subsequent 2-pass ABR encode, I'm Obsessive Compulsive enough to go for it.jbrjake wrote:No, CRF is for single-pass encodes, the same way CQP is.MrZarniwoop wrote:How about with 2-pass?
2-pass is only available with ABR (average bit rate).
If you seriously desire high quality output and you're patient, you can do a 1-pass CRF encode with a high quality level (65-75%), figure out what the bitrate is on it, and then do a 2-pass encode with that as the average bitrate.
See, when you do a CRF or CQP encode, you have no control over the output's size/bitrate. All you control is how heavily compressed each frame is. Once you know the bitrate you need to reach a certain quality level (compression rate factor), a 2-pass in ABR mode set to that bitrate will pack in even more quality.
Re: Specify video encoding average bitrate in bits per pixel?
I'm looking at the wiki page on Constant Rate Factor, and it also recommends the "PalmRest" method.
http://trac.handbrake.fr/wiki/CRFGuide
http://trac.handbrake.fr/wiki/CRFGuide
Have things changed since this was written? Maybe it's not referring specifically to x264?If you seriously desire high quality output and you're patient, you can do a 1-pass CRF encode with a high quality level (65-75%), figure out what the bitrate is on it, and then do a 2-pass encode with that as the average bitrate.
See, when you do a CRF or CQP encode, you have no control over the output's size/bitrate. All you control is how heavily compressed each frame is. Once you know the bitrate you need to reach a certain quality level (compression rate factor), a 2-pass in ABR mode set to that bitrate will pack in even more quality.
Re: Specify video encoding average bitrate in bits per pixel?
Okay, considering I wrote PalmRest, and I wrote the docs page you're quoting at me, wtf are you arguing with me when I tell you it's pointless?
What about when I said:
http://forum.handbrake.fr/viewtopic.php?p=5984#p5984
http://forum.handbrake.fr/viewtopic.php?p=23582#p23582
http://forum.handbrake.fr/viewtopic.php?p=12427#p12427
You're just entirely mistaken about 2-pass. You don't seem to understand what rate control means. You really read the documentation? It's pretty clear there that quality rate control and bit rate control are diametrically opposed. You either vary quality to maintain an average bitrate, or you vary bitrate to maintain an average quality. So why are you saying 2-pass is always better quality? Of course 2-pass is better for ABR, but that's only because it's trying to equitably mete out bitrate for varying various parts of the video and if it's doing it on the fly it can't do a very good job. It makes zero sense to extend that to quality rate control.I must say I'm confused. I've long believed that 2-pass encoding was the way to go.
CRF encodes fairly quickly in one pass. I'm shocked that the quality is supposed to be as good.
Seems to good to be true.
subjective quality != objective quality. Since a video encoder is not a subjective, intelligent being like a human, it of course uses objective quality metrics like PSNR and SSIM, not "hey it still looked okay to mike when he viewed it." -- it's computing how many errors there are reproducing the input from the output. And like I already told you, the gains from a 2nd pass at the same bitrate are *negligible to the human eye*. Of course you can choose to lower the bitrate, but you are not going to get the same *objective* quality even if on some sources you might retain sufficient *subjective* quality for your uses.mike693 indicated that a 2-pass ABR encode with at bitrate of 65-70% of the CRF encode seemed to yield equivalent quality, but maybe CRF has improved in the last year to give as good compression?
You're cherry-picking comments from me, and I don't appreciate it.Actually, reading jbrjake's posts put me on to this scheme in the first place:
http://forum.handbrake.fr/viewtopic.php?p=1607
What about when I said:
http://forum.handbrake.fr/viewtopic.php?p=5984#p5984
What about when I said, later:The difference really isn't that big, going by PSNR, so it's not really possible to tell, objectively. An increase of maybe 0.008db or so, for the script over the the single pass. And sometimes it even lowers the PSNR slightly at one percentage and raises it slightly at another.
http://forum.handbrake.fr/viewtopic.php?p=23582#p23582
And most of all, what about this post where I demonstrated, at length, how pointless the script is as anything but a toy?...but in the end, I found it just wasn't worth the time. The metrics just did not change in any meaningful way, and I certainly couldn't tell a difference with my eye. CRF on its own is just that good. 2-pass has negligible quality/compression gains over it, in my opinion.
http://forum.handbrake.fr/viewtopic.php?p=12427#p12427
As for the CRF page in the guide, I'm not sure how many times I can apologize for that, but again, as I've said like a dozen times already in this forum: I'm sorry. It was a rough draft derived from various forum posts and it is one of the main articles on the block to be revised the next time the docs are refreshed.It's more of a mental prophylactic than anything else. You're not going to be able to see the difference expressed in picture quality, but it can be reassuring to know it's there.
Re: Specify video encoding average bitrate in bits per pixel?
I'm sorry I'm bugging you. I don't mean to be annoying. Anyway, you've throughly convinced me to just do a one pass CRF, so life is good! Thanks!
Last edited by iSAWaUFO on Tue Oct 14, 2008 4:44 pm, edited 1 time in total.
Re: Specify video encoding average bitrate in bits per pixel?
Just to revisit this question, after some time and many encodes, I'm returning to the "PalmRest" method for at least some films.
CRF is good enough for older B&W films or films with washed out colors and not much action, but for some newer films with lots of action, like these new martial arts films, I've done some comparisons encoding CRF @ 66% and 640 pixels wide, then encoding again with 2 pass at the same average bitrate. The 2 pass versions just looks noticeably better. The colors are more vibrant and in fast moving action scenes there is less "noise" or digital fuzziness or whatever it's called. So just for anyone following this topic, I would still recommend following a CRF with a 2 pass when maintaining a crisper image is important.
CRF is good enough for older B&W films or films with washed out colors and not much action, but for some newer films with lots of action, like these new martial arts films, I've done some comparisons encoding CRF @ 66% and 640 pixels wide, then encoding again with 2 pass at the same average bitrate. The 2 pass versions just looks noticeably better. The colors are more vibrant and in fast moving action scenes there is less "noise" or digital fuzziness or whatever it's called. So just for anyone following this topic, I would still recommend following a CRF with a 2 pass when maintaining a crisper image is important.
Re: Specify video encoding average bitrate in bits per pixel?
I'm chalking this up to placebo effect. Bitrate does not alter color brilliance.
Rodney
Rodney
Re: Specify video encoding average bitrate in bits per pixel?
To illustrate the kind of fuzziness I'm noticing in scenes with lots of motion, I am posting 5 consecutive frames from two encodes showing a girl battling a warrior in a field of cherry blossoms. The 'CQ' frames were encoded at constant quality 62%, which yielded an average bit-rate of 1165Kbps. I then re-encoded the same video with 2 pass (turbo 1st pass), specifying the same average bitrate of 1165Kbps. Most scenes look identical, but in high action scenes I notice occasional fuzzing, for a second or two, in the constant quality encode, where in the 2 pass encode at the same average bit rate, I notice less fuzzing in high action scenes.
I also think the background green forest in the 2 pass encode look slightly darker.
If you look at the girls face and the warriors belt, I think you will notice that the 2 pass encode looks more clear than the constant quality encode.
I also think the background green forest in the 2 pass encode look slightly darker.
If you look at the girls face and the warriors belt, I think you will notice that the 2 pass encode looks more clear than the constant quality encode.
Re: Specify video encoding average bitrate in bits per pixel?
I have absolutely no idea what you think you're proving with single-frame comparisons between two different encodes using different rate control methods.
You have utterly failed to validate that the same frame type decision was made on these particular frames in both encodes. You are comparing apples to oranges.
Plus, from your screenshots, it's rather obvious you were not comparing equivalent encodes since the durations are not the same and you've got them stopped on different time codes. An average bitrate is an average bitrate over the entire length of the encode. If you encode a < 2 minute sample at one ABR, you will get different frame decisions made than if you encode a > 55 minute encode. You have intentionally distorted your results by doing this. I find this to be extremely intellectually dishonest.
Furthermore, CRF is *supposed* to use higher QPs for high motion scenes. CRF is about *subjective* quality. Freeze-framing on particular high motion frames and neglecting low motion frames merely is a way for you to cherrypick results that confirm your bias, without paying any heed to how the human visual system actually perceives moving pictures.
Since you have also failed, in all the time you've had this thread open, to provide the activity logs that are *required* for support, and since it clearly isn't because you have a lack of time (your pointless screenshots must have taken longer than following the forum rules would have), I am locking this thread.
You have utterly failed to validate that the same frame type decision was made on these particular frames in both encodes. You are comparing apples to oranges.
Plus, from your screenshots, it's rather obvious you were not comparing equivalent encodes since the durations are not the same and you've got them stopped on different time codes. An average bitrate is an average bitrate over the entire length of the encode. If you encode a < 2 minute sample at one ABR, you will get different frame decisions made than if you encode a > 55 minute encode. You have intentionally distorted your results by doing this. I find this to be extremely intellectually dishonest.
Furthermore, CRF is *supposed* to use higher QPs for high motion scenes. CRF is about *subjective* quality. Freeze-framing on particular high motion frames and neglecting low motion frames merely is a way for you to cherrypick results that confirm your bias, without paying any heed to how the human visual system actually perceives moving pictures.
Since you have also failed, in all the time you've had this thread open, to provide the activity logs that are *required* for support, and since it clearly isn't because you have a lack of time (your pointless screenshots must have taken longer than following the forum rules would have), I am locking this thread.