Skip to content


jeanlf edited this page Dec 18, 2019 · 1 revision

HOME » Filters » HTTP Server

HTTP Server

Register name used to load filter: httpout

The HTTP output filter can act as:

  • a simple HTTP server
  • an HTTP server sink
  • an HTTP server file sink
  • an HTTP client sink
  • an HTTP server source

The server currently handles GET, HEAD, PUT, POST, DELETE methods.
Single or multiple byte ranges are supported for both GET and PUT/POST methods.

  • for GET, the resulting body is a single-part body formed by the concatenated byte ranges as requested (no overlap checking).
  • for PUT/POST, the received data is pushed to the target file according to the byte ranges specified in the client request.

When a single read directory is specified, the server root / is the content of this directory.
When multiple read directories are specified, the server root / contains the list of the mount points with their directory names.
When a write directory is specified, the upload resource name identifies a file in this directory (the write directory name is not present in the URL).

Listing can be enabled on server using dlist.
When disabled, a GET on a directory will fail.
When enabled, a GET on a directory will return a simple HTML listing of the content inspired from Apache.

Simple HTTP server

In this mode, the filter doesn't need any input connection and exposes all files in the directories given by rdirs.
PUT and POST methods are only supported if a write directory is specified by wdir option.

gpac httpout:rdirs=outcoming

This sets up a read-only server.


gpac httpout:wdir=incoming

This sets up a write-only server.


gpac httpout:rdirs=outcoming:wdir=incoming:port=8080

This sets up a read-write server running on port 8080.

HTTP server sink

In this mode, the filter will forward input PIDs to connected clients, trashing the data if no client is connected unless hold is specified.
The filter doesn't use any read directory in this mode.
This mode is mostly usefull to setup live HTTP streaming of media sessions such as MP3, MPEG-2 TS or other muxed representations:

gpac -i MP3_SOURCE -o http://localhost/live.mp3 --hold

In this example, the server waits for client requests on /live.mp3 and will then push each input packet to all connected clients.
If the source is not real-time, you can inject a reframer filter performing realtime regulation.

gpac -i MP3_SOURCE reframer:rt=on @ -o http://localhost/live.mp3

In this example, the server will push each input packet to all connected clients, or trash the packet if no connected clients.

HTTP server file sink

In this mode, the filter will write input PIDs to files in the first read directory specified, acting as a file output sink.
The filter uses a read directory in this mode, which must be writable.
Upon client GET request, the server will check if the requested file matches the name of a file currently being written by the server.
If so, the server will keep refreshing the source size until the associated input file is closed.
This mode is typically used for origin server in HAS sessions where clients may request files while they are being produced (low latency DASH).

gpac -i SOURCE -o http://localhost/live.mpd --rdirs=temp

HTTP client sink

In this mode, the filter will upload input PIDs data to remote server using PUT (or POST if post is set).
This mode must be explicitly activated using hmode.
The filter uses no read or write directories in this mode.

gpac -i SOURCE -o http://targethost:8080/live.mpd:gpac:hmode=push

In this example, the filter will send PUT methods to the server running on port 8080 at targethost location (IP address or name).

HTTP server source

In this mode, the server acts as a source rather than a sink. It declares incoming PUT or POST methods as output PIDs
This mode must be explicitly activated using hmode.
The filter uses no read or write directories in this mode, and updloaded data is NOT stored by the server.

gpac httpout:hmode=source vout aout

In this example, the filter will try to play uploaded files through video and audio output.


dst (string): location of destination file - see filter help
port (unsigned int, default: 80): server port
ifce (string): default network inteface to use
rdirs (string list): list of directories to expose for read - see filter help
wdir (string): directory to expose for write - see filter help
block_size (unsigned int, default: 10000): block size used to read and write TCP socket
user_agent (string, default: $GUA): user agent string, by default solved from GPAC preferences
close (boolean, default: false): close HTTP connection after each request
maxc (unsigned int, default: 100): maximum number of connections, 0 is unlimited
maxp (unsigned int, default: 6): maximum number of connections for one peer, 0 is unlimited
cache_control (string): specify the Cache-Control string to add; none disable ETag
hold (boolean, default: false): hold packets until one client connects
hmode (enum, default: default): filter operation mode, ignored if wdir is set. See filter help for more details. Mode can be

  • default: run in server mode (see filter help)
  • push: run in client mode using PUT or POST (see filter help)
  • source: use server as source filter on incoming PUT/POST

timeout (unsigned int, default: 30): timeout in seconds for persistent connections; 0 disable timeout
ext (string): set extension for graph resolution, regardless of file extension
mime (string): set mime type for graph resolution
quit (boolean, default: false): exit server once all input PIDs are done and client disconnects (for test purposes)
post (boolean, default: false): use POST instead of PUT for uploading files
dlist (boolean, default: false): enable HTML listing for GET requests on directories

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.