##### Version 2.9.89
In this example we will use the **Streaming Engine** to stream an XProtect Video channel to **YouTube** using **RTMP**.
>[!note]
>**RTMP**, or **Real-Time Messaging Protocol**, is a protocol developed by Macromedia (now owned by Adobe) for streaming audio, video, and data over the Internet. It was originally designed for high-performance streaming of media between a server and Adobe Flash Player, but its use has expanded over time.
>
**Key Features of RTMP:**
>- Low Latency: RTMP is designed for low-latency communication, making it suitable for live streaming applications.
>- Adaptive Streaming: RTMP supports adaptive bitrate streaming, allowing the quality of the stream to adjust dynamically based on network conditions.
>- Protocol Variants: There are different variants of RTMP, including RTMPT (tunneled through HTTP), RTMPS (secure version over SSL), and RTMPE (encrypted version).
>- Support for Multiple Media Types: RTMP can handle audio and video codecs, including H.264 for video and AAC for audio.
First check to ensure `Enable streaming` is ticked and enabled in the `RTSP` tab.
![[Pasted image 20241203121359.png|600]]
Select `Outbound Streams`
Select `Add New`
![[Pasted image 20241203121515.png]]
From the `Outgoing Stream Editor` select `Auto-Start on Streaming Engine Startup` (When needed for always stream).
![[Pasted image 20241203141123.png|400]]
For this example we will be using **YouTube**, the preferred video for this service will be **Transcoded** this just allows the sending video to be more consistent when sending from many different camera types.
>[!note]
>**Transcoding** is the process of converting a media file from one format or encoding to another. This is commonly used in audio and video processing to ensure compatibility across different devices, platforms, and network conditions.
>
**Key Aspects of Transcoding:**
>1. **Format Conversion:** Changing the file format (e.g., from AVI to MP4) to make it playable on specific devices or applications.
>2. **Bitrate Adjustment:** Modifying the bitrate of the media to reduce file size or improve streaming quality. Lower bitrates are often used for mobile devices or slower connections.
>3. **Codec Change:** Switching between different codecs (e.g., from H.264 to H.265) to enhance compression efficiency or quality.
>4. **Resolution Scaling:** Altering the resolution of a video (e.g., from 1080p to 720p) to accommodate different screen sizes or bandwidth limitations.
Select `Transcoding: None`
![[Pasted image 20241203141700.png|400]]
The **Transcoding Profile Editor** will be opened, Select `Add`.
![[Pasted image 20241203141839.png|350]]
In **Edit Profile** start with the default options, edit only if you require lower values to be transmitted.
![[Pasted image 20241203142149.png|250]]
Select the `Profile`
Press `Use Selected Profile`
![[Pasted image 20241203142424.png|350]]
Now select `Add New RTMP Destination`
![[Pasted image 20241203141305.png|400]]
To continue you will now require settings from your **RTMP** video distribution platform.
## YouTube Live
In **YouTube** you will need to be sign in with an account.
In the top right of the page you need to press the camera icon with a (+) select `Go live`
![[Pasted image 20241203124938.png|200]]
>[!warning]
Enabling your first live stream may take up to 24 hours. Select `Enabale` to start this process.
![[Pasted image 20241203125100.png]]
With Live streaming Enabled you will see this page when you `Go Live`.
![[Pasted image 20241203125547.png]]
Under **Stream Settings** you need to `Copy` the **Stream key** and **Stream URL**.
![[Pasted image 20241203125754.png|500]]
>[!warning]
>The Stream key is unique to your user account and is your method of securing the video received is from you. **Do not share this Stream key**, the Stream URL is generic so anyone who has the stream key is able to send video to YouTube on your account.
>
Back to the **Streaming Engine** you now need to complete the following settings;
- Add a unique `Destination Alias`, we recommend the platform name then a camera name reference
- `Stream URL` use what was copied from **YouTube**.
- `Stream Key` use what was copied from **YouTube**.
Press `Save Destination`
![[Pasted image 20241203130532.png|550]]
Press `Save and Start`
The **Status** should update from **Initializing** to **Started**.
![[Pasted image 20241203133816.png]]
Once **Started** the **YouTube Studio** should update and show your video stream live.
![[Pasted image 20241203142843.png]]
#### End a Stream
In **YouTube Studio** find `End Stream` in the top right of the webpage.
![[Pasted image 20241203164738.png|400]]
In the **Streaming Engine** you can select the **YouTube** outgoing stream profile then press `Manual Stop/Pause`.
![[Pasted image 20241203165250.png]]
### Troubleshooting
#### Warning - Lower than the recommended bitrate
![[Pasted image 20241203162124.png]]
![[Pasted image 20241203164219.png]]
Even when using **transcoding** if the camera is not generating 2500Kbps this process will not make the stream larger. This error is related to providing adequate quality for a live stream. IP CCTV cameras generally are very efficient with the bandwidth used.
#### No data
Generally this would happen if the stream was stopped or got disconnected. Check to ensure you camera is live in XProtect and
![[Pasted image 20241203164908.png]]
This message needs to be dismissed before you can stream again.
![[Pasted image 20241203165735.png]]
#### Excellent connection - No video
![[Pasted image 20241203165948.png]]
In this case the stream might have been running before **YouTube** was ready, in this case `Manual Stop/Pause` the press `Manual Start` to restart. This will reinitiate the connection with YouTube and bring this back online.
#### DVR Playback
When setting up a stream in **YouTube** the option `Enable DVR` is ticked as default. This provides playback of your live stream. **YouTube** allows live streams to be archived for a maximum duration of 12 hours.
>[!warning]
>If the camera covers a public area people may miss use the
![[Pasted image 20241204101105.png]]
#### Latency
In this example an **IP camera** is streaming to **Milestone XProtect**. A video stream is taken to the **Streaming Engine** then transmitted to a **Video Distribution Platform** (i.e. YouTube) generally with an internet connection. The **Video Distribution Platform** processed the video allowing a video stream to be send to web browsers, mobile devices in different formats and video resolutions.
Each element of this process adds latency, connection between servers and the internet connection quality will all add latency.
For **RTMP** expected latency from the IP Camera to an online video stream is likely to be 5-7 seconds behind live.
#### Time Limits
There isn't an official time constraint for a YouTube live stream.
We have an example here that ran for over 16 hours and other examples that have run for much longer than this.
![[Pasted image 20241204101319.png]]
This example started streaming live on **YouTube** on the **25th September 2018**.
[🔴 Venice Italy Live Webcam - Dorsoduro in Live Streaming from Hotel American Dinesen - Full HD](https://www.youtube.com/watch?v=JqUREqYduHw)
<video src="https://www.youtube.com/watch?v=JqUREqYduHw" name="# Venice Italy Live Webcam" height="592" width="100%" poster="files/_volcan.jpg" autoplay"" controls=""></video>