Skip to content

migrate_v5_EN_delivery http flv

winlin edited this page Jul 31, 2022 · 1 revision

HOME > EN > HTTP FLV

Delivery HTTP Flv Stream

HTTP FLV Live Stream

SRS supports remux the rtmp stream to http flv stream, when publish rtmp stream on SRS, SRS will mount a http flv url and when user access the flv url, SRS will remux the rtmp stream to user.

The config to delivery HTTP flv live stream:

http_server {
    enabled         on;
    listen          8080;
}
vhost __defaultVhost__ {
    http_remux {
        enabled     on;
        mount       [vhost]/[app]/[stream].flv;
    }
}

@remark For more information about config, read following detail config.

HTTPS FLV Live Stream

SRS supports remux the rtmp stream to https flv stream, when publish rtmp stream on SRS, SRS will mount a https flv url and when user access the flv url, SRS will remux the rtmp stream to user.

The config to delivery HTTPS flv live stream:

http_server {
    enabled         on;
    listen          8080;
    https {
        enabled on;
        listen 8088;
        key ./conf/server.key;
        cert ./conf/server.crt;
    }
}
vhost __defaultVhost__ {
    http_remux {
        enabled     on;
        mount       [vhost]/[app]/[stream].flv;
    }
}

Remark: Please use your HTTPS key and cert file.

Note: To enable the HTTPS API, please read HTTPS API

@remark For more information about config, read following detail config.

HTTP and HTTPS Proxy

SRS works very well with HTTP/HTTPS proxy, like Nginx, HTTPX, CaddyServer, etc. Please read #2881 for details.

HTTP TS Live Stream

SRS supports remux the rtmp stream to http ts stream, when publish rtmp stream on SRS, SRS will mount a http ts url and when user access the ts url, SRS will remux the rtmp stream to user.

The config to delivery HTTP ts live stream:

http_server {
    enabled         on;
    listen          8080;
}
vhost __defaultVhost__ {
    http_remux {
        enabled     on;
        mount       [vhost]/[app]/[stream].ts;
    }
}

@remark For more information about config, read following detail config.

HTTP Mp3 Live Stream

SRS support remux the rtmp stream to http mp3 stream, drop video and mount mp3 http url, SRS will delivery mp3 stream when user access it.

The config to delivery HTTP mp3 live stream:

http_server {
    enabled         on;
    listen          8080;
}
vhost __defaultVhost__ {
    http_remux {
        enabled     on;
        fast_cache  30;
        mount       [vhost]/[app]/[stream].mp3;
    }
}

@remark For more information about config, read following detail config.

HTTP Aac Live Stream

SRS support remux the rtmp stream to http aac stream, drop video and mount aac http url, SRS will delivery aac stream when user access it.

The config to delivery HTTP ac live stream:

http_server {
    enabled         on;
    listen          8080;
}
vhost __defaultVhost__ {
    http_remux {
        enabled     on;
        fast_cache  30;
        mount       [vhost]/[app]/[stream].aac;
    }
}

@remark For more information about config, read following detail config.

HTTP Live Stream Config

The config for HTTP Flv/Mp3/Aac Live Stream, use different extension to apply different stream:

http_server {
    # whether http streaming service is enabled.
    # default: off
    enabled         on;
    # the http streaming listen entry is <[ip:]port>
    # for example, 192.168.1.100:8080
    # where the ip is optional, default to 0.0.0.0, that is 8080 equals to 0.0.0.0:8080
    # @remark, if use lower port, for instance 80, user must start srs by root.
    # default: 8080
    listen          8080;
    # For https_server or HTTPS Streaming.
    https {
        # Whether enable HTTPS Streaming.
        # default: off
        enabled on;
        # The listen endpoint for HTTPS Streaming.
        # default: 8088
        listen 8088;
        # The SSL private key file, generated by:
        #       openssl genrsa -out server.key 2048
        # default: ./conf/server.key
        key ./conf/server.key;
        # The SSL public cert file, generated by:
        #       openssl req -new -x509 -key server.key -out server.crt -days 3650 -subj "/C=CN/ST=Beijing/L=Beijing/O=Me/OU=Me/CN=ossrs.net"
        # default: ./conf/server.crt
        cert ./conf/server.crt;
    }
}
vhost __defaultVhost__ {
    # http flv/mp3/aac/ts stream vhost specified config
    http_remux {
        # whether enable the http live streaming service for vhost.
        # default: off
        enabled     on;
        # the fast cache for audio stream(mp3/aac),
        # to cache more audio and send to client in a time to make android(weixin) happy.
        # @remark the flv/ts stream ignore it
        # @remark 0 to disable fast cache for http audio stream.
        # default: 0
        fast_cache  30;
        # the stream mout for rtmp to remux to live streaming.
        # typical mount to [vhost]/[app]/[stream].flv
        # the variables:
        #       [vhost] current vhost for http live stream.
        #       [app] current app for http live stream.
        #       [stream] current stream for http live stream.
        # @remark the [vhost] is optional, used to mount at specified vhost.
        # the extension:
        #       .flv mount http live flv stream, use default gop cache.
        #       .ts mount http live ts stream, use default gop cache.
        #       .mp3 mount http live mp3 stream, ignore video and audio mp3 codec required.
        #       .aac mount http live aac stream, ignore video and audio aac codec required.
        # for example:
        #       mount to [vhost]/[app]/[stream].flv
        #           access by http://ossrs.net:8080/live/livestream.flv
        #       mount to /[app]/[stream].flv
        #           access by http://ossrs.net:8080/live/livestream.flv
        #           or by http://192.168.1.173:8080/live/livestream.flv
        #       mount to [vhost]/[app]/[stream].mp3
        #           access by http://ossrs.net:8080/live/livestream.mp3
        #       mount to [vhost]/[app]/[stream].aac
        #           access by http://ossrs.net:8080/live/livestream.aac
        #       mount to [vhost]/[app]/[stream].ts
        #           access by http://ossrs.net:8080/live/livestream.ts
        # @remark the port of http is specified by http_server section.
        # default: [vhost]/[app]/[stream].flv
        mount       [vhost]/[app]/[stream].flv;
    }
}

Remark: Use forward+vhost to support multiple http live stream for a stream.

Remark: The http server config section, read HTTP Server

About HTTP FLV

This section descrbes the HTTP FLV live streaming.

How to use multiple process for HTTP FLV? You can use HTTP reverse proxy, and SRS start the go-sharp project, which can proxy in load balance mode and detect the status of SRS. For go-sharp, read go-sharp

What is HTTP FLV

All http streaming is a http flv url, for instance http://ossrs.net:8081/live/livestream.flv, but the delivery methods maybe different:

  1. FLV file, HTTP progressiv streaming. User can download and play the file which is serve by nginx, but user cannot seek to the part that not downloaded.
  2. FLV pseudo streaming. This is the common used HTTP FLV streaming, to support to seek to the part which is not download, the server must accept a param, for instance .flv?start= to specifies the start time to play. This is HTTP FLV pseudo stream, but it's vod not live streaming.
  3. FLV live streaming. The HTTP FLV streaming of SRS, is absolute live streaming, which is similar to RTMP for cluster, low latency, fault-backup and gop cache. And the HTTP FLV also similar to HTTP which can traverse firewall, HTTP 302 and simple. Because of SRS implements the HTTP and RTMP protocol, SRS remux the HTTP FLV stream on the edge server, and still use RTMP in cluster inside. The server which implements the RTMP and HTTP, only SRS and nginx-rtmp, but nginx-rtmp does not support HTTP FLV.

In a word, the HTTP FLV of SRS is enhanced RTMP, absolute realtime media streaming delivery.

Confuse HTTP FLV

The HTTP FLV of SRS is not:

  1. RTMPT: The rtmpt is similar to HTTP FLV of SRS, but rtmpt is rtmp over HTTP, not FLV over HTTP.
  2. HDL/HFL: There exists another HXX stream, the latence maybe different, for SRS use RTMP to delivery HTTP FLV.
  3. HDS: Absolutely not HTTP FLV, HDS is similar to HLS.

Why HTTP FLV

Why SRS supports HTTP FLV?

  1. The internet realtime live streaming, generally use RTMP for low latence, while HTTP FLV latency equals to RTMP.
  2. Firewall traverse: Many firewall may block RTMP, but never HTTP.
  3. For GSLB: The HTTP FLV can support HTTP 302, to help GSLB to correct the stupid DNS problem.
  4. Fault tolerance: The HTTP FLV of SRS similar to RTMP, support mulitple origin and fault backup.
  5. Common Protocol: The HTTP FLV is ok for flash and other player.
  6. Simple: FLV is the most simple media stream fomat, HTTP is the standard protocol of internet, they make thinks simple.

Sample

The config sample, read https://github.com/ossrs/srs/issues/293#issuecomment-70449126

To config HTTP FLV, read Sample

Websocket FLV

After transmuxing HTTP-FLV to WebSocket-FLV, we could use MSE(flv.js), please read videojs-flow.

About transmuxing HTTP to WebSocket, please read mse.go.

HTTP FLV VOD Stream

About the HTTP flv vod stream, read v5_EN_FlvVodStream

Winlin 2015.1

Welcome to SRS wiki!

SRS 5.0 wiki

Please select your language:

SRS 4.0 wiki

Please select your language:

SRS 3.0 wiki

Please select your language:

SRS 2.0 wiki

Please select your language:

SRS 1.0 wiki

Please select your language:

Clone this wiki locally