IP Camera Streaming Made Easy with Ant Media Server

Ant Media Server
12 min readFeb 20, 2024

--

Do you want to set up IP camera streaming or simply learn how it works?

In this article, I will explain what IP cameras are, how they work, and who usually uses them. You will also get familiar with the most popular video protocols that are being used for security camera streaming and make a decision what setup is best for your needs.

If you would like to skip straight to the setup process, leap over to our documentation.

What is an IP Camera?

An IP camera is a digital video device that receives and sends video data via an IP network, such as the internet or a local network. They are commonly used for surveillance. The name stands for “ Internet Protocol camera “.

Unlike traditional analog cameras that require a closed-circuit television (CCTV) system for video transmission, IP cameras use the IP protocol to send and receive data. This enables users to view the camera’s live feed, record video, or perform other functions remotely through a computer, smartphone, or other internet-connected devices.
The process of capturing, encoding, and transmitting live video content from an IP camera over an IP network is called IP camera streaming or, in other words, security camera streaming.

Who uses IP Camera Streaming?

Network cameras for live streaming come in various types and configurations, ranging from simple models to sophisticated new cameras and complex systems. IP cameras are particularly suitable for 24/7 streams. They offer features such as high-definition video quality, remote accessibility, motion detection, and sometimes two-way audio communication.

Here are some real-life scenarios where those cameras come in handy:

  • Public safety
    Video surveillance in public spaces for crime prevention. Traffic monitoring. Surveillance at events, concerts, and public gatherings.
  • Events that don’t require a cameraman
    IP cameras don’t need operators to move because they can be fixed. This allows IP cameras to be placed in perfect positions to capture great angles. For example, for house of worship service streaming or conference, and trade show streaming.
  • Remote monitoring
    Checking on property or locations from a distance using the internet. Keeping an eye on infants, children, or pets remotely.
  • Transportation
    Fleet monitoring and railway security.
  • Industrial and commercial
    Surveillance in manufacturing plants and industrial facilities. Construction site surveillance.
  • Smart cities and urban planning
    Integrating IP cameras for urban planning and safety initiatives.
  • Environmental Monitoring
    Wildlife observation and weather station surveillance.

Now that you know the basics, let’s dig into the next step, aiding you in determining the most suitable IP camera streaming setup for your needs.

What video protocols are suitable for it?

An IP camera protocol is a set of rules governing the data exchange between IP cameras and other devices over the internet or a local network. Think of it as a language the camera uses to share information.

The most popular security camera streaming protocols are

  • RTMP or Real-Time Messaging Protocol,
  • RTSP or Real-Time Streaming Protocol,
  • HLS or HTTP live streaming),
  • CMAF/DASH or the Common Media Application Format streaming,
  • WebRTC or Web Real-Time Communication.

Generally RTMP to HLS and RTSP to HLS setups are the most common ones for IP camera streaming. The majority of IP cameras use RTSP by default for capturing. HLS is generally used for playback. However, this setup causes a delay of 10–12 seconds. Play with our RTMP to HLS streaming sample to experience this type of stream with your own eyes. For some usage scenarios, this delay may not be a problem, but in some cases this delay is unacceptable.

Now let’s see how much latency different protocols provide and decide which protocol is the most suitable for your IP camera streaming needs. Let’s start with the RTMP protocol.

IP Camera Streaming with RTMP

RTMP stands for Real-Time Messaging Protocol. Learn more about RTMP streaming and how to set up your own free RTMP server in another tutorial.

Be sure to check out RTMP streaming technical specifications listed below to determine whether or not it’s going to fully cover your needs. Still have some questions left? Don’t hesitate to contact us and we will help you decide.

  • Audio Codecs: AAC, AAC-LC, HE-AAC+ v1 & v2, MP3, Speex
  • Video Codecs: H.264, VP8, VP6, Sorenson Spark®, Screen Video v1 & v2
  • Playback Compatibility: Not widely supported anymore
  • Limited to Flash Player, Adobe AIR, RTMP-compatible players
  • No longer accepted by iOS, Android, most browsers, and most embeddable players
  • Benefits: Low latency and minimal buffering
  • Drawbacks: Not optimized for quality of experience or scalability
  • Variant Formats: RTMPT (tunneled through HTTP), RTMPE (encrypted), RTMPTE (tunneled and encrypted), RTMPS (encrypted over SSL), RTMFP (layered over UDP instead of TCP)

Unlike other video protocols like HLS, or DASH that operate over HTTP and don’t demand a persistent connection, RTMP relies on an active connection with Flash Media Player on port 1935. Additionally, with Flash no longer supported on Android and iOS, the use of RTMP is on a steady decline as of December 2023. RTMP streaming has been replaced by HTML5 streaming protocols that are listed below.

IP Camera Streaming with RTSP

RTSP is the most popular protocol in IP camera streaming. It also remains the standard in many surveillance and closed-circuit television (CCTV) architectures. Discover more about what RTSP streaming is and how it works in another tutorial.

RTSP is conceptually similar to HTTP in function and was easily compatible with existing HTTP networks when it was first developed. It was described as a “network remote control” for media servers. It was designed to control the streams without downloading any files. When a video stream has been started, a device using the protocol sends an RTSP request to the media server that initiates the setup process.

RTSP also supports several control request operations (also known as “commands”) such as play, pause, setup, etc. (I will give you some example requests in the following section.) The first request must also inform the client about the available options via the “OPTIONS” command. After that, a user can watch, or turn off the stream. RTSP maintains an end-to-end connection with TCP and achieves a high throughput over this stable connection without requiring any local download or caching.

The protocol does not support content encryption or retransmission of lost packets, as RTSP is connected to a dedicated server for streaming and relies on RTP to transmit real media. These limitations along with scaling problems led to a drop in overall RTSP usage.

  • Audio Codecs:AAC, AAC-LC, HE-AAC+ v1 & v2, MP3, Speex, Opus, Vorbis
  • Video Codecs:H.265(preview), H.264, VP9, VP8
  • Playback Compatibility:Not widely supported and rarely used for playback (Quicktime Player and other RTSP/RTP-compliant players, VideoLAN VLC media player, 3Gpp-compatible mobile devices)
  • Benefits:Low-latency and ubiquitous in IP cameras
  • Drawbacks:Not optimized for quality of experience and scalability
  • Latency:2 seconds
  • Variant Formats:The entire stack of RTP, RTCP (Real-Time Control Protocol), and RTSP is often referred to as RTSP

If you need to stream with RTSP output, we also got you covered.

IP Camera Streaming with HLS (10–12 second latency)

HLS stands for HTTP Live Streaming. It is an adaptive HTTP-based protocol created by Apple in 2009 to transport video and audio data from media servers to the end user’s device. Check out our previous article to learn what HLS streaming is all about.

IP camera streaming setup as I mentioned above usually operates from the “RTMP to HLS” or the “RTSP to HLS” setups. But these setups provide a delay of at least 10–12 seconds. With the increasing need for low latency in live video streaming, new protocols are being used for IP camera streaming.

  • Audio Codecs: AAC-LC, HE-AAC+ v1 & v2, xHE-AAC, Apple Lossless, FLAC
  • Playback Compatibility: It was created for iOS devices. But now all Google Chrome browsers; Android, Linux, Microsoft, and macOS devices; several set-top boxes, smart TVs, and other players support HLS. It is now a universal protocol.
  • Benefits: Supports adaptive bitrate, reliable, and widely supported.
  • Drawbacks: Video quality and viewer experience are prioritized over latency.
  • Latency: HLS allows us to have 10–12 second latency

Low Latency IP Camera Streaming with CMAF/DASH (3–5 second latency)

The Common Media Application Format (CMAF) is a new format to simplify the delivery of HTTP-based streaming media. It is an emerging standard to help reduce cost and complexity and reduce latency. CMAF simplifies the media delivery to playback devices by working with both the HLS and DASH protocols to package data under a uniform transport container file.

You can use CMAF to play your IP camera streams in 3–5 secs latency with the RTSP to CMAF or the RTMP to CMAF setups. This configuration has more followers nowadays compared to HLS-ending setups due to sufficient delay improvement — 3–5 seconds vs 10–12 seconds.

  • Audio Codecs: AAC
  • Video Codecs: H.265, H.264
  • Packaging and Delivery: Utilizes Common Media Application Format (CMAF). Dynamic Adaptive Streaming over HTTP (DASH) for delivery.
  • Playback Compatibility: Wide compatibility with major web browsers, including Google Chrome, Firefox, Safari, and Microsoft Edge. Support across various operating systems: Android, iOS, Linux, macOS, and Windows. Compatibility with smart TVs, set-top boxes, and other streaming devices.
  • Benefits: Efficient streaming using CMAF format. Dynamic Adaptive Streaming for adaptive bitrate delivery. Improved storage efficiency and reduced latency compared to traditional streaming formats like HLS.
  • Drawbacks: Requires support from the client/player for CMAF and DASH.
  • Latency: Variable latency depending on the DASH profile used. Generally lower latency compared to HLS, often in the range of 3–10 seconds.

Real-time IP Camera Streaming with WebRTC (0.5-second latency)

WebRTC stands for Web Real-Time Communications. It is a very exciting, powerful, and highly disruptive cutting-edge technology and streaming protocol. Learn more about it from What is WebRTC and WebRTC servers.

Thanks to WebRTC you can embed the real-time video directly into your browser-based solution to create an engaging and interactive streaming experience for your audience without worrying about latency.

WebRTC is HTML5 compatible and you can use it to add real-time media communications directly between browsers and devices. And you can do that without the need for any prerequisite of plugins to be installed in the browser. WebRTC is progressively becoming supported by all major modern browser vendors including Safari, Google Chrome, Firefox, Opera, and others.

  • Audio Codecs: Opus, AAC.
  • Video Codecs: VP8, H.264
  • Playback Compatibility: Supported in modern web browsers, including Google Chrome, Firefox, Safari, and Microsoft Edge. Integration support in mobile applications for Android and iOS.
  • Benefits: Real-time communication with low-latency. Peer-to-peer connection for direct communication. Suitable for applications requiring interactive and live communication.
  • Drawbacks: May require additional infrastructure in terms of CPU for signaling and relay servers.
  • Latency: Very low latency, typically in the range of 100 to 500 milliseconds, making it suitable for real-time communication applications.

RTSP to WebRTC streaming

RTSP to WebRTC or RTMP to WebRTC setups are the only possible real-time IP camera streaming solution. For this reason, the ability to stream RTSP broadcasts from IP cameras for real-time playback via WebRTC has been a surveillance and security game-changer.

Ant Media Server can accelerate your surveillance use case by ingesting your IP camera stream using RTSP and repackaging it into WebRTC with 0.5 seconds latency.

The configuration is simple:

  • create a live stream.
  • publish the stream using WebRTC.
  • provide the WebRTC playback URL to your viewers.

IP Camera Streaming without NVRs

Some IP cameras require the support of a central network video recorder (NVR) to handle the recording, video, and alarm management. Ant Media’s approach changes this definition because it is using normal server hardware and the support cost is relatively low compared to NVR. Also if NVR occurs a tech problem, it is a big deal and can be hard to fix when in the Ant Media Server case it will be fixed quickly and easily by changing an OEM part.

Another important part is that it is quite difficult to scale IP camera numbers with NVR. They have in general 8,16,24,32 channels and they are limited with these numbers. With Ant Media Server we are proportionally supporting any number of IP cameras with a server hardware upgrade, so it is very easy to scale IP camera numbers.

Ant Media Server is a live streaming engine that can help you stream your IP camera feed into your website and mobile applications. Basically you will make your IP Cameras web browser compatible by embedding ONVIF.

There are several advantages you should consider:

  • Watch your camera stream with ultra-low latency and utilize PTZ (Pan, Tilt, Zoom) functions of the ONVIF interface.
  • Record your IP Camera stream 24/7. Access, view, and manage your recordings at any time with a simple dashboard.
  • With powerful REST and JavaScript API, you can do anything on Ant Media Server programmatically. If you need integration for your IP camera streaming application, REST and JavaScript API make it easy for you. In addition, there are native Android, iOS, Flutter, React Native, and Unity WebRTC SDKs as well for your mobile applications.
  • Capture broadcasts from IP cameras with RTSP and RTMP and watch them with HLS (10–12 seconds latency), CMAF/DASH (3–5 seconds latency), and WebRTC (0.5-second latency), all with just a few clicks.
  • Ant Media Server transcodes live streams from your IP camera, providing adaptive bitrate (ABR) delivery to any device, anywhere. With ABR streaming, Ant Media Server sends the highest quality resolution broadcast to each viewer’s device according to the network status. In this way, a unique experience is offered without buffering.
  • Security has never been more critical in every area we leave our mark on, and the need to protect broadcasting audio and video content is one of them. Ant Media Server provides security features for every part of streaming. You can encrypt incoming and outgoing streams, require password authentication, limit who can stream to your server, restrict playback to specific IP addresses, and much more.

In order to perform IP camera restreaming, the camera should support the ONVIF standard. ONVIF makes it easy to manage IP cameras. All CRUD and PTZ operations are based on well-defined SOAP messages.

To set up IP camera streaming with Ant Media Server, follow these steps:

  1. Connect your IP camera. Ensure your IP camera is connected to the network.
  2. Install and configure Ant Media Server on your desired platform. Start your 30-day trial and our support team will help with the installation.
  3. Access Ant Media Server web panel.
  4. Add your IP Camera as a stream.
  5. View your stream by accessing it through the provided URL.

Ant Media Server can operate with different broadcasting flows. As well as accepting and creating streaming media, it also has the capability to restream external sources, such as live TV streams, IP camera streams, or other forms of live streams (RTSP, HLS, TS, FLV, etc.). Ant Media Server users can pull IP camera streams easily on the web panel. You won’t need to write any commands or use a terminal to be able to restream sources.

But what if you need to play a private camera stream on a public network with low latency? Let Ant Media’s Embedded SDK be your middle man in this process. Capture IP camera streams from RTSP URLs and restream them directly to web browsers using WebRTC.

This approach eliminates the need for clients to install third-party tools on their devices, as they can simply use web browsers. Moreover, video latency is kept under one second. This solution is perfect for IP cameras located on private networks that don’t have access to public networks and only support RTSP.

FAQ

How do I stream my IP camera?

Connect your IP camera to the network. Install and configure Ant Media Server. Add your IP Camera as a stream or an external source on the web panel. View the stream by accessing it through the provided URL. Dive into the step-by-step guide.

How do I host an IP camera?

Make your IP camera feed accessible on the internet by setting up Ant Media Server. Connect your camera to a server, allowing users to view the live stream remotely through the provided IP address or domain. Dive into the step-by-step guide.

What protocol does an IP camera use for streaming?

Generally speaking IP cameras use RTSP and RTMP for capturing, while playback often employs HLS with 10–12 second delay in broadcasting. But you can also set playback with CMAF/DASH (3–5 second latency) or WebRTC (0.5-second latency) with Ant Media Server.

Can I use a security camera for streaming?

Yes, security cameras can be used for streaming. By utilizing protocols like RTMP, RTSP, HLS, CMAF/DASH or WebRTC users can stream live video feeds from security cameras over the internet with a different latency.

How can I watch my IP camera remotely?

View your stream by accessing it through the provided URL on the Ant Media Server web panel.

Is there any ready IP camera streaming solution built on AMS that I can use ?

Yes, you’re welcome to use the ready-to-use private cloud IP camera solution for SMEs and Enterprises — CamOS. You can request a demo on our marketplace.

Conclusion

We hope this detailed blog post has answered all your questions about IP camera streaming. The main outtake here is that RTMP to HLS and RTSP to HLS are the most common setups for IP camera broadcasting. Nonetheless, this setup causes a 10–12 seconds delay. If you would like to stream your IP camera feed in real time with minimal delay, you need to configure RTSP to WebRTC or RTMP to WebRTC setups. It can be done easily with Ant Media Server. Start your 14-day free trial today!

Originally published at https://antmedia.io on February 20, 2024.

--

--

Ant Media Server

Ant Media Server, open source software, supports publishing live streams with WebRTC and RTMP. It supports HLS(HTTP Live Streaming) and MP4 as well.