Jump to content
cglaeser

Selecting H.264 bit rate

Recommended Posts

I'm curious, what is your decision process for selecting an H.264 bit rate for an IP camera? What range of values do you typically use? Say, for example, half a dozen 1.3MP IP cameras connected to a GB switch and NVR.

 

Best,

Christopher

Share this post


Link to post
Share on other sites

Hi Christopher, I would expect bit rates in the range of 1-5 Mb/s but that would depend on the implementation of the specific manufacturer and frame rate selection.

Share this post


Link to post
Share on other sites
Hi Christopher, I would expect bit rates in the range of 1-5 Mb/s but that would depend on the implementation of the specific manufacturer and frame rate selection.

 

I have tested 400KB/s and 800KB/s (which is, um, I think 3.2Mb/s and 6.4Mb/s). Did not see much difference is image quality, but the demo of exacqVision DVR software indicated many GOP restarts for the higher speed due to lack of bandwidth.

 

On a related topic, what is "Refresh Rate" in the H.264 settings? I've tried various settings less than and greater than one second, but it keeps resetting to 1 second. I am playing with the Panasonic WV-NW502S IP dome, and although the image quality is quite good, I do notice a 1Hz blur-to-sharp cycle. The image is slightly blurred for a fraction of a second, and then comes into sharp focus, and repeats, at about a 1Hz rate. Is this related to refresh rate?

 

Best,

Christopher

Share this post


Link to post
Share on other sites
On a related topic, what is "Refresh Rate" in the H.264 settings? I've tried various settings less than and greater than one second, but it keeps resetting to 1 second. I am playing with the Panasonic WV-NW502S IP dome, and although the image quality is quite good, I do notice a 1Hz blur-to-sharp cycle. The image is slightly blurred for a fraction of a second, and then comes into sharp focus, and repeats, at about a 1Hz rate. Is this related to refresh rate?

That is a strange term for them to use but given your explanation it is the "keyframe distance." The encoder starts the compression with a full frame image compressed kind of like a JPEG called an I-Frame/keyframe. From then on, it sends incremental changes for parts of the screen which have changed (so called "B" and "P" frames). This is more efficient but also causes errors to accumulate which you indicate as blurry images. The encodre will generate an I-Frame when it thinks incremental frames no longer work well. This causes a sudden change in fidelity especially in less than well implemented encoders as you noted.

 

The "refresh rate" above forces a keyframe whether the encoder thought it was necessary or not. 1-second interval is kind of short though so it is a shame that it is not programmable. But if the data rate is high enough it should not matter as much.

Share this post


Link to post
Share on other sites
On a related topic, what is "Refresh Rate" in the H.264 settings? I've tried various settings less than and greater than one second, but it keeps resetting to 1 second. I am playing with the Panasonic WV-NW502S IP dome, and although the image quality is quite good, I do notice a 1Hz blur-to-sharp cycle. The image is slightly blurred for a fraction of a second, and then comes into sharp focus, and repeats, at about a 1Hz rate. Is this related to refresh rate?

That is a strange term for them to use but given your explanation it is the "keyframe distance." The encoder starts the compression with a full frame image compressed kind of like a JPEG called an I-Frame/keyframe. From then on, it sends incremental changes for parts of the screen which have changed (so called "B" and "P" frames). This is more efficient but also causes errors to accumulate which you indicate as blurry images. The encodre will generate an I-Frame when it thinks incremental frames no longer work well. This causes a sudden change in fidelity especially in less than well implemented encoders as you noted.

 

The "refresh rate" above forces a keyframe whether the encoder thought it was necessary or not. 1-second interval is kind of short though so it is a shame that it is not programmable. But if the data rate is high enough it should not matter as much.

 

Amirm can you do us a favour ?

Can you describe or comment in your own words

about H.264 different profiles

such as BP, MP, XP, High 10 and so on... (Base,Main,Extended....

and also is there "easy" way to find out which profile IP camera use

Thanks

Share this post


Link to post
Share on other sites
That is a strange term for them to use but given your explanation it is the "keyframe distance."

 

Yes, I think you're right. "Refresh rate" is probably just the translation from Japanese. It's unfortunate the documentations uses descriptions like "Refresh rate - used to set the refresh rate". Doh!

 

This causes a sudden change in fidelity especially in less than well implemented encoders as you noted.

 

I'm guessing the implementation of the encoder is not very good. You can see pulsing when the scene is perfectly still, even during the day time when noise is at a minimum.

 

Edit: I changed some of the bit rate and fps settings, and the blur pulse is much improved.

Share this post


Link to post
Share on other sites

Amirm can you do us a favour ?

Can you describe or comment in your own words

about H.264 different profiles

such as BP, MP, XP, High 10 and so on... (Base,Main,Extended....

and also is there "easy" way to find out which profile IP camera use

Thanks

Sure. I have to pack for a trip tomorrow so a quick response now but let me know and I can provide a more detailed answer later.

 

First, let me mention that nobody hardly outside of CCTV world uses the term H.264 anymore. That naming more or less went away when ITU merged its activity with MPEG and new name, "AVC" was born. I will use that term from here on but the topic is the same.

 

MPEG-4 AVC is an "advanced" form of video compression in that it provides much more efficient compression than MPEG-2 and MPEG-4 "ASP" (which has nothing to do with AVC despite having the same name!) Part of this efficiency comes from new ways of doing things. But part of it comes from a Chinese menu of "tools" or features that the encoder can use to improve efficiency.

 

Let me give you an example. In these types of video codecs, the screen is divided in square blocks and each is compressed separately. This is why you see "blocking" artifacts when the data rate is not enough to keep up with source activity. In MPEG-4 AVC, there are a choice of two block sizes: 4x4 and 8x8 pixels. In MPEG-2 the only block size was 8x8.

 

For some images, smaller blocks works better and vice versa. The encoder may actually encode both ways, compare them with each other, and then decide which one to use.

 

Unfortunately all of these tools make encoding very slow and "expensive" if you have to build hardware for them. To ease that pain, the specification makes many of these features optional. Both decoder and encoder can choose to only implement a subset of the features and if so, you cannot exceed that capability.

 

This brings us to your question. To keep the permutations of implementations from going crazy, the standards organization create "profiles" which groups certain features together. Think of a convenience package in a car where you get leather seats and navigation together. Same idea here.

 

The baseline profile with least features BP/CBP with the difference being how error resilient one is vs the other. This is the lowest cost implementation and leaves out many features include the different block sizes explained above.

 

MP or Main Profile was supposed to be the most obvious implementation point for AVC. But no sooner than the standard was designed that they were forced to revise it and add the variable block size feature above (prompted by what my team at Microsoft did in building the competing VC-1 solution ). This led to...

 

High Profile (HiP or HP). This is the profile used in Blu-ray format and supports variable block size as explained. Variable block size can be quite handy to achieve sharper images/higher compression ratios but due to high expense, I doubt that we will see it in CCTV applications that often.

 

Above HP, we run into specialized profiles for video post production, archiving, and high resolution source capturing. In other words, not for consumer applications.

 

In consumer land, each video digital sample has 8 bits for black and white (Luminance) information and 8 bits for color (Chrominance). And we have four times less color samples as we have for black and white (i.e color resolution is that much lower).

 

Hi10P allows each sample to go up to 10 bits. This allows better resolution in post production work (reduces possibility of banding).

 

Hi422P doubles the color sample resolution.

 

Hi444P doubles the color sample resolution yet again.

 

So hopefully this gets you started on figuring out what these things mean at high level.

 

As to how you can tell if an encoder is compliant with any of this, the answer is that you can't. The specification doesn't mandate what an encoder must do. It only mandates what the decoder can do! I can design an MPEG-4 AVC encoder which is hardly better than MPEG-2 and still call it MPEG-4 AVC! Such an encoder could choose to not deploy any of the optimization tools and do a lazy job of using the mandatory features.

 

The only way to tell then is to ask the company what encoder they have and what "tools" they support.

Share this post


Link to post
Share on other sites
Guest

Excellent post Amir.

 

The explanation shows why the lack of standardisation is such a problem with many police forces failing to be able replay images from DVRs either due to technical issues or due to increasing costs.

 

Ilkie

Share this post


Link to post
Share on other sites
First, let me mention that nobody hardly outside of CCTV world uses the term H.264 anymore.

 

I'm not sure how to parse this statement. Who is nobody? Are you referring to codec developers?

 

Best,

Christopher

Share this post


Link to post
Share on other sites

that term from here on but the topic is the same.

 

The only way to tell then is to ask the company what encoder they have and what "tools" they support.

 

 

Thank you Amir

 

more ??? to follow

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×