Skip to content

RTMP to HTTP-HLS/HTTP-TS

Introduction to HTTP-HLS

HTTP-HLS (HTTP Live Streaming) is an adaptive streaming protocol proposed by Apple, widely used for video live streaming and on-demand streaming. Its core idea is to split the video stream into short-duration TS file segments (Transport Stream) and transmit them via the HTTP protocol. The client dynamically selects different bitrate segments by downloading an M3U8 playlist (a text-based index file), achieving network adaptation and smooth playback.

Configuration

  1. First, you need to enable the HTTP service in the mms.yaml file. Please refer to the Pull Source configuration instructions.

  2. Next, you also need to enable the conversion from RTMP to HLS and configure segmenting in the streaming domain configuration:

yaml
type: publish
name: test.publish.com
apps:
  - name: app                     # Access point name
    hls:                          # Segmenting configuration
      ts_min_seg_dur: 2000        # 2000ms, default 2000ms, unit: ms
      ts_max_seg_dur: 6000        # 6000ms must be segmented, default 6000ms, unit: ms
      ts_max_bytes: 2m            # Maximum 2MB, default 2MB, units supported: k/m
      min_ts_count_for_m3u8: 3    # Output M3U8 with 3 segments, default 3
    bridge:                       # Protocol conversion configuration
      no_players_timeout_ms: 10s  # Time without players before ending protocol conversion
      rtmp:
        to_flv: on                # Enable RTMP to FLV conversion
        to_hls: on                # Enable RTMP to HLS conversion

play

use

ffplay http://test.play.com/app/test/.m3u8
ffplay http://test.play.com/app/test/.ts

Released under the MIT License.