How to Use RTMP for Live Broadcast

How to Use RTMP for Live Broadcast, Real-Time Messaging Protocol (RTMP) was initially a proprietary protocol for streaming audio, video and data over the Internet, between a Flash player and a server. RTMP is a TCP-based protocol which maintains persistent connections and allows low-latency communication.

1. What is Milesight RTMP?

Real-Time Messaging Protocol (RTMP) was initially a proprietary protocol for streaming audio, video and data over the Internet, between a Flash player and a server. RTMP is a TCP-based protocol which maintains persistent connections and allows low-latency communication.It can realize the function of live broadcast so that customers can login to the camera wherever there is a network.

2. How to Use RTMP for Live Broadcast?

In this test case, we use YouTube to play the role of the testing platform for live view.

2.1 Preconditions

1) IP Camera that can be networked to YouTube.

You can just prepare a computer that can be networked to YouTube, and then directly connect it to the IP Camera which is in the same network segment.

2) An activated account of YouTube with which you can do live broadcast in this platform.

3) Ensure that your devices are with the correct firmware versions (Camera firmware: V4X.8.0.1 or above, V3X.8.0.1 or above, V51.7.0.77-r1 or above, V61.8.0.2 or above).

4) IP Camera needs to support audio function if you want to play audio in YouTube.

2.2 Configuration procedures

2.2.1 Open YouTube website to get the Server URL and Stream key

Step 1: Open YouTube website.

rtmp 643w

Step 2: Login the YouTube account.

Step 3: Get access to the YouTube Studio (If it is the first time to use, you should create studio firstly.).

rtmp 643w 1

Step 4: Get access to Live broadcast and get the server address.

① Click the “CREATE” red box marked, and choose “Start live”.

rtmp 643w 2

② Fill in the red box and click “CREATE LIVE”.

rtmp

The following useful message with the live URL and Stream key will pop up, you can just click “copy” for the live URL(rtmp://a.rtmp.youtube.com/live2) and the live code(7emj-7vrb-scck-a9fx) to form a whole RTMP server address, which is as below in this example: rtmp://a.rtmp.youtube.com/live2/7emj-7vrb-scck-a9fx

rtmp 1

You can also see it here:

rtmp 2

Note:

1. If you use a newly created account to live broadcast, you need to wait for 24hrs to activate the account for using live function.

2. For RTMP, since G.711 is not available for YouTube, so you can only play video from Milesight IP camera with H.264 video coding and AAC audio coding on YouTube.

rtmp 643w343h

3.  If you use Facebook to live broadcast, you need to enable “Use a Persistent Stream Key”.

d8dn twzb95rjaauvvvra4lkcbj nkcqxg 643w314h

2.2.2 Make configuration for Milesight IP Camera

Step 1: Set the video code as H.264, and audio encoding as AAC, considering the limitation of RTMP.

kpqyo4se1dlkwdovamscypaur75u4kh2ra 643w

ywbioxafktoizwgjvyxxii3lqptp6xi ya 643w

Step 2: Access to Network->RTMP, and make configuration.

① Enable RTMP.

② Choose the Stream Type.

③    Fill in the server address confirmed before.

④ rtmp://a.rtmp.youtube.com/live2/7emj-7vrb-scck-a9fx.

⑤   Save the configuration, and you will see the live view in YouTube.

bftcgrrhmu zxbshmjpadv93iklmwe16mg 643w

Note:

Server Address in IP Camera RTMP interface needs to be filled with the format: rtmp://< Server URL >/< Stream key >, remember it needs ’/’to connect between < Server URL > and < Stream key >.

2.2.3 Watch the Live Broadcast of Milesight IP camera

rtmp 3

2.2.4 How to use a fixed url to see the Live Broadcast on YouTube?

You can always use the url:

“https://www.youtube.com/embed/live_stream?channel=CHANNEL_ID” on browser to see the Live Broadcast. Even if the live streaming is interrupted temporarily, you can still use this url to see the live broadcast after the streaming recover.

.

Note:

1. You can check the CHANNEL_ID in the advanced settings of your Youtube.

j z7 klm3tprqf9xzpoiwvzd9 ym4a4oma

2.  Please edit the visibility to “Public“, and disable the “Unlist live replay once stream ends”.

uummrkktlx1kkbvh4xehil5sjf yjj99ra 643w

mpu01hbiv lbnntrgoix6zp1uhoz6fohxw 643w391h

2.3 How to use RTMP on Wowza Streaming Cloud?

Wowza is a live video streaming platform with industry-leading technology delivering broadcast-quality live streaming to any sized audience on any device.

(https://www.wowza.com/)

Step 1: Log in your Wowza account and Add Live Stream.

akqyr 0ugdrqol8xmllpjdacuaptcr1pdg 643w

Step 2:Set stream name and your location.

s x2sa9 jil3npmbbbifdaqja2l6mlemtq 643w486h

Step 3: Choose RTMP as video source, and disable authentication.

jbqvtyrgdht3ve5p19jd128mg9eug0pgpw 643w

Step 4: Finish the settings of Playback, Hosted Page and Review. (You can just keep default settings.)

kacv9rewkjgmx3yra5lj5gfizifnu9g ja 643w193h

Step 5:Then the Live Stream is created. You can get server address and stream name(key).

h503 wgjygdbu8v2erqleixrhcultrhptw 643w404h

Step 6:Fill in server address on camera’s RTMP settings.

hm309xffaczc3xey9o03g j1ugocgfbmfw 643w264h

For example, the Primary Server is

“rtmp://45baad.entrypoint.cloud.wowza.com/app-9w7Wm5d3”, Stream Name(key) is

“b78db5cd”, then you should fill in the Server Address like

“rtmp://45baad.entrypoint.cloud.wowza.com/app-9w7Wm5d3/b78db5cd” on camera.

.

Step 7:Modify camera’s codec to H.264.

kyksuouf lfujahb773zjvamil1ckri3uw 643w

Step 8:Then you can start the Live Stream on Wowza.

mya5s7ibdbvnjjwyd6 8okuctvgwmqjaoq 643w392h

hj4eaeqv9qxtnzhqazo0pfcikvhwrvoi1a 643w373h

RTMP

Description

 

RTMP stream cannot be played normally on third-party platforms such as Youtube, Facebook and so on.

e2utpyjdn qjezuwh wq0kfmac4nl7gyyq

 

Cause

1. Camera Settings

2. Platform Requirements

 

Resolution

1. Camera Settings

1.1 Server Address

 

Ensure that the server address is correct on the camera side.

tpqfux95pfcdbow1ruju u0xdy37zx 5ka 643w

For example, the Stream key is “rruf-21z6-c5w7-22mk-19yd”,

the Stream URL is: “rtmp://a.rtmp.youtube.com/live2”,

so the total server address would be: “rtmp://a.rtmp.youtube.com/live2/rruf-21z6-c5w7-22mk-19yd”

Please pay attention to “/”between the Stream key and URL.

qgncyevpgqahlzy7bh8b55zju7ewkmkjnw

 

1.2 Video Codec

Most platforms only support playing RTMP streams with H.264 video codec.

8wn 2 jeao9gwrobiv4 f hqmi7sfcjww 643w

1.3 TCP/IP Settings

Ensure that the camera can access the Internet.

We recommend using 8.8.8.8 as the Preferred DNS Server.

alrpxlx2ivk mj2zcev1u77jkfauuyzcew 643w

 

2. Platform Requirements

2.1 Audio Coding Limitation on Youtube

Since G.711, G.722, G.726 are not available for YouTube, you can only play video of Milesight IP camera with AAC audio coding on YouTube.

7z8eecekmejpj bzlvu5uybgv4su5w9jwq 643w

 

Note:

For camera models without Audio interface, we recommend using OBS as RTMP client to convert RTSP stream to RTMP stream for Live Broadcast. Moreover, there are no restrictions on Camera Settings, which means that RTMP function does not need to be enabled on the camera. The video codec can be H.265 or MJPEG. All you need is to ensure that the RTSP stream can be played on VLC.

How to play RTMP stream on platforms over OBS

Step1: Install the OBS Studio, which can be downloaded from:

Download | OBS (obsproject.com)

Step2: Install the VLC, which can be downloaded from (If you cannot find the VLC Video Source on OBS, please try again from Step1.):

Download official VLC media player for Windows – VideoLAN

Step3: Add RTSP stream of IP Camera on OBS.

RTSP URL (Contains Authentication Information):

rtsp://admin:password@camera IP: rtsp port/main

rtsp://admin:password@camera IP:rtsp port/sub

f2judoi txm6 34qfdqprhtqk67txlznfw 643w451h

zj8ejoz66fy1xu ne01 fropzbmjvqiqcw 643w453h

jq7p n5tpkeqbvmyixveoqxigah gbycgg 643w453h

For example, we input the URL: “rtsp://admin:test8403@192.168.4.205:554/main” as follows.

mcezecxu yekgwx16sz1zltrbnv3wxndma 643w453h

Click OK to add the RTSP stream successfully.

8a tcegu iusdw1sms7urm7npmegphaqdg 643w451h

Then you will see the RTSP stream you just entered.

qnhsp5yv linhp9sesbbia1s0mujx3gesw 643w451h

Step4: Add RTMP Server Information on OBS.

Take the Youtube platform as an example:

fpk0etynsvdfvt7qzpe2enydiq6k24fyjw

2ngimpmt9h8awi1fluo3ti32azzwohskqg 643w422h

Step5: Click “Start Streaming” and then the RTMP stream will be pushed to Youtube.

vld50ezmwrdncf3oivq0 xerozmcg8f jq 643w

2.2 Resolution Limitation on Youtube

Youtube Studio prompts “Error You need to change the video resolution. The current resolution is (2592×1944), which is not supported for this configuration. The expected video resolution is (1920×1080).” as shown below.

xhjyznirobqm5e0vsnkumix4a4g was6ra

If you encounter such problems, you need to modify the Resolution and Bit Rate of the IP Camera to the recommended parameters.

For more details, please refer to Choose live encoder settings, bitrates and resolutions – YouTube Help (google.com) .

 

2.3 Authentication Requirement on Wowza

Check the “Other RTMP” Settings and make sure the “Disable authentication” is ticked.

6wopj9hksde6iudhcmlspcfnv1nzfc0wba 643w

yhqsjgbv28bhewmijccvfyhp2qrc5m7srq 643w257h

 

Others

 

1. RTMP stream is disconnected unexpectedly after live broadcast on Youtube for 4-5 hours.

Cause: Older versions of RTMP re-connection timeout problem.

Resolution: Upgrade IP camera version to 4X.7.0.78 (2021/6) or above

 

2. Failed to access the previous Youtube live broadcast URL address.

Cause: The Youtube live broadcast URL address is different every time. If the live broadcast is disconnected for a long time, it will cause the address of the live broadcast room on Youtube to change.

Resolution: Fixed URL: https://www.youtube.com/embed/live_stream?channel=CHANNEL_ID

How to use a fixed url to see the Live Broadcast on YouTube

Step1: Resolution: You can check the CHANNEL_ID in the advanced settings of your Youtube.

fnvbl0tczswirbrkmghoygn69ahmv2h9eq

Step2: Please edit the visibility to “Public“, and disable the “Unlist live replay once stream ends”.

sctcec4r5i5yk2xcmlq2bj1wvgdjwta00a 643w

adz8tyzrxxmzokx7qjcfkpa26wyrpisofq 643w391h

.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.