Skip to main content

SRS Server - How to Stream YouTube Using a Web Browser

· 2 min read

Written by Winlin and GPT4

While Open Broadcaster Software (OBS) is a widely used solution for live-streaming to YouTube via RTMP or RTMPS, there is an alternative approach that leverages a web browser.

This method involves streaming your camera using WebRTC within a webpage, then employing Simple Realtime Server (SRS) to convert WebRTC to RTMP, and using FFmpeg to publish the RTMP stream to YouTube. For those who prefer RTMPS, FFmpeg can be utilized to extract the stream from SRS via RTMP, transcode it to RTMPS, and subsequently publish it to YouTube.

Step 1: Setting Up SRS​

First, obtain SRS by cloning it from the GitHub repository:

git clone

Then, compile SRS by executing:

./configure && make

Lastly, launch SRS with the command:

./objs/srs -c conf/rtc2rtmp.conf

To confirm the successful installation, access http://localhost:8080 in your web browser.

Step 2: Streaming WebRTC to SRS​

Open the webpage http://localhost:8080/players/whip.html to transmit your camera stream to SRS via WebRTC.

To preview the RTMP stream, utilize VLC to play rtmp://localhost/live/livestream.

Step 3: Routing RTMP to YouTube​

Access the YouTube live-streaming dashboard at

Acquire the stream server (e.g., rtmp:// and stream key (e.g., 9xxx-8yyy-3zzz-3iii-7jjj).

Use FFmpeg to extract the RTMP stream from SRS and forward it to YouTube with this command:

ffmpeg -i rtmp://localhost/live/livestream -c copy \
-f flv rtmp://

Step 4: Routing RTMPS to YouTube​

To transmit the stream via RTMPS, modify the RTMP URL from rtmp:// to the RTMPS URL, such as rtmps://

ffmpeg -i rtmp://localhost/live/livestream -c copy \
-f flv rtmps://


By adhering to these instructions, you can effectively live stream to YouTube via RTMP or RTMPS using a web browser. This technique offers a practical alternative to OBS, enabling you to harness the power of WebRTC, SRS, and FFmpeg for a smooth and efficient streaming experience.