• Home
  • Cloud VPS
    • Hong Kong VPS
    • US VPS
  • Dedicated Servers
    • Hong Kong Servers
    • US Servers
    • Singapore Servers
    • Japan Servers
  • Company
    • Contact Us
    • Blog
logo logo
  • Home
  • Cloud VPS
    • Hong Kong VPS
    • US VPS
  • Dedicated Servers
    • Hong Kong Servers
    • US Servers
    • Singapore Servers
    • Japan Servers
  • Company
    • Contact Us
    • Blog
ENEN
  • 简体简体
  • 繁體繁體
Client Area

Hong Kong VPS for Live Streaming: RTMP Server Setup and Low-Latency Delivery to China (2026)

April 22, 2026

A Hong Kong VPS configured as a live streaming server provides the lowest possible latency origin point for delivering live content to mainland Chinese and Asia-Pacific viewers. With CN2 GIA routing, stream ingest from Chinese streamers achieves sub-30 ms round-trip time, while CDN distribution from the Hong Kong origin reaches global audiences efficiently.

This guide sets up a complete live streaming stack: Nginx with the RTMP module for stream ingest, FFmpeg for multi-quality transcoding, HLS output for broad device compatibility, and integration with Cloudflare or BunnyCDN for global distribution.


Architecture Overview

Streamer (OBS/encoder)
        │ RTMP push
        ▼
Hong Kong VPS (Nginx-RTMP)
        │ FFmpeg transcode
        ▼
HLS segments (1080p / 720p / 480p)
        │ CDN pull
        ▼
Cloudflare / BunnyCDN edge
        │ HTTP delivery
        ▼
Viewers (web, mobile, smart TV)

Step 1: Install Nginx with RTMP Module

apt update && apt upgrade -y
apt install -y nginx libnginx-mod-rtmp ffmpeg

Verify the RTMP module is loaded:

nginx -V 2>&1 | grep rtmp

Step 2: Configure Nginx RTMP and HLS

nano /etc/nginx/nginx.conf

Add the RTMP block at the end of the file (outside the http {} block):

rtmp {
    server {
        listen 1935;
        chunk_size 4096;
        allow publish all;
        allow play all;

        application live {
            live on;
            record off;

            # Stream key authentication
            # on_publish http://127.0.0.1:8080/auth;

            # HLS output
            hls on;
            hls_path /var/www/hls;
            hls_fragment 2s;
            hls_playlist_length 10s;
            hls_cleanup on;

            # Multi-quality transcoding via FFmpeg
            exec ffmpeg -i rtmp://localhost/live/$name
                -c:v libx264 -preset veryfast -tune zerolatency
                -c:a aac -ar 44100
                # 1080p
                -vf scale=-2:1080 -b:v 4500k -maxrate 4500k -bufsize 9000k
                -hls_time 2 -hls_list_size 5
                -hls_segment_filename /var/www/hls/${name}_1080p_%03d.ts
                /var/www/hls/${name}_1080p.m3u8
                # 720p
                -vf scale=-2:720 -b:v 2500k -maxrate 2500k -bufsize 5000k
                -hls_time 2 -hls_list_size 5
                -hls_segment_filename /var/www/hls/${name}_720p_%03d.ts
                /var/www/hls/${name}_720p.m3u8
                # 480p
                -vf scale=-2:480 -b:v 1000k -maxrate 1000k -bufsize 2000k
                -hls_time 2 -hls_list_size 5
                -hls_segment_filename /var/www/hls/${name}_480p_%03d.ts
                /var/www/hls/${name}_480p.m3u8 2>>/var/log/ffmpeg-$name.log &
        }
    }
}

Add HLS serving to the HTTP block:

server {
    listen 8080;
    server_name YOUR_VPS_IP;

    location /hls {
        types {
            application/vnd.apple.mpegurl m3u8;
            video/mp2t ts;
        }
        root /var/www;
        add_header Cache-Control no-cache;
        add_header Access-Control-Allow-Origin *;
    }

    location /stat {
        rtmp_stat all;
        rtmp_stat_stylesheet stat.xsl;
    }
}

Create HLS directory and set permissions

mkdir -p /var/www/hls
chown -R www-data:www-data /var/www/hls
nginx -t && systemctl reload nginx

Step 3: Configure OBS Studio for RTMP Push

In OBS Studio → Settings → Stream:

  • Service: Custom
  • Server: rtmp://YOUR_VPS_IP/live
  • Stream Key: mystream (any name — this becomes the stream identifier)

Start streaming. Your stream will be accessible at:

http://YOUR_VPS_IP:8080/hls/mystream_1080p.m3u8
http://YOUR_VPS_IP:8080/hls/mystream_720p.m3u8
http://YOUR_VPS_IP:8080/hls/mystream_480p.m3u8

Step 4: Create an Adaptive Bitrate Master Playlist

Create a master playlist that lets players automatically select the appropriate quality:

cat > /var/www/hls/mystream.m3u8 << 'EOF'
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-STREAM-INF:BANDWIDTH=4500000,RESOLUTION=1920x1080
mystream_1080p.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=2500000,RESOLUTION=1280x720
mystream_720p.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=1000000,RESOLUTION=854x480
mystream_480p.m3u8
EOF

This is better generated dynamically by your application — update it when streams start/stop.


Step 5: Implement Stream Key Authentication

Without authentication, anyone can push a stream to your RTMP server. Add a simple Node.js authentication endpoint:

nano /home/deploy/stream-auth.js
const http = require('http');
const url = require('url');

const VALID_KEYS = {
  'secret_key_channel1': 'channel1',
  'secret_key_channel2': 'channel2'
};

const server = http.createServer((req, res) => {
  if (req.method === 'POST' && req.url.startsWith('/auth')) {
    let body = '';
    req.on('data', chunk => body += chunk);
    req.on('end', () => {
      const params = new URLSearchParams(body);
      const key = params.get('name');

      if (VALID_KEYS[key]) {
        res.writeHead(200);
        res.end('OK');
      } else {
        res.writeHead(401);
        res.end('Unauthorized');
      }
    });
  } else {
    res.writeHead(404);
    res.end();
  }
});

server.listen(8080, '127.0.0.1');
console.log('Stream auth server running on port 8080');
pm2 start /home/deploy/stream-auth.js --name stream-auth

Uncomment the on_publish line in the Nginx RTMP config and reload Nginx.


Step 6: CDN Integration for Global Distribution

BunnyCDN (recommended for cost)

  1. Create a Pull Zone in BunnyCDN pointing to http://YOUR_VPS_IP:8080
  2. Set cache rules: HLS .ts segments cache for 60 seconds; .m3u8 playlists cache for 2 seconds (or no-cache)
  3. Point your streaming subdomain (e.g. stream.yourdomain.com) to the BunnyCDN pull zone hostname

Viewers access: https://stream.yourdomain.com/hls/mystream.m3u8

Cloudflare (free tier)

Add your VPS as the origin, proxy the streaming subdomain through Cloudflare. Configure Page Rules to set Cache Level: Bypass for *.m3u8 files (playlists must not be cached) and Cache Everything for *.ts files (segments can be cached at edge).


Recommended VPS Specs for Streaming

Concurrent StreamsQualityRecommended vCPURAMBandwidth
1–2Up to 1080p, 3 qualities4 vCPU4 GB100 Mbps
3–5Up to 1080p, 3 qualities8 vCPU8 GB500 Mbps
10+Mixed qualityDedicated server16+ GB1 Gbps

FFmpeg transcoding is CPU-intensive — each 1080p → 3-quality transcode job uses approximately 1.5–2 vCPUs continuously. Scale vCPU count with concurrent stream count.


Conclusion

A Hong Kong VPS live streaming server with Nginx-RTMP and FFmpeg transcoding delivers a complete ingest-to-CDN streaming pipeline for content creators and platforms targeting Asian audiences. CN2 GIA routing ensures streamers in mainland China can push their streams with minimal latency, while CDN distribution delivers HLS output globally.

Scale your streaming infrastructure on Server.HK’s Hong Kong VPS and dedicated server plans — high-bandwidth uplinks and NVMe SSD storage optimised for media workloads.


Frequently Asked Questions

What bitrate should I use for live streaming to Chinese mobile users?

Chinese mobile users are predominantly on 4G/5G networks. A 720p stream at 2.5 Mbps provides excellent quality for most mobile viewers. Always offer adaptive bitrate (multiple quality levels) so viewers on slower connections automatically receive the 480p or lower quality stream without buffering.

Can I use OBS with an RTMP server on Hong Kong VPS for streaming to Chinese platforms?

Yes. Your Hong Kong VPS RTMP server can simultaneously re-stream to Chinese platforms (Bilibili, Douyu, Huya) using FFmpeg’s output capabilities. Add RTMP push targets in the exec block to forward the ingest stream to platform RTMP endpoints. This enables a single OBS stream to reach multiple Chinese platforms simultaneously.

How much bandwidth does a live streaming server consume?

A single 1080p/720p/480p multi-quality stream consumes approximately 8 Mbps inbound (from streamer) and 8 Mbps × number of direct viewers outbound. With CDN integration, your VPS bandwidth is primarily the CDN pull bandwidth — typically 1–3 Mbps per CDN PoP pulling segments, regardless of viewer count.

Leave a Reply

You must be logged in to post a comment.

Recent Posts

  • Hong Kong VPS for Live Streaming: RTMP Server Setup and Low-Latency Delivery to China (2026)
  • How to Set Up a Mail Server on Hong Kong VPS: Postfix, Dovecot, and Email Deliverability (2026)
  • How to Run a SaaS Product on Hong Kong VPS: Architecture and Deployment Guide 2026
  • Hong Kong VPS Uptime and SLA: What 99.9% Uptime Really Means for Your Business (2026)
  • Cryptocurrency and USDT Payment for VPS Hosting: Why It Matters for Global Businesses (2026)

Recent Comments

  1. Hong Kong VPS Uptime and SLA: What 99.9% Uptime Really Means for Your Business (2026) - Server.HK on How to Monitor Your Hong Kong VPS: Uptime, Performance, and Alert Setup Guide (2026)
  2. Best Hong Kong VPS Providers in 2026: Compared by Speed, Routing, and Value - Server.HK on How to Migrate Your Website to a Hong Kong VPS: Zero-Downtime Transfer Guide (2026)
  3. vibramycin injection on How to Choose the Right Hong Kong VPS Plan: A Buyer’s Guide for 2026
  4. allopurinol for gout on CN2 GIA vs BGP vs CN2 GT: What’s the Real Difference for China Connectivity?
  5. antibiotics online purchase on How to Set Up a WordPress Site on a Hong Kong VPS with aaPanel (Step-by-Step 2026)

Knowledge Base

Access detailed guides, tutorials, and resources.

Live Chat

Get instant help 24/7 from our support team.

Send Ticket

Our team typically responds within 10 minutes.

logo
Alipay Cc-paypal Cc-stripe Cc-visa Cc-mastercard Bitcoin
Cloud VPS
  • Hong Kong VPS
  • US VPS
Dedicated Servers
  • Hong Kong Servers
  • US Servers
  • Singapore Servers
  • Japan Servers
More
  • Contact Us
  • Blog
  • Legal
© 2026 Server.HK | Hosting Limited, Hong Kong | Company Registration No. 77008912
Telegram
Telegram @ServerHKBot