Skip to content

Enabling HLS Playback from RTMP

RTMP Streaming · Self-help guide

RTMP is excellent for sending video into your server, but HLS is usually better for viewers. HLS creates a playlist file and short video segments that can be played by many web players, mobile browsers and apps. This makes your Ubuntu streaming server much more useful for public websites.

Step 1: Create a folder for HLS output: sudo mkdir -p /var/www/html/hls

Step 2: Give Nginx permission to write to it: sudo chown -R www-data:www-data /var/www/html/hls

Step 3: Edit your RTMP application and enable HLS: application live { live on; hls on; hls_path /var/www/html/hls; hls_fragment 3; hls_playlist_length 12; }

Step 4: Test the Nginx configuration: sudo nginx -t

Step 5: Reload Nginx: sudo systemctl reload nginx

Step 6: Start streaming from OBS to: rtmp://your-server-ip/live with a stream key such as show1.

Step 7: Open the HLS playlist in a compatible player: http://your-server-ip/hls/show1.m3u8

Step 8: Embed the HLS stream into your website using a player such as hls.js or Video.js.

Keep your HLS segment size sensible. Smaller fragments reduce delay but can increase server load. Larger fragments are more stable but add latency. For many general live streams, three to six second fragments are a good starting point. Always test on mobile data as well as Wi-Fi, because real viewers often watch from less stable connections.

Hosting tip: For Online Audience style hosting guides, remind users to test changes outside busy broadcast times, keep a backup of the last working configuration, and avoid exposing admin services publicly. A clear checklist, sensible firewall rules and careful bitrate choices will prevent most support issues before they happen.

Did this solve it?If not, Penny and the support team are ready to help.Start live chatOpen a ticket