RTMP to RTSP
Introduction to RTSP
RTSP (Real-Time Streaming Protocol) is an application-layer protocol used for controlling the transmission of real-time media streams. It is primarily used in scenarios such as video surveillance, video conferencing, and IPTV. Its core functions include controlling media stream playback, pause, and recording, while the actual audio and video data are typically transmitted through RTP/RTCP protocols.
Note
Currently, RTSP only supports RTP over TCP and does not support RTP over UDP.
Configuration
- First, you need to enable the RTSP service in the
mms.yaml
file:
yaml
rtsp:
enabled: on
port: 554
- Next, you also need to enable the conversion from RTMP to RTSP 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
to_rtsp: on # Enable RTMP to RTSP conversion
Playback
You can use ffplay to play the stream:(rtsp only support rtp over tcp now)
shell
ffplay -rtsp_transport tcp rtsp://test.play.com:554/app/test