Skip to content


jeanlf edited this page Dec 18, 2019 · 13 revisions

HOME » Filters » RTSP Server

RTSP Server

Register name used to load filter: rtspout

The RTSP server partially implements RTSP 1.0, with support for OPTIONS, DESCRIBE, SETUP, PLAY, PAUSE and TEARDOWN.
Multiple PLAY ranges are not supported, PLAY range end is not supported, PAUSE range is not supported.
Only aggregated control is supported for PLAY and PAUSE, PAUSE/PLAY on single stream is not supported.
The server only runs on TCP, and handles request in sequence (will not probe for commands until previous response was sent).
The server supports both RTP over UDP delivery and RTP interleaved over RTSP delivery.

The filter can work as a simple output filter by specifying the dst option:

gpac -i source -o rtsp://myip/sessionname


gpac -i source dst=rtsp://myip/sessionname

In this mode, only one session is possible. It is possible to loop the input source(s).

The filter can work as a regular RTSP server by specifying the mounts option to indicate paths of media file to be served:

gpac rtspout:mounts=mydir1,mydir2

In server mode, it is possible to load any source supported by gpac by setting the option dynurl.
The expected syntax of the dynamic RTSP URLs is rtsp://servername/?URL1[&URLN] or rtsp://servername/@URL1[@URLN]
Each URL can be absolute or local, in which case it is resolved against the mount point(s).

gpac -i rtsp://localhost/?pipe://mynamepipe&myfile.mp4 [dst filters]

The server will resolve this URL in a new session containing streams from myfile.mp4 and streams from pipe mynamepipe.
When setting runfor in server mode, the server will exit at the end of the last session being closed.

In both modes, clients can setup multicast if the mcast option is on or mirror.
When mcast is set to mirror mode, any DESCRIBE command on a resource already delivered through a multicast session will use that multicast.
Consequently, only DESCRIBE methods are processed for such sessions, other methods will return Unauthorized.

The scheduling algorithm and RTP options are the same as the RTP output filter, see gpac -h rtpout


dst (string): location of destination file - see filter help
port (unsigned int, default: 554): server port
firstport (unsigned int, default: 6000): port for first stream in session
mtu (unsigned int, default: 1460): size of RTP MTU in bytes
ttl (unsigned int, default: 0): time-to-live for muticast packets. A value of 0 uses client requested TTL, or 1
ifce (string): default network inteface to use
payt (unsigned int, default: 96, minmax: 96-127): payload type to use for dynamic configs.
mpeg4 (boolean, default: false): send all streams using MPEG-4 generic payload format if posible
delay (int, default: 0): send delay for packet (negative means send earlier)
tt (unsigned int, default: 1000): time tolerance in microseconds. Whenever schedule time minus realtime is below this value, the packet is sent right away
runfor (int, default: -1): run the session for the given time in ms. Negative value means run for ever (if loop) or source duration, 0 only outputs the sdp
tso (int, default: -1): set timestamp offset in microsecs. Negative value means random initial timestamp
xps (boolean, default: false): force parameter set injection at each SAP. If not set, only inject if different from SDP ones
latm (boolean, default: false): use latm for AAC payload format
mounts (string list): list of directories to expose in server mode
block_size (unsigned int, default: 10000): block size used to read TCP socket
maxc (unsigned int, default: 100): maximum number of connections
user_agent (string, default: $GUA): user agent string, by default solved from GPAC preferences
close (boolean, default: true): close RTSP connection after each request, except when RTP over RTSP is used
loop (boolean, default: true): loop all streams in session (not always possible depending on source type) - see filter help.
dynurl (boolean, default: false): allow dynamic service assembly - see filter help.
mcast (enum, default: off): control multicast setup of a session.

  • off: clients are never allowed to create a multicast
  • on: clients can create multicast sessions
  • mirror: clients can create a multicast session. Any later request to the same URL will use that multicast session

HOME » Filters

GPAC Configuration

Configuration File
Global Options

Filters Overview

General Filters Concepts
gpac General Usage
Built-in Properties

Filters Help

Inspect packets (inspect)
Probe source (probe)
Compositor (compositor)
ISOBMFF/QT demuxer (mp4dmx)
MPEG-4 BIFS decoder (bifsdec)
MPEG-4 OD decoder (odfdec)
File input (fin)
BT/XMT/X3D loader (btplay)
HTTP input (httpin)
SVG loader (svgplay)
JPG/J2K/PNG/BMP reframer (rfimg)
PNG/JPG decoder (imgdec)
ADTS reframer (rfadts)
LATM reframer (rflatm)
MP3 reframer (rfmp3)
FAAD decoder (faad)
MAD decoder (maddec)
XVid decoder (xviddec)
OpenJPEG2000 decoder (j2kdec)
AC3 reframer (rfac3)
A52 decoder (a52dec)
AMR/EVRC reframer (rfamr)
OGG demuxer (oggdmx)
Vorbis decoder (vorbisdec)
Theora decoder (theoradec)
MPEG-2 TS demuxer (m2tsdmx)
UDP/TCP input (sockin)
OpenSVC decoder (osvcdec)
VideoToolBox decoder (vtbdec)
MPEG-4 LASeR decoder (lsrdec)
SAF demuxer (safdmx)
MPEG-DASH and HLS client (dashin)
CENC decryptor (cdcrypt)
CENC encryptor (cecrypt)
ISOBMFF/QT muxer (mp4mx)
QCP reframer (rfqcp)
H263 reframer (rfh263)
M1V/M2V/M4V reframer (rfmpgvid)
NHNT reader (nhntr)
NHML parser (nhmlr)
AVC/HEVC reframer (rfnalu)
MPEG PS demuxer (m2psdmx)
AVI demuxer (avidmx)
Subtitle loader (txtin)
TTXT/TX3G decoder (ttxtdec)
WebVTT decoder (vttdec)
RTP/RTSP/SDP input (rtpin)
File output (fout)
Raw AAC to LATM writer (uflatm)
ADTS writer (ufadts)
Media Reframer (reframer)
Stream to file (writegen)
AVC/HEVC to AnnexB writer (ufnalu)
QCP writer (writeqcp)
WebVTT writer (writevtt)
NHNT writer (nhntw)
NHML writer (nhmlw)
VobSub demuxer (vobsubdmx)
AVI muxer (avimx)
Audio output (aout)
M4V writer (ufm4v)
Audio resampler (resample)
Video output (vout)
Video crop (vcrop)
Video flip (vflip)
RAW video reframer (rfrawvid)
PCM reframer (rfpcm)
JPG encoder (jpgenc)
PNG encoder (pngenc)
Audio/Video rewinder (rewind)
Sources concatenator (flist)
MPEG-2 TS muxer (m2tsmx)
DASH and HLS segmenter (dasher)
HEVC tile aggregator (tileagg)
pipe input (pin)
pipe output (pout)
GSF Muxer (gsfmx)
GSF Demuxer (gsfdmx)
UDP/TCP output (sockout)
AV1/IVF/VP9 reframer (rfav1)
IVF/OBU/annexB writer (ufobu)
ATSC input (atscin)
RTP Streamer (rtpout)
RTSP Server (rtspout)
HTTP Server (httpout)
HEVC tile spliter (hevcsplit)
HEVC Tile merger (hevcmerge)
FLAC reframer (rfflac)
ProRes reframer (rfprores)
MPEG Transport Stream splitter (tssplit)
FFMPEG demuxer (ffdmx)
FFMPEG decoder (ffdec)
FFMPEG AV Capture (ffavin)
FFMPEG video rescaler (ffsws)
FFMPEG encoder (ffenc)
FFMPEG muxer (ffmx)
FFMPEG AVFilter (ffavf)
JavaScript filter (jsf)
OpenHEVC decoder (ohevcdec)

Clone this wiki locally
You can’t perform that action at this time.