What are MJPEG, H.264, and H.265? How do They Relate to Watching Security Cameras in a Browser?
What are MJPEG, H.264, and H.265? How do They Relate to Watching Security Cameras in a Browser?
There's three ways that professional security cameras record video (and one way that Google does ).
If you ever wondered why a cheap low resolution camera can work in any browser but every professional camera system only works in Internet Explorer and Safari, then this guide is for you.
How a patent war changed how you can view your security cameras.
MJPEG - Moving Pictures
MJPEG is a slow series of individually compressed pictures; It's not exactly video, in the way that we normally think of video.
MJPEG has one clear advantage to everything else: It works in any browser! The problem is that it takes about 5-20x the hard drive space as H.264, which means that long term data retention is absurdly expensive. It also take 5-20x the processing power of H.264, which is why it is usually limited to the lowest resolution cameras or HD cameras that only can record when they detect motion.
Because MJPEG files are so inefficient, MJPEG is really only used on cameras where you don't have to worry about storing lots of data.
Block Oriented Compression Example.
H.264 - The Golden Standard
H.264, H.265 and VP8/9 are video in the way that we normally think of video. H.264/5 are even the type of files you watch when you are watching movies at the movie theater.
H.264, H.265 and VP8/9 all have what are called "Golden Frames" which are 100% true images, and then use block oriented compression to define the differences from Frame A to Frame B. If part of Frame B differs from the Golden Frame then it is updated, if not it just uses the Golden Frame's info. This saves massive amounts of storage space without really losing anything of value. It also focuses nearly all of the processing power of the camera on the areas of the screen with activity, so you can record much higher resolution video in H.264/5 than MJPEG. Block Oriented Compression is great, because it reduces storage costs, allows you to stream higher quality, crisp clear video without taking too much data, and is what allows you to be able to watch things like Netflix, Youtube, or your surveillance video in HD. MJPEG video would never be able to load fast enough.
H.264 is used in 90% of surveillance cameras and is considered the industry standard.
H.264 is required for ONVIF support (ONVIF is the Open Video Network Interface Format), which is what different manufacturers devices to talk to each other. If you buy another brand camera and want to record it with a SCW NVR, you would need both devices to have ONVIF compliance for the cameras to talk to each other.
ONVIF compliance requires surveillance cameras to support H.264.
The Google / Mozilla Situation
Both H.264 and H.265 were the result of collaboration by many parties including Apple, Microsoft, CIsco, Dolby, and the Moving Picture Experts Group. Most of the movie and tech industry was involved with the creation of the patents which went into H.264, including Google and Mozilla (the maker of Firefox).
H.264 and H.265 require license fees to use them, and this makes adopting a technology difficult and expensive. Google argued that H.264 and H.265 should be open source, so that anyone can use them. At the time, the Moving Picture Experts Group wasn't enforcing the patent fees much anyways, since everyone was just saying "I'll let you use my patents royalty free, if you let me use your patents royalty free." H.264 was kinda free (at least if you had part of the patent contributions). This seemed like a waste to Google - and just to be clear, we think it was a waste. Paying lawyers and requiring complex negotiations to result in, what was usually, just the free trading of patents is a waste of money. Google and a couple other patent providers, including Mozilla, agreed to open source their patents to make it truly free. They thought everyone else would do so as well.
And they were wrong.
And then, Google lost their power. Not only did the other providers not open source H.264, they did the opposite. The equilibrium had shifted. Before Google open sourced their patents, there were no major parties to collect fees from. Now, the other companies now had a major player to charge for the use of their patents. Google could no longer say "I'll let you use my patents royalty free, if you let me use your patents royalty free," since anyone could use their open source patents. Google and Firefox could no longer include H.264 support without paying fees. So, Google and Mozilla (the maker of the Firefox web browser) started working on a different block oriented compression called VP8/VP9. Then Google blocked H.264 in it's web-browser Chrome to try to force all the other parties to open source their patents or use VP8/9.
This also didn't work.
Google largely failed to convince most companies to switch to VP8 compression because it took too long to develop, and because it faced massive legal challenges. Yes, it ended up being free and open source, but it wasn't free and open source for some time, and it was very unclear as to whether a brand who adopted it would get their pants sued off for patent infringement. Google has now admitted that VP8/9/WebM infringed on at least some of Apple's H.264 patents. Nowadays, VP9 is in the ballpark of H.265 (it is about 20% worse*), but ONVIF had already settled on H.264/H.265 as the standard.
Google backtracks and allows some use of H.264
Google and The Motion Picture Group reached an agreement to be able to use H.264 video in Youtube. The MP4 container format with the H.264 video codec is now supported by Chrome and Firefox again in some, but not all cases (although Chromium and Opera do not support the format).
Sadly, the overlay for motion grids, line crossing, text overlays, etc are not supported by this agreement. As almost all security cameras have configurable text overlays telling you the time and date and name of the camera/location, this means that nearly all security cameras still cannot use Chrome/Firefox. The programming language that the entire security industry uses for those overlays is called NAPI. Chrome and Firefox once supported this plugin language, but don't support it anymore.
There's a War Going on, and the Security Industry is Stuck in the Middle
The security industry is caught in the middle of this, and this is why you'll notice that Mozilla Firefox / Google Chrome / Safari support is largely missing from most security camera systems and Microsoft Internet Explorer browser support is included. Because ONVIF rejected VP8/9, if you make a VP8/9 camera, it can't talk to any other devices and people want the ability to use whatever device meets their needs.
There should be an open standard for video compression. This standard should be availible to use in every browser. We agree with Google on this very strongly and we would love for surveillance video to work in every browser, but there must be a legal open standard before anyone will adopt it. The way Google went about infringing patents made it impossible for anyone else to adopt VP8/9 without significant legal risk. Additionally, before any surveillance manufacturer will adopt another video compression standard, ONVIF must adopt it. There's zero chance that ONVIF will adopt a standard that infringed on their current partner's patents.
H.265 - The Future Standard
SCW uses H.265 in most of its new products. H.265 is the successor to H.264. It requires a plugin in all cases. Sadly, it still faces the same patent issues, and still doesn't have support in Firefox or Chrome. We're currently working on a piece of companion software that runs in the cloud, allows you to store video offsite, converts the video to whatever your browser supports, and performs more sophisticated video analytics than are possible without supercomputers. This software will work in Chrome / Firefox. It will have a subscription fee, however.
Why did SCW choose H.265?
You should be able to record 20-40% more video with H.265 than H.264 and about 10x more than MJPEG.
In comparison to H.264, H.265 offers about double the data compression ratio at the same level of video quality, which means both substantially improved video quality at the same bitrate and lower storage requirements. H.265 saves hard drive space and increases the quality of an image by splitting the screen into even more adjustable grids than H.264. This focuses nearly all of the processing power of the camera on the areas of the screen with activity with a much higher accuracy than H264.
The processing power required to create H.265 is about half of what is required to make H.264 video, enabling 4K recording at 30 FPS instead of 15FPS.
The image quality differences of H.265 is most noticeable in situations such as attempting to watch your camera remotely if your internet upload speed is slow.
H.265 video loads better over cellular data speeds.
Our cameras are backwards compatible. If you are using our RTSP feeds to bring SCW video into independent commercial applications, switching to H.264 video encoding may be required. All SCW products can use H.264, or H.265. H.265 is approved by ONVIF, but is not required for ONVIF compliance. Recording in MJPEG still won't let you use Firefox or Chrome because our NVRs, cameras, and plugins include technology covered by H.264/5 patents.
Just Getting Started with Security Cameras?
Get the SCW Beginner Guide!
New to security camera systems? Confused by Analog vs IP? Bullet vs Dome? Indoor vs Outdoor? Don't even know what PTZ means?
No problem! Download the SCW Beginner Guide and get all your questions answered right away!
Here's our H.265 NVRs
The Admiral Pro 16 Channel 4K NVR v2 - ADMP16P16-V2MIn stock$799.00