Jump to content
Sign in to follow this  
ssmith10pn

H264 Keyframe intervals

Recommended Posts

I started playing with this and noticed a significant difference in bandwidth but I haven't noticed any real changes in playback quality.

 

What are good rules of thumb for keyframe intervals vs image rate?

 

I was at 5 ips with a keyframe interval of 2 and moved it to 10. I haven't noticed any difference in playback quality but it cut the bandwidth by almost 1/3.

 

At an image rate of 5 and a keyframe rate of 10 that's a key frame every 2 seconds.

Doing a google search it appears Apple Quicktime runs at about 3 seconds and ESPN streams at about 1 every 10 seconds with the exceptions of sending a key frame at scene changes. Since CCTV scenes don't change because the scene is static I wonder how far this could go?

 

Opinions welcome!

Share this post


Link to post
Share on other sites

I like to keep my key frames to no more then 1 second. I have seen with nighttime or busy scenes things can get very funky when you have the key frame set to 2 or 3 seconds.

 

Reducing bandwidth is all fine and dandy but make sure you review the recorded video to make sure your getting the quality of video that you need.

Share this post


Link to post
Share on other sites
I started playing with this and noticed a significant difference in bandwidth but I haven't noticed any real changes in playback quality.

 

You won't unless there are errors in the transmission (i.e. dropped packets).

 

What are good rules of thumb for keyframe intervals vs image rate?

 

It's all a matter of your tolerance. The longer the interval between key frames, the longer you may have a garbled image. The worst case scenario is you lose the packet immediately after a key frame; if your key frame interval is long, you'll be looking at a bunch of pretty colored blocks for quite some time before the next key frame comes along and snaps the picture back into clarity. Anyone who has ever had satellite TV can tell you how annoying that is.

 

I was at 5 ips with a keyframe interval of 2 and moved it to 10. I haven't noticed any difference in playback quality but it cut the bandwidth by almost 1/3. At an image rate of 5 and a keyframe rate of 10 that's a key frame every 2 seconds.

 

And you may have 2 seconds (or even more) of garbage. What you have to decide is whether or not you can afford to miss some sort of critical event during those 2 seconds. For example, a license plate capture camera could miss a vehicle entirely if the image were distorted for 2 seconds. For a really scary scenario, imagine what would happen if you lost two packets: one immediately after a key frame, and one containing the next key frame. You could be looking at garbage indefinitely if your packet loss is bad enough.

 

OTOH, unless you're running up against the bandwidth limits on your network, lowering your bandwidth usage doesn't make any noticeable difference. For example, if you have a 100Mbps network, and you are currently using 7Mbps of that, lowering your usage to 5Mbps won't result in any noticeable improvements. Heck, if you have the bandwidth, why not run the camera in MJPEG mode? Then every frame is a key frame and you don't have to worry about this anymore.

Share this post


Link to post
Share on other sites
OTOH, unless you're running up against the bandwidth limits on your network, lowering your bandwidth usage doesn't make any noticeable difference. For example, if you have a 100Mbps network, and you are currently using 7Mbps of that, lowering your usage to 5Mbps won't result in any noticeable improvements. Heck, if you have the bandwidth, why not run the camera in MJPEG mode? Then every frame is a key frame and you don't have to worry about this anymore.

 

Bandwidth is not an issue but every little bit helps on storage capacity.

 

Just playing with a server that had twelve 4 channel Jpeg encoders, a hand full of 5mp jpeg 2000 cameras, (6) 2mp h264 cameras, and (10) h264 1mp cameras I cut the bandwith down from 190Mbps to 164Mbps just by changing the key frame from 2 to 10 on a 5ips setting.

Share this post


Link to post
Share on other sites

 

Just playing with a server that had twelve 4 channel Jpeg encoders, a hand full of 5mp jpeg 2000 cameras, (6) 2mp h264 cameras, and (10) h264 1mp cameras I cut the bandwith down from 190Mbps to 164Mbps just by changing the key frame from 2 to 10 on a 5ips setting.

 

"Attack" this ? from different point

Every time u change key frame interval

check your playback as frame by frame and see if you and your customer like it

make sure check for slow and fast changes in video

Share this post


Link to post
Share on other sites

Must be a very solid network. I'll continue to watch it but with the Cameras set on 5IPS and the Keyframe Interval on 10 the playback is rock solid. Even on the cameras 22 miles away running over a AT&T fiber link back to the server.

Share this post


Link to post
Share on other sites

The large h.264 casino installations I've seen tend to use an I-frame every second, regardless of total IPS recording rate.

 

I-frame (or key), is a complete image of the scene. The remaining P-frames (all other images in the interval before the next I-frame) are simply what has changed from the initial I-frame. That is why when using VBR, you see bandwidth go up with more movement, or if using CBR, you see image quality decrease with movement.

 

Like has been said already, please consider what happens with lots of movement and also if the I-frame is garbled from a packet drop on any remote camera (like the one over someone else's fiber).

 

Otherwise, play with the settings and find yourself a nice compromise between video playback quality, and storage utilization.

Share this post


Link to post
Share on other sites

Reply from Avigilon,

 

Hi Scott,

 

This is something that can change from case to case, in general we might recommend to have 1 Key frame per second, so the interval will match the Frame Rate settings. Reason for this is because if by any external reason you lose one of the P frames, the system will need to re-sync in the next K frame and this will represent only losing < 1 sec of video. if this is not critical, you can increase the interval for a larger value.

 

The impact in the bandwidth is more evident if the image have low levels of motion. If you increase the number of Key frames (reducing the interval) you are turning the H264 more Frame by Frame compression once you are sending more frames with the full image coding. It does not necessarily means more quality, as long as all frames are being received they should be able to allow the decompression to work properly and the playback quality will be very similar at human view. When the image have high motion, the P frames will be "almost" K once the image changed from the previous frame so you don't notice so much the bandwidth change.

 

Another lead that could help you choosing the interval is the fact that when you are in playback and drag manually the red line over the timeline, the ACC Client will preview only the key frames, so if you have a larger value, you will see bigger jumps when manually moving the red line.

 

You can refer to the "Understanding Compression Technologies for HD and Megapixel Surveillance" white paper for more detailed information.

 

http://www.avigilon.com/products/documents/whitepapers/

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
Sign in to follow this  

×