From e2d1beba8908d8d66454b8f4b1aa70b89145fb49 Mon Sep 17 00:00:00 2001 From: jeanlf Date: Thu, 4 Jul 2024 12:13:36 +0200 Subject: [PATCH] Fixed #2 --- docs/Filters/aout.md | 2 +- docs/Filters/avgen.md | 18 +- docs/Filters/avmix.md | 964 +++++++++++++++++------------ docs/Filters/bsrw.md | 29 +- docs/Filters/bssplit.md | 41 +- docs/Filters/cdcrypt.md | 13 +- docs/Filters/compositor.md | 158 +++-- docs/Filters/core_config.md | 4 + docs/Filters/core_logs.md | 68 +- docs/Filters/core_options.md | 84 +-- docs/Filters/dasher.md | 362 +++++++---- docs/Filters/dashin.md | 141 +++-- docs/Filters/dvbin.md | 6 +- docs/Filters/evgs.md | 13 +- docs/Filters/ffavf.md | 10 +- docs/Filters/ffavin.md | 13 +- docs/Filters/ffbsf.md | 2 + docs/Filters/ffdec.md | 8 +- docs/Filters/ffenc.md | 2 + docs/Filters/ffsws.md | 15 +- docs/Filters/filters_general.md | 239 ++++--- docs/Filters/filters_properties.md | 51 +- docs/Filters/fin.md | 10 + docs/Filters/flist.md | 92 +-- docs/Filters/fout.md | 16 +- docs/Filters/ghidmx.md | 20 +- docs/Filters/glpush.md | 2 +- docs/Filters/gpac_general.md | 231 ++++--- docs/Filters/gsfmx.md | 7 +- docs/Filters/hevcmerge.md | 8 + docs/Filters/httpin.md | 15 +- docs/Filters/httpout.md | 34 +- docs/Filters/inspect.md | 142 +++-- docs/Filters/jpgenc.md | 7 +- docs/Filters/m2tsmx.md | 63 +- docs/Filters/mp4dmx.md | 72 ++- docs/Filters/mp4mx.md | 173 +++--- docs/Filters/nhmlw.md | 7 +- docs/Filters/nvdec.md | 27 +- docs/Filters/ohevcdec.md | 7 +- docs/Filters/pin.md | 8 +- docs/Filters/probe.md | 11 +- docs/Filters/reframer.md | 87 ++- docs/Filters/restamp.md | 16 +- docs/Filters/rfadts.md | 14 +- docs/Filters/rfav1.md | 7 +- docs/Filters/rfimg.md | 6 +- docs/Filters/rfnalu.md | 40 +- docs/Filters/routein.md | 39 +- docs/Filters/routeout.md | 69 ++- docs/Filters/rtpin.md | 12 +- docs/Filters/rtpout.md | 8 +- docs/Filters/rtspout.md | 16 +- docs/Filters/scte35dec.md | 5 + docs/Filters/sockin.md | 8 + docs/Filters/sockout.md | 4 + docs/Filters/thumbs.md | 26 +- docs/Filters/tilesplit.md | 6 +- docs/Filters/ttmldec.md | 9 +- docs/Filters/ttmlmerge.md | 11 + docs/Filters/ttxtdec.md | 2 + docs/Filters/txtin.md | 52 +- docs/Filters/ufadts.md | 7 +- docs/Filters/ufmhas.md | 2 +- docs/Filters/ufnalu.md | 7 +- docs/Filters/uncvg.md | 52 +- docs/Filters/unframer.md | 2 + docs/Filters/vcrop.md | 9 +- docs/Filters/vflip.md | 9 +- docs/Filters/vout.md | 30 +- docs/Filters/vtt2tx3g.md | 2 + docs/Filters/vttdec.md | 2 + docs/Filters/writegen.md | 16 +- docs/MP4Box/mp4box-dash-opts.md | 102 +-- docs/MP4Box/mp4box-dump-opts.md | 23 +- docs/MP4Box/mp4box-gen-opts.md | 112 ++-- docs/MP4Box/mp4box-import-opts.md | 107 ++-- docs/MP4Box/mp4box-meta-opts.md | 92 +-- docs/MP4Box/mp4box-other-opts.md | 30 +- docs/MP4Box/mp4box-scene-opts.md | 17 +- 80 files changed, 2599 insertions(+), 1654 deletions(-) create mode 100644 docs/Filters/ttmlmerge.md diff --git a/docs/Filters/aout.md b/docs/Filters/aout.md index 3e27748f..84b897aa 100644 --- a/docs/Filters/aout.md +++ b/docs/Filters/aout.md @@ -5,7 +5,7 @@ Register name used to load filter: __aout__ This filter may be automatically loaded during graph resolution. -This filter writes a single uncompressed audio input PID to a sound card or other audio output device. +This filter writes a single PCM (uncompressed) audio input PID to a sound card or other audio output device. The longer the audio buffering [bdur](#bdur) is, the longer the audio latency will be (pause/resume). The quality of fast forward audio playback will also be degraded when using large audio buffers. diff --git a/docs/Filters/avgen.md b/docs/Filters/avgen.md index ef512eba..583479a4 100644 --- a/docs/Filters/avgen.md +++ b/docs/Filters/avgen.md @@ -3,7 +3,7 @@ # AV Counter Generator Register name used to load filter: __avgen__ -This is a JavaScript filter, not checked during graph resolution and needs explicit loading. +This is a JavaScript filter. It is not checked during graph resolution and needs explicit loading. Author: GPAC Team This filter generates AV streams representing a counter. Streams can be enabled or disabled using [type](#type). @@ -11,7 +11,7 @@ The filter is software-based and does not use GPU. When [adjust](#adjust) is set, the first video frame is adjusted such that a full circle happens at each exact second according to the system UTC clock. By default, video UTC and date are computed at each frame generation from current clock and not from frame number. -This will result in broken timing when playing at speeds other than 1.0. +This will result in broken UTC timing text when playing at speeds other than 1.0. This can be changed using [lock](#lock). Audio beep is generated every second, with octave (2xfreq) of even beep used every 10 seconds. @@ -47,9 +47,10 @@ If multiple [views](#views) are generated, they are assigned the names `videoN_v # Options __type__ (enum, default: _av_): output selection -* a: audio only -* v: video only -* av: audio and video + +- a: audio only +- v: video only +- av: audio and video __freq__ (uint, default: _440_): frequency of beep __freq2__ (uint, default: _659_): frequency of odd beep @@ -68,9 +69,10 @@ If multiple [views](#views) are generated, they are assigned the names `videoN_v __dur__ (frac, default: _0/0_): run for the given time in second __adjust__ (bool, default: _true_): adjust start time to synchronize counter and UTC __pack__ (enum, default: _no_): packing mode for stereo views - * no: no packing - * ss: side by side packing, forces [views](#views) to 2 - * tb: top-bottom packing, forces [views](#views) to 2 + +- no: no packing +- ss: side by side packing, forces [views](#views) to 2 +- tb: top-bottom packing, forces [views](#views) to 2 __disparity__ (uint, default: _20_): disparity in pixels between left-most and right-most views __views__ (uint, default: _1_): number of views diff --git a/docs/Filters/avmix.md b/docs/Filters/avmix.md index cd373293..3c331ec6 100644 --- a/docs/Filters/avmix.md +++ b/docs/Filters/avmix.md @@ -3,19 +3,23 @@ # Audio Video Mixer Register name used to load filter: __avmix__ -This is a JavaScript filter, not checked during graph resolution and needs explicit loading. +This is a JavaScript filter. It is not checked during graph resolution and needs explicit loading. Author: GPAC team AVMix is an audio video mixer controlled by an updatable JSON playlist format. The filter can be used to: + - schedule video sequence(s) over time - mix videos together - layout of multiple videos - overlay images, text and graphics over source videos + All input streams are decoded prior to entering the mixer. + - audio streams are mixed in software - video streams are composed according to the `gpu` option - other stream types are not yet supported + OpenGL hardware acceleration can be used, but the supported feature set is currently not the same with or without GPU. @@ -31,30 +35,36 @@ This implies that there shall always be a media to compose, i.e. no "holes" in t _Note: The playlist is still refreshed in offline mode._ When operating live, the mixer will initially wait for video frames to be ready for `lwait` seconds. After this initial timeout, the output frames will indicate: + - 'No signal' if no input is available (no source frames) or no scene is defined - 'Signal lost' if no new input data has been received for `lwait` on a source + # Playlist Format ## Overview The main components in a playlist are: -* Media sources and sequences: each source is described by one or more URL to the media data, and each sequence is a set of sources to be played continuously -* Transitions: sources in a sequence can be combined using transitions -* Scenes: a scene describes one graphical object to put on screen and if and how input video are mapped on objects -* Groups: a group is a hierarchy of scenes and groups with positioning properties, and can also be used to create offscreen images reused by other elements -* Timers: a timer can be used to animate scene parameters in various fashions + +- Media sources and sequences: each source is described by one or more URL to the media data, and each sequence is a set of sources to be played continuously +- Transitions: sources in a sequence can be combined using transitions +- Scenes: a scene describes one graphical object to put on screen and if and how input video are mapped on objects +- Groups: a group is a hierarchy of scenes and groups with positioning properties, and can also be used to create offscreen images reused by other elements +- Timers: a timer can be used to animate scene parameters in various fashions + The playlist content shall be either a single JSON object or an array of JSON objects, hereafter called root objects. Root objects types can be indicated through a `type` property: -* seq: a `sequence` object -* url: a `source` object (if used as root, a default `sequence` object will be created) -* scene: a `scene` object -* group: a `group` object -* timer: a `timer` object -* script: a `script` object -* config: a `config` object -* watch: a `watcher` object -* style: a `style` object + +- seq: a `sequence` object +- url: a `source` object (if used as root, a default `sequence` object will be created) +- scene: a `scene` object +- group: a `group` object +- timer: a `timer` object +- script: a `script` object +- config: a `config` object +- watch: a `watcher` object +- style: a `style` object + Except for `style`, the `type` property of root objects is usually not needed as the parser guesses the object types from its properties. @@ -65,11 +75,13 @@ Any unrecognized property not starting with `_` will be reported as warning. ## Colors Colors are handled as strings, formatted as: + - the DOM color name (see `gpac -h colors`) - HTML codes `$RRGGBB` or `#RRGGBB` - RGB hex vales `0xRRGGBB` - RGBA hex values `0xAARRGGBB` - the color `none` is `0x00000000`, its signification depends on the object using it. + If JS code needs to manipulate colors, use sys.color_lerp and sys.color_component functions. @@ -82,37 +94,43 @@ The `JSFun` arguments and return value are dependent on the parent object type. The parent object is exposed as `this` in `JSFun` and can be used to store context information for the JS code. The code can use the global functions and modules defined, especially: -* sys: GPAC system module -* evg: GPAC EVG module -* os: QuickJS OS module -* video_playing: video playing state -* audio_playing: audio playing state -* video_time: output video time -* video_timescale: output video timescale -* video_width: output video width -* video_height: output video height -* audio_time: output audio time -* audio_timescale: output audio timescale -* samplerate: output audio samplerate -* channels: output audio channels -* current_utc_clock: current UTC clock in ms -* get_media_time: gets media time of output (no argument) or of source with id matching the first argument. Return - * -4: not found - * -3: not playing - * -2: in prefetch - * -1: timing not yet known - * value: media time in seconds (float) -* resolve_url: resolves URL given in first argument against media playlist URL and returns the resolved url (string) -* get_scene(id): gets scene with given ID -* get_group(id): gets group with given ID -* mouse_over(evt): returns scene under mouse described by a GPAC event, or null if no scene (picking for scenes with perspective projection is not supported) -* mouse_over(x, y): returns scene under coordinates {x, y} in pixels, {0,0} representing the center of the frame, x axis oriented towards the right and y axis oriented towards the top + +- sys: GPAC system module +- evg: GPAC EVG module +- os: QuickJS OS module +- video_playing: video playing state +- audio_playing: audio playing state +- video_time: output video time +- video_timescale: output video timescale +- video_width: output video width +- video_height: output video height +- audio_time: output audio time +- audio_timescale: output audio timescale +- samplerate: output audio samplerate +- channels: output audio channels +- current_utc_clock: current UTC clock in ms +- get_media_time: gets media time of output (no argument) or of source with id matching the first argument. Return + + - -4: not found + - -3: not playing + - -2: in prefetch + - -1: timing not yet known + - value: media time in seconds (float) + +- resolve_url: resolves URL given in first argument against media playlist URL and returns the resolved url (string) +- get_scene(id): gets scene with given ID +- get_group(id): gets group with given ID +- mouse_over(evt): returns scene under mouse described by a GPAC event, or null if no scene (picking for scenes with perspective projection is not supported) +- mouse_over(x, y): returns scene under coordinates {x, y} in pixels, {0,0} representing the center of the frame, x axis oriented towards the right and y axis oriented towards the top + Scene and group options must be accessed through getters and setters: -* scene.get(prop_name): gets the scene option -* scene.set(prop_name, value): sets the scene option -* group.get(prop_name): gets the group option -* group.set(prop_name, value): sets the group option + +- scene.get(prop_name): gets the scene option +- scene.set(prop_name, value): sets the scene option +- group.get(prop_name): gets the group option +- group.set(prop_name, value): sets the group option + __Warning: Results are undefined if JS code modifies the scene/group objects in any other way.__ @@ -121,23 +139,27 @@ Other playlist objects (as well as scene and group objects) can be queried using __Warning: There is no protection of global variables and state, write your script carefully!__ Additionally, scripts executed within scene modules can modify the internal playlist using: -* remove_element(ID): removes a scene, group, sequence, timer, script or watcher with given ID from playlist -* parse_element(JSON): parses a root playlist element and add it to the current playlist -* parse_scene(JSON, parent): parses a scene and add it to `parent` group if not null or root otherwise -* parse_group(JSON, parent): parses a group and add it to `parent` group if not null or root otherwise -* reload_playlist(JSON): parses a new playlist (an empty JSON array will reset the playlist). If the calling scene is no longer in the resulting scene tree, it will be added to the root of the scene tree. + +- remove_element(ID): removes a scene, group, sequence, timer, script or watcher with given ID from playlist +- parse_element(JSON): parses a root playlist element and add it to the current playlist +- parse_scene(JSON, parent): parses a scene and add it to `parent` group if not null or root otherwise +- parse_group(JSON, parent): parses a group and add it to `parent` group if not null or root otherwise +- reload_playlist(JSON): parses a new playlist (an empty JSON array will reset the playlist). If the calling scene is no longer in the resulting scene tree, it will be added to the root of the scene tree. + All these playlist-related functions must be called within the update() callback of the scene module. ## Sequences ### Properties for `sequence` objects: - * id (null): sequence identifier - * loop (0): number of loops for the sequence (0 means no loop, -1 will loop forever) - * start (0): sequence start time (see notes). If negative, the sequence is not active - * stop (0): sequence stop time (see notes). If less than `start`, the sequence will stop only when over - * transition (null): a `transition` object to apply between sources of the sequence - * seq ([]): array of one or more `source` objects + + - id (null): sequence identifier + - loop (0): number of loops for the sequence (0 means no loop, -1 will loop forever) + - start (0): sequence start time (see notes). If negative, the sequence is not active + - stop (0): sequence stop time (see notes). If less than `start`, the sequence will stop only when over + - transition (null): a `transition` object to apply between sources of the sequence + - seq ([]): array of one or more `source` objects + ### Notes @@ -145,50 +167,62 @@ Media source timing does not depend on the media being used by a scene or not, i This means that a `sequence` not used by any active scene will not be rendered (video nor audio). The syntax for `start` and `stop` fields is: -* `now`: resolves to current UTC clock in `live` mode, and to 0 for non-live mode -* date: converted to UTC date in `live` mode, and to 0 for non-live mode -* N: converted to current utc clock (or 0 for non-live mode) plus N seconds UTC -* "N": converted to current utc clock (or 0 for non-live mode) plus N seconds UTC + +- `now`: resolves to current UTC clock in `live` mode, and to 0 for non-live mode +- date: converted to UTC date in `live` mode, and to 0 for non-live mode +- N: converted to current utc clock (or 0 for non-live mode) plus N seconds UTC +- "N": converted to current utc clock (or 0 for non-live mode) plus N seconds UTC + In 'live' mode, if `start` is set using a UTC date, the sequence will have a start range equal to `MAX(current_UTC - start_in_UTC, 0)`. Some sources may be skipped to fulfill this condition. This allows different instances of the filter using the same playlist to initialize media time in the same fashion. When reloading the playlist: + - if the sequence is active, `start` value is ignored - if the sequence was not started, `start` value is updated - if the sequence was over, `start` value is updated only of greater than previous resolved UTC start time. + ## Sources ### Properties for `source` objects -* id (null): source identifier, used when reloading the playlist -* src ([]): list of `sourceURL` describing the URLs to play. Multiple sources will be played in parallel -* start (0.0): media start time in source -* stop (0.0): media stop time in source, ignored if less than or equal to `start` -* mix (true): if true, apply sequence transition or mix effect ratio as audio volume. Otherwise volume is not modified by transitions. -* fade ('inout'): indicate how audio should be faded at stream start/end: - * in: audio fade-in when playing first frame - * out: audio fade-out when playing last frame - * inout: both fade-in and fade-out are enabled - * other: no audio fade -* keep_alive (false): if using a dedicated gpac process for one or more input, relaunch process(es) at source end if exit code is greater than 2 or if not responding after `rtimeout` -* seek (false): if true and `keep_alive` is active, adjust `start` according to the time elapsed since source start when relaunching process(es) -* prefetch (500): prefetch duration in ms (play before start time of source), 0 for no prefetch -* hold (false): if media duration is known and media stop time is greater than media duration, activate no signal mode until desired stop time is reached (disable transition), otherwise move to next source at end of stream + +- id (null): source identifier, used when reloading the playlist +- src ([]): list of `sourceURL` describing the URLs to play. Multiple sources will be played in parallel +- start (0.0): media start time in source +- stop (0.0): media stop time in source, ignored if less than or equal to `start` +- mix (true): if true, apply sequence transition or mix effect ratio as audio volume. Otherwise volume is not modified by transitions. +- fade ('inout'): indicate how audio should be faded at stream start/end: + + - in: audio fade-in when playing first frame + - out: audio fade-out when playing last frame + - inout: both fade-in and fade-out are enabled + - other: no audio fade + +- keep_alive (false): if using a dedicated gpac process for one or more input, relaunch process(es) at source end if exit code is greater than 2 or if not responding after `rtimeout` +- seek (false): if true and `keep_alive` is active, adjust `start` according to the time elapsed since source start when relaunching process(es) +- prefetch (500): prefetch duration in ms (play before start time of source), 0 for no prefetch +- hold (false): if media duration is known and media stop time is greater than media duration, activate no signal mode until desired stop time is reached (disable transition), otherwise move to next source at end of stream + ## Source Locations ### Properties for `sourceURL` objects -* id (null): source URL identifier, used when reloading the playlist -* in (null): input URL or filter chain to load as string. Words starting with `-` are ignored. The first entry must specify a source URL, and additional filters and links can be specified using `@N[#LINKOPT]` and `@@N[#LINKOPT]` syntax, as in gpac -* port (null): input port for source. Possible values are: - * pipe: launch a gpac process to play the source using GSF format over pipe - * tcp, tcpu: launch a gpac process to play the source using GSF format over TCP socket (`tcp`) or unix domain TCP socket (`tcpu`) - * not specified or empty string: loads source using the current process - * other: use value as input filter declaration and launch `in` as a dedicated process (e.g. `in="ffmpeg ..." port="pipe://..."`) -* opts (null): options for the gpac process instance when using a dedicated gpac process, ignored otherwise -* media ('all'): filter input media by type, `a` for audio, `v` for video, `t` for text (several characters allowed, e.g. `av` or `va`), `all` accept all input media -* raw (true): indicate if input port is decoded AV (true) or compressed AV (false) when using a dedicated gpac process, ignored otherwise + +- id (null): source URL identifier, used when reloading the playlist +- in (null): input URL or filter chain to load as string. Words starting with `-` are ignored. The first entry must specify a source URL, and additional filters and links can be specified using `@N[#LINKOPT]` and `@@N[#LINKOPT]` syntax, as in gpac +- port (null): input port for source. Possible values are: + + - pipe: launch a gpac process to play the source using GSF format over pipe + - tcp, tcpu: launch a gpac process to play the source using GSF format over TCP socket (`tcp`) or unix domain TCP socket (`tcpu`) + - not specified or empty string: loads source using the current process + - other: use value as input filter declaration and launch `in` as a dedicated process (e.g. `in="ffmpeg ..." port="pipe://..."`) + +- opts (null): options for the gpac process instance when using a dedicated gpac process, ignored otherwise +- media ('all'): filter input media by type, `a` for audio, `v` for video, `t` for text (several characters allowed, e.g. `av` or `va`), `all` accept all input media +- raw (true): indicate if input port is decoded AV (true) or compressed AV (false) when using a dedicated gpac process, ignored otherwise + ### Notes @@ -215,83 +249,101 @@ __Warning: When launching a child process directly (e.g. `in="ffmpeg ..."`), any ## 2D and 3D transformation ### Common properties for `group` and `scene` objects -* active (true): indicate if the object is active or not. An inactive object will not be refreshed nor rendered -* x (0): horizontal translation -* y (0): vertical translation -* cx (0): horizontal coordinate of rotation center -* cy (0): vertical coordinate of rotation center -* units ('rel'): unit type for `x`, `y`, `cx`, `cy`, `width` and `height`. Possible values are: - * rel: units are expressed in percent of current reference (see below) - * pix: units are expressed in pixels -* rotation (0): rotation angle of the scene in degrees -* hscale (1): horizontal scaling factor to apply to the group -* vscale (1): vertical skewing factor to apply to the scene -* hskew (0): horizontal skewing factor to apply to the scene -* vskew (0): vertical skewing factor to apply to the scene -* zorder (0): display order of the scene or of the offscreen group (ignored for regular groups) -* untransform (false): if true, reset parent tree matrix to identity before computing matrix -* mxjs (null): JS code for matrix evaluation -* z (0): depth translation -* cz (0): depth coordinate of rotation center -* zscale (1): depth scaling factor to apply to the group -* orientation ([0, 0, 1, 0]): scale along the given orientation axis [x, y, z, angle] - see VRML `scaleOrientation` -* axis ([0, 0, 1]): rotation axis -* position ([0, 0, auto]): camera location -* target ([0, 0, 0]): point where the camera is looking -* up ([0, 1, 0]): camera up vector -* viewport ([0, 0, 100, 100]): viewport for camera -* fov (45): field of view in degrees -* ar (0): camera aspect ratio, 0 means default -* znear (0): near Z plane distance, 0 means default -* zfar (0): far Z plane distance, 0 means default + +- active (true): indicate if the object is active or not. An inactive object will not be refreshed nor rendered +- x (0): horizontal translation +- y (0): vertical translation +- cx (0): horizontal coordinate of rotation center +- cy (0): vertical coordinate of rotation center +- units ('rel'): unit type for `x`, `y`, `cx`, `cy`, `width` and `height`. Possible values are: + + - rel: units are expressed in percent of current reference (see below) + - pix: units are expressed in pixels + +- rotation (0): rotation angle of the scene in degrees +- hscale (1): horizontal scaling factor to apply to the group +- vscale (1): vertical skewing factor to apply to the scene +- hskew (0): horizontal skewing factor to apply to the scene +- vskew (0): vertical skewing factor to apply to the scene +- zorder (0): display order of the scene or of the offscreen group (ignored for regular groups) +- untransform (false): if true, reset parent tree matrix to identity before computing matrix +- mxjs (null): JS code for matrix evaluation +- z (0): depth translation +- cz (0): depth coordinate of rotation center +- zscale (1): depth scaling factor to apply to the group +- orientation ([0, 0, 1, 0]): scale along the given orientation axis [x, y, z, angle] - see VRML `scaleOrientation` +- axis ([0, 0, 1]): rotation axis +- position ([0, 0, auto]): camera location +- target ([0, 0, 0]): point where the camera is looking +- up ([0, 1, 0]): camera up vector +- viewport ([0, 0, 100, 100]): viewport for camera +- fov (45): field of view in degrees +- ar (0): camera aspect ratio, 0 means default +- znear (0): near Z plane distance, 0 means default +- zfar (0): far Z plane distance, 0 means default + ### Coordinate System Each group or scene is specified in a local coordinate system for which: + - {0,0} represents the center - X values increase to the right - Y values increase to the top - Z values increase towards the eye of a viewer (Z=X^Y) + The 2D local transformation matrix is computed as `rotate(cx, cy, rotation)` * `hskew` * `vskew` * `scale(hscale, vscale)` * `translate(x, y)`. The 3D local transformation matrix is computed as `translate(x, y, z)` * `rotate(cx, cy, cz, rotation)` * `scale(hscale, vscale, zscale)`. Skewing is not supported for 3D. The default unit system (`rel`) is relative to the current established reference space: + - by default, the reference space is `{output_width, output_height}`, the origin {0,0} being the center of the output frame - any group with `reference=true`, `width>0` and `height>0` establishes a new reference space `{group.width, group.height}` + Inside a reference space `R`, relative coordinates are interpreted as follows: + - For horizontal coordinates, 0 means center, -50 means left edge (`-R.width/2`), 50 means right edge (`+R.width/2`). - For vertical coordinates, 0 means center, -50 means bottom edge (`-R.height/2`), 50 means top edge (`+R.height/2`). - For `width`, 100 means `R.width`. - For `height`, 100 means `R.height`. - For depth (z and cz) coordinates, the value is a percent of the reference height (`+R.height`). + If `width=height`, the width is set to the computed height of the object. If `height=width`, the height is set to the computed width of the object. For `x` property, the following special values are defined: + - `y` will set the value to the computed `y` of the object. - `-y` will set the value to the computed `-y` of the object. + For `y` property, the following special values are defined: + - `x` will set the value to the computed `x` of the object. - `-x` will set the value to the computed `-x` of the object. + Changing reference is typically needed when creating offscreen groups, so that children relative coordinates are resolved against the offscreen canvas size. The selection between 2D and 3D is done automatically based on `z`, `cz`, `axis` and `orientation` values. The default projection is: + - viewport is the entire output frame - field of view is PI/4 and aspect ratio is output width/height - zNear is 0.1 and zFar is 10 times maximum(output width, output height) - camera up direction is Y axis and camera distance is so that a rectangle facing the camera with `z=0` and size equal to output size covers exactly the output frame. - depth buffer is disabled + The default projection can be changed by setting camera properties at group or scene level. When set on a group, all children of the group will use the given camera properties (camera parameters on children are ignored). The `viewport` parameter is specified as an array `[x, y, w, h]`, where: -* x: horizontal coordinate of the viewport center, in group or scene units, or 'y' to use `y` value, or '-y' to use -`y` value. -* y: vertical coordinate of the viewport center, in group or scene units, or 'x' to use `x` value, or '-x' to use -`x` value. -* w: width of the viewport, in group or scene units, or 'height' to use `h` value. -* h: height of the viewport, in group or scene units, or 'width' to use `w` value. + +- x: horizontal coordinate of the viewport center, in group or scene units, or 'y' to use `y` value, or '-y' to use -`y` value. +- y: vertical coordinate of the viewport center, in group or scene units, or 'x' to use `x` value, or '-x' to use -`x` value. +- w: width of the viewport, in group or scene units, or 'height' to use `h` value. +- h: height of the viewport, in group or scene units, or 'width' to use `w` value. + ### z-ordering @@ -303,33 +355,42 @@ This order is independent of the parent group z-ordering. This allows moving obj The `JSFun` specified in `mxjs` has a single parameter `tr`. The `tr` parameter is an object containing the following variables that the code can modify: -* x, y, z, cx, cy, cz, hscale, vscale, zscale, hskew, vskew, rotation, untransform, axis, orientation: these values are initialized to the current group values in local coordinate system units -* update: if set to true, the object matrix will be recomputed at each frame even if no change in the group or scene parameters (always enforced to true if `use` is set) -* depth: for groups with `use`, indicates the recursion level of the used element. A value of 0 indicates this is a direct render of the element, otherwise it is a render through `use` + +- x, y, z, cx, cy, cz, hscale, vscale, zscale, hskew, vskew, rotation, untransform, axis, orientation: these values are initialized to the current group values in local coordinate system units +- update: if set to true, the object matrix will be recomputed at each frame even if no change in the group or scene parameters (always enforced to true if `use` is set) +- depth: for groups with `use`, indicates the recursion level of the used element. A value of 0 indicates this is a direct render of the element, otherwise it is a render through `use` + The `JSFun` may return false to indicate that the scene should be considered as inactive. Any other return value (undefined or not false) will mark the scene as active. -EX: "mxjs": "tr.rotation = (get_media_time() % 8) * 360 / 8; tr.update=true;" +Example +``` +"mxjs": "tr.rotation = (get_media_time() % 8) * 360 / 8; tr.update=true;" +``` ## Grouping ### Properties for `group` objects -* id (null): group identifier -* scenes ([]): zero or more `group` or `scene` objects, cannot be animated or updated -* opacity (1): group opacity -* offscreen ('none'): set group in offscreen mode, cannot be animated or updated. An offscreen mode is not directly visible but can be used in some texture operations. Possible values are: - * none: regular group - * mask: offscreen surface is alpha+grey - * color: offscreen surface is alpha+colors or colors if `back_color` is set - * dual: same as `color` but allows group to be displayed -* scaler (1): when opacity or offscreen rendering is used, offscreen canvas size is divided by this factor (>=1) -* back_color ('none'): when opacity or offscreen rendering is used, fill offscreen canvas with the given color. -* width (-1): when opacity or offscreen rendering is used, limit offscreen width to given value (see below) -* height (-1): when opacity or offscreen rendering is used, limit offscreen height to given value (see below) -* use (null): id of group or scene to re-use -* use_depth (-1): number of recursion allowed for the used element, negative means global max branch depth as indicated by `maxdepth` -* reverse (false): reverse scenes order before draw -* reference (false): group is a reference space for relative coordinate of children nodes + +- id (null): group identifier +- scenes ([]): zero or more `group` or `scene` objects, cannot be animated or updated +- opacity (1): group opacity +- offscreen ('none'): set group in offscreen mode, cannot be animated or updated. An offscreen mode is not directly visible but can be used in some texture operations. Possible values are: + + - none: regular group + - mask: offscreen surface is alpha+grey + - color: offscreen surface is alpha+colors or colors if `back_color` is set + - dual: same as `color` but allows group to be displayed + +- scaler (1): when opacity or offscreen rendering is used, offscreen canvas size is divided by this factor (>=1) +- back_color ('none'): when opacity or offscreen rendering is used, fill offscreen canvas with the given color. +- width (-1): when opacity or offscreen rendering is used, limit offscreen width to given value (see below) +- height (-1): when opacity or offscreen rendering is used, limit offscreen height to given value (see below) +- use (null): id of group or scene to re-use +- use_depth (-1): number of recursion allowed for the used element, negative means global max branch depth as indicated by `maxdepth` +- reverse (false): reverse scenes order before draw +- reference (false): group is a reference space for relative coordinate of children nodes + ### Notes @@ -347,27 +408,33 @@ When enforcing `width` and `height` on a group with `opacity<1`, the display may ## Scenes ### Properties for `scene` objects -* id (null): scene identifier -* js ('shape'): scene type, either builtin (see below) or path to a JS module, cannot be animated or updated -* sources ([]): list of identifiers of sequences or offscreen groups used by this scene -* width (-1): width of the scene, -1 means reference space width -* height (-1): height of the scene, -1 means reference space height -* mix (null): a `transition` object to apply if more than one source is set, ignored otherwise -* mix_ratio (-1): mix ratio for transition effect, <=0 means first source only, >=1 means second source only -* volume (1.0): audio volume (0: silence, 1: input volume), this value is not clamped by the mixer. -* fade ('inout'): indicate how audio should be faded at scene activate/deactivate: - * in: audio fade-in when playing first frame after scene activation - * out: audio fade-out when playing last frame at scene activation - * inout: both fade-in and fade-out are enabled - * other: no audio fade -* autoshow (true): automatically deactivate scene when sequences set in `sources` are not active -* nosig ('lost'): enable no-signal message for scenes using sequences: - * no: disable message - * lost: display message when signal is lost - * before: display message if source is not yet active - * all: always display message if source is inactive -* styles ([]): list of style IDs to use + +- id (null): scene identifier +- js ('shape'): scene type, either builtin (see below) or path to a JS module, cannot be animated or updated +- sources ([]): list of identifiers of sequences or offscreen groups used by this scene +- width (-1): width of the scene, -1 means reference space width +- height (-1): height of the scene, -1 means reference space height +- mix (null): a `transition` object to apply if more than one source is set, ignored otherwise +- mix_ratio (-1): mix ratio for transition effect, <=0 means first source only, >=1 means second source only +- volume (1.0): audio volume (0: silence, 1: input volume), this value is not clamped by the mixer. +- fade ('inout'): indicate how audio should be faded at scene activate/deactivate: + + - in: audio fade-in when playing first frame after scene activation + - out: audio fade-out when playing last frame at scene activation + - inout: both fade-in and fade-out are enabled + - other: no audio fade + +- autoshow (true): automatically deactivate scene when sequences set in `sources` are not active +- nosig ('lost'): enable no-signal message for scenes using sequences: + + - no: disable message + - lost: display message when signal is lost + - before: display message if source is not yet active + - all: always display message if source is inactive + +- styles ([]): list of style IDs to use - any other property exposed by the underlying scene JS module. + ### Notes @@ -381,11 +448,13 @@ If a scene uses one or more sequences and `autoshow` is not set, the scene will ### JSON syntax Properties for `transition` objects: -* id (null): transition identifier -* type: transition type, either builtin (see below) or path to a JS module -* dur: transition duration (transitions always end at source stop time). Ignored if transition is specified for a scene `mix`. -* fun (null): JS code modifying the ratio effect + +- id (null): transition identifier +- type: transition type, either builtin (see below) or path to a JS module +- dur: transition duration (transitions always end at source stop time). Ignored if transition is specified for a scene `mix`. +- fun (null): JS code modifying the ratio effect - any other property exposed by the underlying transition module. + ### Notes @@ -401,41 +470,52 @@ Example ## Timers and animations ### Properties for `timer` objects -* id (null): id of the timer -* dur (0): duration of the timer in seconds -* loop (false): loops timer when `stop` is not set -* pause (false): pause timer -* start (-1): start time (see notes), negative value means inactive -* stop (-1): stop time (see notes), ignored if less than `start` -* keys ([]): list of keys used for interpolation, ordered list between 0.0 and 1.0 -* anims ([]): list of `animation` objects + +- id (null): id of the timer +- dur (0): duration of the timer in seconds +- loop (false): loops timer when `stop` is not set +- pause (false): pause timer +- start (-1): start time (see notes), negative value means inactive +- stop (-1): stop time (see notes), ignored if less than `start` +- keys ([]): list of keys used for interpolation, ordered list between 0.0 and 1.0 +- anims ([]): list of `animation` objects + ### Properties for `animation` objects -* values ([]): list of values to interpolate, there must be as many values as there are keys -* color (false): indicate the values are color (as strings) -* angle (false): indicate the interpolation factor is an angle in degree, to convert to radians (interpolation ratio multiplied by PI and divided by 180) before interpolation -* mode ('linear') : interpolation mode: - * linear: linear interpolation between the values - * discrete: do not interpolate - * other: JS code modifying the interpolation ratio -* postfun (null): JS code modifying the interpolation result -* end ('freeze'): behavior at end of animation: - * freeze: keep last animated values - * restore: restore targets to their initial values -* targets ([]): list of strings indicating targets properties to modify. Syntax is: - * ID@option: modifies property `option` of object with given ID - * ID@option[IDX]: modifies value at index `IDX` of array property `option` of object with given ID + +- values ([]): list of values to interpolate, there must be as many values as there are keys +- color (false): indicate the values are color (as strings) +- angle (false): indicate the interpolation factor is an angle in degree, to convert to radians (interpolation ratio multiplied by PI and divided by 180) before interpolation +- mode ('linear') : interpolation mode: + + - linear: linear interpolation between the values + - discrete: do not interpolate + - other: JS code modifying the interpolation ratio + +- postfun (null): JS code modifying the interpolation result +- end ('freeze'): behavior at end of animation: + + - freeze: keep last animated values + - restore: restore targets to their initial values + +- targets ([]): list of strings indicating targets properties to modify. Syntax is: + + - ID@option: modifies property `option` of object with given ID + - ID@option[IDX]: modifies value at index `IDX` of array property `option` of object with given ID + ### Notes Currently, only `scene`, `group`, `transition` and `script` objects can be modified through timers (see playlist updates). The syntax for `start` and `stop` fields is: -* `now`: resolves to current UTC clock in `live` mode, and to 0 for non-live mode -* date: converted to UTC date in `live` mode, and to 0 for non-live mode -* N: converted to UTC clock at init plus N seconds for `timer` objects (absolute offset from timeline init) -* "N": converted to current UTC clock plus N seconds (relative offset from current time) with N a positive or negative number + +- `now`: resolves to current UTC clock in `live` mode, and to 0 for non-live mode +- date: converted to UTC date in `live` mode, and to 0 for non-live mode +- N: converted to UTC clock at init plus N seconds for `timer` objects (absolute offset from timeline init) +- "N": converted to current UTC clock plus N seconds (relative offset from current time) with N a positive or negative number + The `JSFun` specified by `mode` has one input parameter `interp` equal to the interpolation factor and must return the new interpolation factor. Example @@ -452,9 +532,11 @@ Example ## Scripts ### Properties for `script` objects -* id (null): id of the script -* script (null): JavaScript code or path to JavaScript file to execute, cannot be animated or updated -* active (true): indicate if script is active or not + +- id (null): id of the script +- script (null): JavaScript code or path to JavaScript file to execute, cannot be animated or updated +- active (true): indicate if script is active or not + ### Notes @@ -462,20 +544,27 @@ Script objects allow read and write access to the playlist from script. They cur The `JSFun` function specified by `fun` has no input parameter. The return value (default 0) is the number of seconds (float) to wait until next evaluation of the script. -EX: { "script": "let s=get_scene('s1'); let rot = s.get('rotation'); rot += 10; s.set('rotation', rot); return 2;" } +Example +``` +{ "script": "let s=get_scene('s1'); let rot = s.get('rotation'); rot += 10; s.set('rotation', rot); return 2;" } +``` This will change scene `s1` rotation every 2 seconds ## Watchers ### Properties for `watcher` objects -* id (null): ID of the watcher -* active (true): indicate if watcher is active or not -* watch (""): element watched, formatted as `ID@prop`, with `ID` the element ID and `prop` the property name to watch -* target (""): action for watcher. Allowed syntaxes are: - * `ID@prop`, `ID@prop[idx]`: copy value to property `prop` of the element `ID` (potentially at index `idx` if specified for arrays) - * `ID.fun_name`: call function `fun_name` exported from scene module `ID`, using three arguments ['value', 'watchID', 'watchPropName'], no return value check - * otherwise: action must be JS code, and the resulting `JSFun` has one argument `value` containing the watched value, and no return value check -* with (undefined): for targets in the form `ID@prop`, use this value instead of the watched value + +- id (null): ID of the watcher +- active (true): indicate if watcher is active or not +- watch (""): element watched, formatted as `ID@prop`, with `ID` the element ID and `prop` the property name to watch +- target (""): action for watcher. Allowed syntaxes are: + + - `ID@prop`, `ID@prop[idx]`: copy value to property `prop` of the element `ID` (potentially at index `idx` if specified for arrays) + - `ID.fun_name`: call function `fun_name` exported from scene module `ID`, using three arguments ['value', 'watchID', 'watchPropName'], no return value check + - otherwise: action must be JS code, and the resulting `JSFun` has one argument `value` containing the watched value, and no return value check + +- with (undefined): for targets in the form `ID@prop`, use this value instead of the watched value + ### Notes @@ -483,9 +572,11 @@ A watcher can be used to monitor changes in an object in the playlist. Any object property that can be animated or updated can be monitored by a watcher. In addition, the following virtual properties (cannot be read or write) can be watched: -* sequence.active: value is set to true when sequence is activated, and false when deactivated -* source.active: value is set to true when source playback starts, and false when source playback stops -* timer.active: value is set to true when timer starts, and false when timer stops + +- sequence.active: value is set to true when sequence is activated, and false when deactivated +- source.active: value is set to true when source playback starts, and false when source playback stops +- timer.active: value is set to true when timer starts, and false when timer stops + Only the `active` property can be animated or updated in a watcher. @@ -504,8 +595,10 @@ This will copy the -1*s1.rotation to s2.rotation. ### Watching UI events Watchers can also be used to monitor GPAC user events by setting `watch` to: + - an event name to monitor, one of `keydown`, `keyup`, `mousemove`, `mouseup`, `mousedown`, `wheel`, `textInput` - `events` to monitor all events (including internal events). + For `keyup` and `keydown` events, the key code to watch may additionally be given in parenthesis, e.g. `'watch': 'keyup(T)'`. @@ -523,9 +616,11 @@ This will set s1 fill color to white of mouse is over s2 and to black otherwise. ## Styles ### Properties for `style` objects -* id (null): ID of the style -* forced (false): always apply style even when no modifications -* other: any property to share between scene + +- id (null): ID of the style +- forced (false): always apply style even when no modifications +- other: any property to share between scene + ### Notes @@ -533,9 +628,11 @@ A style object allows scenes to share the same values for a given set of propert If a scene property has the same name as a style property, the scene property is replaced by the style property. Styles only apply to scene properties as follows: + - volume, fade, mix_ratio can use style - all options defined by the scene module can use style - transformation or other scene properties cannot use style + Properties of a style object can be animated or updated, but a style object cannot be watched. @@ -546,16 +643,20 @@ modified (animation, update), `st2` will only be applied once. ## Filter configuration The playlist may specify configuration options of the filter, using a root object of type 'config': + - property names are the same as the filter options - property values are given in the native type, or as strings for fractions (format `N/D`), vectors (format `WxH`) or enums - each declared property overrides the filter option of the same name (whether default or set at filter creation) + A configuration object in the playlist is only parsed when initially loading the playlist, and ignored when reloading it. The following additional properties are defined for testing: -* reload_tests([]): list of playlists to reload -* reload_timeout(1.0): timeout in seconds before playlist reload -* reload_loop (0): number of times to repeat the reload tests (not including original playlist which is not reloaded) + +- reload_tests([]): list of playlists to reload +- reload_timeout(1.0): timeout in seconds before playlist reload +- reload_loop (0): number of times to repeat the reload tests (not including original playlist which is not reloaded) + ## Playlist modification The playlist file can be modified at any time. @@ -613,22 +714,29 @@ __Warning: The `updates` file is only read when modified _AFTER_ the initializat The `updates` file content shall be either a single JSON object or an array of JSON objects. The properties of these objects are: -* skip: if true or 1, ignores the update, otherwise apply it -* replace: string identifying the target replacement. Syntax is: - * ID@name: indicate property name of element with given ID to replace - * ID@name[idx]: indicate the index in the property name of element with given ID to replace -* with: replacement value, must be of the same type as the target value. + +- skip: if true or 1, ignores the update, otherwise apply it +- replace: string identifying the target replacement. Syntax is: + + - ID@name: indicate property name of element with given ID to replace + - ID@name[idx]: indicate the index in the property name of element with given ID to replace + +- with: replacement value, must be of the same type as the target value. + An `id` property cannot be updated. The following playlist elements of a playlist can be updated: -* scene: all properties except `js` and read-only module properties -* group: all properties except `scenes` and `offscreen` -* sequence: `start`, `stop`, `loop` and `transition` properties -* timer: `start`, `stop`, `loop`, `pause` and `dur` properties -* transition: all properties - * for sequence transitions: most of these properties will only be updated at next reload - * for active scene transitions: whether these changes are applied right away depend on the transition module + +- scene: all properties except `js` and read-only module properties +- group: all properties except `scenes` and `offscreen` +- sequence: `start`, `stop`, `loop` and `transition` properties +- timer: `start`, `stop`, `loop`, `pause` and `dur` properties +- transition: all properties + + - for sequence transitions: most of these properties will only be updated at next reload + - for active scene transitions: whether these changes are applied right away depend on the transition module + Example ``` @@ -640,18 +748,68 @@ Example # Scene modules +## Scene `mask` +This scene sets the canvas alpha mask mode. + +The canvas alpha mask is always full screen. + +In software mode, combining mask effect in record mode and reverse group drawing allows drawing front to back while writing pixels only once. + +Options: + +- mode ('off'): if set, reset clipper otherwise set it to scene position and size + + - off: mask is disabled + - on: mask is enabled and cleared, further draw operations will take place on mask + - onkeep: mask is enabled but not cleared, further draw operations will take place on mask + - use: mask is enabled, further draw operations will be filtered by mask + - use_inv: mask is enabled, further draw operations will be filtered by 1-mask + - rec: mask is in record mode, further draw operations will be drawn on output and will set mask value to 0 + + + +## Scene `clear` +This scene clears the canvas area covered by the scene with a given color. + +The default clear color of the mixer is `black`. + +The clear area is always axis-aligned in output frame, so when skew/rotation are present, the axis-aligned bounding box of the transformed scene area will be cleared. + +Options: + +- color ('none'): clear color + + +## Scene `clip` +This scene resets the canvas clipper or sets the canvas clipper to the scene area. + +The clipper is always axis-aligned in output frame, so when skew/rotation are present, the axis-aligned bounding box of the transformed clipper will be used. + +Clippers are handled through a stack, resetting the clipper pops the stack and restores previous clipper. +If a clipper is already defined when setting the clipper, the clipper set is the intersection of the two clippers. + +Options: + +- reset (false): if set, reset clipper otherwise set it to scene position and size +- stack (true): if false, clipper is set/reset independently of the clipper stack (no intersection, no push/pop of the stack) + + ## Scene `shape` This scene can be used to setup a shape, its outline and specify the fill and strike modes. Supported shapes include: + - a variety of rectangles, ellipse and other polygons - custom paths specified from JS - text + The color modes for shapes and outlines include: + - texturing using data from input media streams (shape fill only) - texturing using local JPEG and PNG files (shape fill only) - solid color - linear and radial gradients + The default scene is optimized to fallback to fast blit when no transformations are used on a straight rectangle shape. @@ -660,8 +818,10 @@ All options can be updated at run time. The module accepts 0, 1 or 2 sequences as input. Color replacement operations can be specified for base scenes using source videos by specifying the `replace` option. The replacement source is: + - the image data if `img` is set, potentially altered using `*_rep` options - otherwise a linear gradient if `fill=linear` or a radial gradient if `fill=radial` (NOT supported in GPU mode, use an offscreen group for this). + __Warning: Color replacement operations cannot be used with transition or mix effects.__ @@ -669,32 +829,38 @@ __Warning: Color replacement operations cannot be used with transition or mix ef Text can be loaded from file if `text[0]` is an existing local file. By default all lines are loaded. The number of loaded lines can be specified using `text[1]` as follows: -* 0 or not present: all lines are loaded -* N > 0: only keep the last N lines -* N < 0: only keep the first N lines + +- 0 or not present: all lines are loaded +- N > 0: only keep the last N lines +- N < 0: only keep the first N lines + Text loaded from file will be refreshed whenever the file is modified. Predefined keywords can be used in input text, identified as `$KEYWORD$`. The following keywords (case insensitive) are defined: -* time: replaced by UTC date -* ltime: replaced by locale date -* date: replaced by date (Y/M/D) -* ldate: replaced by locale date (Y/M/D) -* mtime: replaced by output media time -* mtime_SRC: replaced by media time of input source `SRC` -* cpu: replaced by current CPU usage of process -* mem: replaced by current memory usage of process -* version: replaced by GPAC version -* fversion: replaced by GPAC full version -* P4CC, PropName: replaced by corresponding PID property + +- time: replaced by UTC date +- ltime: replaced by locale date +- date: replaced by date (Y/M/D) +- ldate: replaced by locale date (Y/M/D) +- mtime: replaced by output media time +- mtime_SRC: replaced by media time of input source `SRC` +- cpu: replaced by current CPU usage of process +- mem: replaced by current memory usage of process +- version: replaced by GPAC version +- fversion: replaced by GPAC full version +- P4CC, PropName: replaced by corresponding PID property + ## Custom paths Custom paths (shapes) can be created through JS code indicated in 'shape', either inline or through a file. The following GPAC JS modules are imported: - - `Sys` as `sys` - - All EVG as `evg` - - `os` form QuickJS + + - `Sys` as `sys` + - All EVG as `evg` + - `os` form QuickJS + See [https://doxygen.gpac.io]() for more information on EVG and Sys JS APIs. @@ -716,188 +882,182 @@ Example In this example, the texture mapping will be adjusted to the desired size. The global variables and functions are available (c.f. `gpac -h avmix:global`): - * get_media_time(): return media time in seconds (float) of output - * get_media_time(SRC): get time of source with id `SRC`, return -4 if not found, -3 if not playing, -2 if in prefetch, -1 if timing not yet known, media time in seconds (float) otherwise - * current_utc_clock: current UTC time in ms - * video_time: output video time - * video_timescale: output video timescale - * video_width: output video width - * video_height: output video height + + - get_media_time(): return media time in seconds (float) of output + - get_media_time(SRC): get time of source with id `SRC`, return -4 if not found, -3 if not playing, -2 if in prefetch, -1 if timing not yet known, media time in seconds (float) otherwise + - current_utc_clock: current UTC time in ms + - video_time: output video time + - video_timescale: output video timescale + - video_width: output video width + - video_height: output video height + If your path needs to be reevaluated on regular basis, set the value `this.reload` to the timeout to next reload, in milliseconds. Options: -* rx (0): horizontal radius for rounded rect in percent of object width if positive, in absolute value if negative, value `y` means use `ry` -* ry (0): vertical radius for rounded rect in percent of object height if positive, in absolute value if negative, value `x` means use `rx` -* tl (1): top-left corner scaler (positive, 0 disables corner) -* bl (1): bottom-left corner scaler (positive, 0 disables corner) -* tr (1): top-right corner scaler (positive, 0 disables corner) -* br (1): bottom-right corner scaler (positive, 0 disables corner) -* rs (false): repeat texture horizontally -* rt (false): repeat texture vertically -* keep_ar (true): keep aspect ratio -* pad_color ('0x00FFFFFF'): color to use for texture padding if `rs` or `rt` are false. Use `none` to use texture edge, `0x00FFFFFF` for transparent (always enforced if source is transparent) -* txmx ([]): texture matrix - all 6 coefficients must be set, i.e. [xx xy tx yx yy ty] -* cmx ([]): color transform - all 20 coefficients must be set in order, i.e. [Mrr, Mrg, Mrb, Mra, Tr, Mgr, Mgg ...] -* line_width (0): line width in percent of width if positive, or absolute value if negative -* line_color ('white'): line color, `linear` for linear gradient and `radial` for radial gradient -* line_pos ('center'): line/shape positioning. Possible values are: - * center: line is centered around shape - * outside: line is outside the shape - * inside: line is inside the shape -* line_dash ('plain'): line dashing mode. Possible values are: - * plain: no dash - * dash: predefined dash pattern is used - * dot: predefined dot pattern is used - * dashdot: predefined dash-dot pattern is used - * dashdashdot: predefined dash-dash-dot pattern is used - * dashdotdot: predefined dash-dot-dot pattern is used -* dashes ([]): dash/dot pattern lengths for custom dashes (these will be multiplied by line size) -* cap ('flat'): line end style. Possible values are: - * flat: flat end - * round: round end - * square: square end (extends limit compared to flat) - * triangle: triangle end -* join ('miter'): line joint style. Possible values are: - * miter: miter join (straight lines) - * round: round join - * bevel: bevel join - * bevelmiter: bevel+miter join -* miter_limit (2): miter limit for joint styles -* dash_length (-1): length of path to outline, negative values mean full path -* dash_offset (0): offset in path at which the outline starts -* blit (true): use blit if possible, otherwise EVG texturing. If disabled, always use texturing -* fill ('none'): fill color if used without sources, `linear` for linear gradient and `radial` for radial gradient -* img (''): image for scene without sources or when `replace` is set. Accepts either a path to a local image (JPG or PNG), the ID of an offscreen group or the ID of a sequence -* alpha (1): global texture transparency -* replace (''): if `img` or `fill` is set and shape is using source, set multi texture option. Possible modes are: - * a, r, g or b: replace alpha source component by indicated component from `img` . If prefix `-` is set, replace by one minus the indicated component - * m: mix using `mix_ratio` the color components of source and `img` and set alpha to full opacity - * M: mix using `mix_ratio` all components of source and `img`, including alpha - * xC: mix source 1 and source 2 using `img` component `C` (`a`, `r`, `g` or `b`) and force alpha to full opacity - * XC: mix source 1 and source 2 using `img` component `C` (`a`, `r`, `g` or `b`), including alpha - -* shape ('rect'): shape type. Possible values are: - * rect: rounded rectangle - * square: square using smaller width/height value - * ellipse: ellipse - * circle: circle using smaller width/height value - * rhombus: axis-aligned rhombus - * text: force text mode even if text field is empty - * rects: same as rounded rectangle but use straight lines for corners - * other value: JS code for custom path creation, either string or local file name (dynamic reload possible) -* grad_p ([]): gradient positions between 0 and 1 -* grad_c ([]): gradient colors for each position, as strings -* grad_start ([]): start point for linear gradient or center point for radial gradient -* grad_end ([]): end point for linear gradient or radius value for radial gradient -* grad_focal ([]): focal point for radial gradient -* grad_mode ('pad'): gradient mode. Possible values are: - * pad: color padding outside of gradient bounds - * spread: mirror gradient outside of bounds - * repeat: repeat gradient outside of bounds -* text ([]): text lines (UTF-8 only). If not empty, force `shape=text` -* font ([]): font name(s) -* size (20): font size in percent of height (horizontal text) or width (vertical text), or absolute value if negative -* baseline ('alphabetic'): baseline position. Possible values are: - * alphabetic: alphabetic position of baseline - * top: baseline at top of EM Box - * hanging: reserved, _not implemented_ - * middle: baseline at middle of EM Box - * ideograph: reserved, _not implemented_ - * bottom: baseline at bottom of EM Box -* align ('center'): horizontal text alignment. Possible values are: - * center: center of shape - * start: start of shape (left or right depending on text direction) - * end: end of shape (right or left depending on text direction) - * left: left of shape - * right: right of shape -* spacing (0): line spacing in percent of height (horizontal text) or width (vertical text), or absolute value if negative -* bold (false): use bold version of font -* italic (false): use italic version of font -* underline (false): underline text -* vertical (false): draw text vertically -* flip (false): flip text vertically -* extend (0): maximum text width in percent of width (for horizontal) or height (for vertical), or absolute value if negative -* keep_ar_rep (true): same as `keep_ar` for local image in replace mode -* txmx_rep ([]): same as `txmx` for local image in replace mode -* cmx_rep ([]): same as `cmx` for local image in replace mode -* pad_color_rep ('none'): same as `pad_color` for local image in replace mode -* rs_rep (false): same as `rs` for local image in replace mode -* rt_rep (false): same as `rt` for local image in replace mode -## Scene `mask` -This scene sets the canvas alpha mask mode. - -The canvas alpha mask is always full screen. - -In software mode, combining mask effect in record mode and reverse group drawing allows drawing front to back while writing pixels only once. - -Options: -* mode ('off'): if set, reset clipper otherwise set it to scene position and size - * off: mask is disabled - * on: mask is enabled and cleared, further draw operations will take place on mask - * onkeep: mask is enabled but not cleared, further draw operations will take place on mask - * use: mask is enabled, further draw operations will be filtered by mask - * use_inv: mask is enabled, further draw operations will be filtered by 1-mask - * rec: mask is in record mode, further draw operations will be drawn on output and will set mask value to 0 - +- rx (0): horizontal radius for rounded rect in percent of object width if positive, in absolute value if negative, value `y` means use `ry` +- ry (0): vertical radius for rounded rect in percent of object height if positive, in absolute value if negative, value `x` means use `rx` +- tl (1): top-left corner scaler (positive, 0 disables corner) +- bl (1): bottom-left corner scaler (positive, 0 disables corner) +- tr (1): top-right corner scaler (positive, 0 disables corner) +- br (1): bottom-right corner scaler (positive, 0 disables corner) +- rs (false): repeat texture horizontally +- rt (false): repeat texture vertically +- keep_ar (true): keep aspect ratio +- pad_color ('0x00FFFFFF'): color to use for texture padding if `rs` or `rt` are false. Use `none` to use texture edge, `0x00FFFFFF` for transparent (always enforced if source is transparent) +- txmx ([]): texture matrix - all 6 coefficients must be set, i.e. [xx xy tx yx yy ty] +- cmx ([]): color transform - all 20 coefficients must be set in order, i.e. [Mrr, Mrg, Mrb, Mra, Tr, Mgr, Mgg ...] +- line_width (0): line width in percent of width if positive, or absolute value if negative +- line_color ('white'): line color, `linear` for linear gradient and `radial` for radial gradient +- line_pos ('center'): line/shape positioning. Possible values are: -## Scene `clear` -This scene clears the canvas area covered by the scene with a given color. - -The default clear color of the mixer is `black`. - -The clear area is always axis-aligned in output frame, so when skew/rotation are present, the axis-aligned bounding box of the transformed scene area will be cleared. - -Options: -* color ('none'): clear color + - center: line is centered around shape + - outside: line is outside the shape + - inside: line is inside the shape + +- line_dash ('plain'): line dashing mode. Possible values are: + + - plain: no dash + - dash: predefined dash pattern is used + - dot: predefined dot pattern is used + - dashdot: predefined dash-dot pattern is used + - dashdashdot: predefined dash-dash-dot pattern is used + - dashdotdot: predefined dash-dot-dot pattern is used + +- dashes ([]): dash/dot pattern lengths for custom dashes (these will be multiplied by line size) +- cap ('flat'): line end style. Possible values are: + + - flat: flat end + - round: round end + - square: square end (extends limit compared to flat) + - triangle: triangle end + +- join ('miter'): line joint style. Possible values are: + + - miter: miter join (straight lines) + - round: round join + - bevel: bevel join + - bevelmiter: bevel+miter join + +- miter_limit (2): miter limit for joint styles +- dash_length (-1): length of path to outline, negative values mean full path +- dash_offset (0): offset in path at which the outline starts +- blit (true): use blit if possible, otherwise EVG texturing. If disabled, always use texturing +- fill ('none'): fill color if used without sources, `linear` for linear gradient and `radial` for radial gradient +- img (''): image for scene without sources or when `replace` is set. Accepts either a path to a local image (JPG or PNG), the ID of an offscreen group or the ID of a sequence +- alpha (1): global texture transparency +- replace (''): if `img` or `fill` is set and shape is using source, set multi texture option. Possible modes are: + + - a, r, g or b: replace alpha source component by indicated component from `img` . If prefix `-` is set, replace by one minus the indicated component + - m: mix using `mix_ratio` the color components of source and `img` and set alpha to full opacity + - M: mix using `mix_ratio` all components of source and `img`, including alpha + - xC: mix source 1 and source 2 using `img` component `C` (`a`, `r`, `g` or `b`) and force alpha to full opacity + - XC: mix source 1 and source 2 using `img` component `C` (`a`, `r`, `g` or `b`), including alpha -## Scene `clip` -This scene resets the canvas clipper or sets the canvas clipper to the scene area. - -The clipper is always axis-aligned in output frame, so when skew/rotation are present, the axis-aligned bounding box of the transformed clipper will be used. - -Clippers are handled through a stack, resetting the clipper pops the stack and restores previous clipper. -If a clipper is already defined when setting the clipper, the clipper set is the intersection of the two clippers. -Options: -* reset (false): if set, reset clipper otherwise set it to scene position and size -* stack (true): if false, clipper is set/reset independently of the clipper stack (no intersection, no push/pop of the stack) + +- shape ('rect'): shape type. Possible values are: + + - rect: rounded rectangle + - square: square using smaller width/height value + - ellipse: ellipse + - circle: circle using smaller width/height value + - rhombus: axis-aligned rhombus + - text: force text mode even if text field is empty + - rects: same as rounded rectangle but use straight lines for corners + - other value: JS code for custom path creation, either string or local file name (dynamic reload possible) + +- grad_p ([]): gradient positions between 0 and 1 +- grad_c ([]): gradient colors for each position, as strings +- grad_start ([]): start point for linear gradient or center point for radial gradient +- grad_end ([]): end point for linear gradient or radius value for radial gradient +- grad_focal ([]): focal point for radial gradient +- grad_mode ('pad'): gradient mode. Possible values are: + + - pad: color padding outside of gradient bounds + - spread: mirror gradient outside of bounds + - repeat: repeat gradient outside of bounds + +- text ([]): text lines (UTF-8 only). If not empty, force `shape=text` +- font ([]): font name(s) +- size (20): font size in percent of height (horizontal text) or width (vertical text), or absolute value if negative +- baseline ('alphabetic'): baseline position. Possible values are: + + - alphabetic: alphabetic position of baseline + - top: baseline at top of EM Box + - hanging: reserved, _not implemented_ + - middle: baseline at middle of EM Box + - ideograph: reserved, _not implemented_ + - bottom: baseline at bottom of EM Box + +- align ('center'): horizontal text alignment. Possible values are: + + - center: center of shape + - start: start of shape (left or right depending on text direction) + - end: end of shape (right or left depending on text direction) + - left: left of shape + - right: right of shape + +- spacing (0): line spacing in percent of height (horizontal text) or width (vertical text), or absolute value if negative +- bold (false): use bold version of font +- italic (false): use italic version of font +- underline (false): underline text +- vertical (false): draw text vertically +- flip (false): flip text vertically +- extend (0): maximum text width in percent of width (for horizontal) or height (for vertical), or absolute value if negative +- keep_ar_rep (true): same as `keep_ar` for local image in replace mode +- txmx_rep ([]): same as `txmx` for local image in replace mode +- cmx_rep ([]): same as `cmx` for local image in replace mode +- pad_color_rep ('none'): same as `pad_color` for local image in replace mode +- rs_rep (false): same as `rs` for local image in replace mode +- rt_rep (false): same as `rt` for local image in replace mode + # Transition modules ## Transition `gltrans` - GPU only This transition module wraps gl-transitions, see https://gl-transitions.com/ and `gpac -h avmix:gltrans` for builtin transitions Options: -* fx (''): effect name for built-in effects, or path to gl-transition GLSL file -## Transition `mix` - software/GPU -This transition performs cross-fade of source videos +- fx (''): effect name for built-in effects, or path to gl-transition GLSL file + ## Transition `swipe` - software/GPU This transition performs simple 2D affine transformations for source videos transitions, with configurable effect origin Options: -* from ('left'): direction of video 2 entry. Possible values are: - * left: from left to right edges - * right: from right to left edges - * top: from top to bottom edges - * bottom: from bottom to top edges - * topleft: from top-left to bottom-right corners - * topright: from top-right to bottom-left corners - * bottomleft: from bottom-left to top-right corners - * bottomright: from bottom-right to top-left corners - -* mode ('slide'): how video 2 entry impacts video 1. Possible values are: - * slide: video 1 position is not modified - * push: video 2 pushes video 1 away - * squeeze: video 2 squeezes video 1 along opposite edge - * grow: video 2 size increases, video 1 not modified - * swap: video 2 size increases, video 1 size decreases + +- from ('left'): direction of video 2 entry. Possible values are: + + - left: from left to right edges + - right: from right to left edges + - top: from top to bottom edges + - bottom: from bottom to top edges + - topleft: from top-left to bottom-right corners + - topright: from top-right to bottom-left corners + - bottomleft: from bottom-left to top-right corners + - bottomright: from bottom-right to top-left corners + + +- mode ('slide'): how video 2 entry impacts video 1. Possible values are: + + - slide: video 1 position is not modified + - push: video 2 pushes video 1 away + - squeeze: video 2 squeezes video 1 along opposite edge + - grow: video 2 size increases, video 1 not modified + - swap: video 2 size increases, video 1 size decreases + + +## Transition `mix` - software/GPU +This transition performs cross-fade of source videos + ## Transition `fade` - software/GPU This transition performs fade to/from color of source videos Options: -* color ('black'): fade color + +- color ('black'): fade color + # Options @@ -905,9 +1065,10 @@ Options: __pl__ (str, default: _avmix.json_): local playlist file to load __live__ (bool, default: _true_): live mode __gpu__ (enum, default: _off_): enable GPU usage - * off: no GPU - * mix: only render textured path to GPU, use software rasterizer for the outlines, solid fills and gradients - * all: try to use GPU for everything + +- off: no GPU +- mix: only render textured path to GPU, use software rasterizer for the outlines, solid fills and gradients +- all: try to use GPU for everything __thread__ (sint, default: _-1_): use threads for software rasterizer (-1 for all available cores) __lwait__ (uint, default: _1000_): timeout in ms before considering no signal is present @@ -919,9 +1080,10 @@ Options: __fps__ (frac, default: _25_): output video frame rate __pfmt__ (pfmt, default: _yuv_): output pixel format. Use `rgba` in GPU mode to force alpha channel __dynpfmt__ (enum, default: _init_): allow dynamic change of output pixel format in software mode - * off: pixel format is forced to desired value - * init: pixel format is forced to format of fullscreen input in first generated frame - * all: pixel format changes each time a full-screen input PID at same resolution is used + +- off: pixel format is forced to desired value +- init: pixel format is forced to format of fullscreen input in first generated frame +- all: pixel format changes each time a full-screen input PID at same resolution is used __sr__ (uint, default: _44100_): output audio sample rate, 0 disable audio output __ch__ (uint, default: _2_): number of output audio channels, 0 disable audio output diff --git a/docs/Filters/bsrw.md b/docs/Filters/bsrw.md index c41a6d52..d4123115 100644 --- a/docs/Filters/bsrw.md +++ b/docs/Filters/bsrw.md @@ -8,24 +8,33 @@ Filters of this class can connect to each-other. This filter rewrites some metadata of various bitstream formats. The filter can currently modify the following properties in video bitstreams: + - MPEG-4 Visual: - - sample aspect ratio - - profile and level + + - sample aspect ratio + - profile and level + - AVC|H264, HEVC and VVC: - - sample aspect ratio - - profile, level, profile compatibility - - video format, video fullrange - - color primaries, transfer characteristics and matrix coefficients (or remove all info) + + - sample aspect ratio + - profile, level, profile compatibility + - video format, video fullrange + - color primaries, transfer characteristics and matrix coefficients (or remove all info) + - ProRes: - - sample aspect ratio - - color primaries, transfer characteristics and matrix coefficients + + - sample aspect ratio + - color primaries, transfer characteristics and matrix coefficients + Values are by default initialized to -1, implying to keep the related info (present or not) in the bitstream. A [sar](#sar) value of `0/0` will remove sample aspect ratio info from bitstream if possible. The filter can currently modify the following properties in the stream configuration but not in the bitstream: -* HEVC: profile IDC, profile space, general compatibility flags -* VVC: profile IDC, general profile and level indication + +- HEVC: profile IDC, profile space, general compatibility flags +- VVC: profile IDC, general profile and level indication + The filter will work in passthrough mode for all other codecs and media types. diff --git a/docs/Filters/bssplit.md b/docs/Filters/bssplit.md index 3f4ef9db..0735456d 100644 --- a/docs/Filters/bssplit.md +++ b/docs/Filters/bssplit.md @@ -14,27 +14,36 @@ Splitting is based on temporalID value (start from 1) and layerID value (start f For AVC|H264, layerID is the dependency value, or quality value if `svcqid` is set. Each input stream is filtered according to the `ltid` option as follows: -* no value set: input stream is split by layerID, i.e. each layer creates an output -* `all`: input stream is split by layerID and temporalID, i.e. each {layerID,temporalID} creates an output -* `lID`: input stream is split according to layer `lID` value, and temporalID is ignored -* `.tID`: input stream is split according to temporal sub-layer `tID` value and layerID is ignored -* `lID.tID`: input stream is split according to layer `lID` and sub-layer `tID` values + +- no value set: input stream is split by layerID, i.e. each layer creates an output +- `all`: input stream is split by layerID and temporalID, i.e. each {layerID,temporalID} creates an output +- `lID`: input stream is split according to layer `lID` value, and temporalID is ignored +- `.tID`: input stream is split according to temporal sub-layer `tID` value and layerID is ignored +- `lID.tID`: input stream is split according to layer `lID` and sub-layer `tID` values + _Note: A tID value of 0 in `ltid` is equivalent to value 1._ Multiple values can be given in `ltid`, in which case each value gives the maximum {layerID,temporalID} values for the current layer. A few examples on an input with 2 layers each with 2 temporal sublayers: -* `ltid=0.2`: this will split the stream in: - - one stream with {lID=0,tID=1} and {lID=0,tID=2} NAL units - - one stream with all other layers/substreams -* `ltid=0.1,1.1`: this will split the stream in: - - one stream with {lID=0,tID=1} NAL units - - one stream with {lID=0,tID=2}, {lID=1,tID=1} NAL units - - one stream with the rest {lID=0,tID=2}, {lID=1,tID=2} NAL units -* `ltid=0.1,0.2`: this will split the stream in: - - one stream with {lID=0,tID=1} NAL units - - one stream with {lID=0,tID=2} NAL units - - one stream with the rest {lID=1,tID=1}, {lID=1,tID=2} NAL units + +- `ltid=0.2`: this will split the stream in: + + - one stream with {lID=0,tID=1} and {lID=0,tID=2} NAL units + - one stream with all other layers/substreams + +- `ltid=0.1,1.1`: this will split the stream in: + + - one stream with {lID=0,tID=1} NAL units + - one stream with {lID=0,tID=2}, {lID=1,tID=1} NAL units + - one stream with the rest {lID=0,tID=2}, {lID=1,tID=2} NAL units + +- `ltid=0.1,0.2`: this will split the stream in: + + - one stream with {lID=0,tID=1} NAL units + - one stream with {lID=0,tID=2} NAL units + - one stream with the rest {lID=1,tID=1}, {lID=1,tID=2} NAL units + The filter can also be used on AVC and HEVC DolbyVision streams to split base stream and DV RPU/EL. diff --git a/docs/Filters/cdcrypt.md b/docs/Filters/cdcrypt.md index b65a674a..61e81b97 100644 --- a/docs/Filters/cdcrypt.md +++ b/docs/Filters/cdcrypt.md @@ -18,12 +18,13 @@ When the file is set per PID, the first `CryptInfo` with the same ID is used, ot __cfile__ (str): crypt file location __decrypt__ (enum, default: _full_): decrypt mode (CENC only) -* full: decrypt everything, throwing error if keys are not found -* nokey: decrypt everything for which a key is found, skip decryption otherwise -* skip: decrypt nothing -* pad0: decrypt nothing and replace all crypted bits with 0 -* pad1: decrypt nothing and replace all crypted bits with 1 -* padsc: decrypt nothing and replace all crypted bytes with start codes + +- full: decrypt everything, throwing error if keys are not found +- nokey: decrypt everything for which a key is found, skip decryption otherwise +- skip: decrypt nothing +- pad0: decrypt nothing and replace all crypted bits with 0 +- pad1: decrypt nothing and replace all crypted bits with 1 +- padsc: decrypt nothing and replace all crypted bytes with start codes __drop_keys__ (uintl): consider keys with given 1-based indexes as not available (multi-key debug) __kids__ (strl): define KIDs. If `keys` is empty, consider keys with given KID (as hex string) as not available (debug) diff --git a/docs/Filters/compositor.md b/docs/Filters/compositor.md index 3b4bd5e7..b45c69c9 100644 --- a/docs/Filters/compositor.md +++ b/docs/Filters/compositor.md @@ -24,8 +24,10 @@ It will stop generating frames as soon as all input streams are done, unless ext If audio streams are loaded, an audio output PID is created. The default output pixel format in filter mode is: + - `rgb` when the filter is explicitly loaded by the application - `rgba` when the filter is loaded during a link resolution + This can be changed by assigning the [opfmt](#opfmt) option. If either [opfmt](#opfmt) specifies alpha channel or [bc](#bc) is not 0 but has alpha=0, background creation in default scene will be skipped. @@ -42,13 +44,17 @@ If 3D graphics are used or display driver is forced, OpenGL will be used on offs # Specific URL syntaxes The compositor accepts any URL type supported by GPAC. It also accepts the following schemes for URLs: -* views:// : creates an auto-stereo scene of N views from `views://v1::.::vN` -* mosaic:// : creates a mosaic of N views from `mosaic://v1::.::vN` + +- views:// : creates an auto-stereo scene of N views from `views://v1::.::vN` +- mosaic:// : creates a mosaic of N views from `mosaic://v1::.::vN` + For both syntaxes, `vN` can be any type of URL supported by GPAC. For `views://` syntax, the number of rendered views is set by [nbviews](#nbviews): + - If the URL gives less views than rendered, the views will be repeated - If the URL gives more views than rendered, the extra views will be ignored + The compositor can act as a source filter when the [src](#src) option is explicitly set, independently from the operating mode: Example @@ -66,9 +72,10 @@ gpac -i mosaic://URL1:URL2 vout # Options __aa__ (enum, default: _all_, updatable): set anti-aliasing mode for raster graphics; whether the setting is applied or not depends on the graphics module or graphic card -* none: no anti-aliasing -* text: anti-aliasing for text only -* all: complete anti-aliasing + +- none: no anti-aliasing +- text: anti-aliasing for text only +- all: complete anti-aliasing __hlfill__ (uint, default: _0x0_, updatable): set highlight fill color (ARGB) __hlline__ (uint, default: _0xFF000000_, updatable): set highlight stroke color (ARGB) @@ -81,14 +88,16 @@ gpac -i mosaic://URL1:URL2 vout __stress__ (bool, default: _false_, updatable): enable stress mode of compositor (rebuild all vector graphics and texture states at each frame) __fast__ (bool, default: _false_, updatable): enable speed optimization - whether the setting is applied or not depends on the graphics module / graphic card __bvol__ (enum, default: _no_, updatable): draw bounding volume of objects -* no: disable bounding box -* box: draws a rectangle (2D) or box (3D) -* aabb: draws axis-aligned bounding-box tree (3D) or rectangle (2D) + +- no: disable bounding box +- box: draws a rectangle (2D) or box (3D) +- aabb: draws axis-aligned bounding-box tree (3D) or rectangle (2D) __textxt__ (enum, default: _default_, updatable): specify whether text shall be drawn to a texture and then rendered or directly rendered. Using textured text can improve text rendering in 3D and also improve text-on-video like content -* default: use texturing for OpenGL rendering, no texture for 2D rasterizer -* never: never uses text textures -* always: always render text to texture before drawing + +- default: use texturing for OpenGL rendering, no texture for 2D rasterizer +- never: never uses text textures +- always: always render text to texture before drawing __out8b__ (bool, default: _false_, updatable): convert 10-bit video to 8 bit texture before GPU upload __drop__ (bool, default: _false_, updatable): drop late frame when drawing. If not set, frames are not dropped until a desynchronization of 1 second or more is observed @@ -103,9 +112,11 @@ gpac -i mosaic://URL1:URL2 vout __dur__ (dbl, default: _0_, updatable): duration of generation. Mostly used when no video input is present. Negative values mean number of frames, positive values duration in second, 0 stops as soon as all streams are done __fsize__ (bool, default: _false_, updatable): force the scene to resize to the biggest bitmap available if no size info is given in the BIFS configuration __mode2d__ (enum, default: _defer_, updatable): specify whether immediate drawing should be used or not -* immediate: the screen is completely redrawn at each frame (always on if pass-through mode is detected) -* defer: object positioning is tracked from frame to frame and dirty rectangles info is collected in order to redraw the minimal amount of the screen buffer -* debug: only renders changed areas, resetting other areas + +- immediate: the screen is completely redrawn at each frame (always on if pass-through mode is detected) +- defer: object positioning is tracked from frame to frame and dirty rectangles info is collected in order to redraw the minimal amount of the screen buffer +- debug: only renders changed areas, resetting other areas + Whether the setting is applied or not depends on the graphics module and player mode __amc__ (bool, default: _true_): audio multichannel support; if disabled always down-mix to stereo. Useful if the multichannel output does not work properly @@ -128,76 +139,86 @@ Whether the setting is applied or not depends on the graphics module and player __nojs__ (bool, default: _false_): disable javascript __noback__ (bool, default: _false_): ignore background nodes and viewport fill (useful when dumping to PNG) __ogl__ (enum, default: _auto_, updatable): specify 2D rendering mode -* auto: automatically decides between on, off and hybrid based on content -* off: disables OpenGL; 3D will not be rendered -* on: uses OpenGL for all graphics; this will involve polygon tesselation and 2D graphics will not look as nice as 2D mode -* hybrid: the compositor performs software drawing of 2D graphics with no textures (better quality) and uses OpenGL for all 2D objects with textures and 3D objects + +- auto: automatically decides between on, off and hybrid based on content +- off: disables OpenGL; 3D will not be rendered +- on: uses OpenGL for all graphics; this will involve polygon tesselation and 2D graphics will not look as nice as 2D mode +- hybrid: the compositor performs software drawing of 2D graphics with no textures (better quality) and uses OpenGL for all 2D objects with textures and 3D objects __pbo__ (bool, default: _false_, updatable): enable PixelBufferObjects to push YUV textures to GPU in OpenGL Mode. This may slightly increase the performances of the playback __nav__ (enum, default: _none_, updatable): override the default navigation mode of MPEG-4/VRML (Walk) and X3D (Examine) -* none: disables navigation -* walk: 3D world walk -* fly: 3D world fly (no ground detection) -* pan: 2D/3D world zoom/pan -* game: 3D world game (mouse gives walk direction) -* slide: 2D/3D world slide -* exam: 2D/3D object examine -* orbit: 3D object orbit -* vr: 3D world VR (yaw/pitch/roll) + +- none: disables navigation +- walk: 3D world walk +- fly: 3D world fly (no ground detection) +- pan: 2D/3D world zoom/pan +- game: 3D world game (mouse gives walk direction) +- slide: 2D/3D world slide +- exam: 2D/3D object examine +- orbit: 3D object orbit +- vr: 3D world VR (yaw/pitch/roll) __linegl__ (bool, default: _false_, updatable): indicate that outlining shall be done through OpenGL pen width rather than vectorial outlining __epow2__ (bool, default: _true_, updatable): emulate power-of-2 textures for OpenGL (old hardware). Ignored if OpenGL rectangular texture extension is enabled -* yes: video texture is not resized but emulated with padding. This usually speeds up video mapping on shapes but disables texture transformations -* no: video is resized to a power of 2 texture when mapping to a shape + +- yes: video texture is not resized but emulated with padding. This usually speeds up video mapping on shapes but disables texture transformations +- no: video is resized to a power of 2 texture when mapping to a shape __paa__ (bool, default: _false_, updatable): indicate whether polygon antialiasing should be used in full antialiasing mode. If not set, only lines and points antialiasing are used __bcull__ (enum, default: _on_, updatable): indicate whether backface culling shall be disable or not -* on: enables backface culling -* off: disables backface culling -* alpha: only enables backface culling for transparent meshes + +- on: enables backface culling +- off: disables backface culling +- alpha: only enables backface culling for transparent meshes __wire__ (enum, default: _none_, updatable): wireframe mode -* none: objects are drawn as solid -* only: objects are drawn as wireframe only -* solid: objects are drawn as solid and wireframe is then drawn + +- none: objects are drawn as solid +- only: objects are drawn as wireframe only +- solid: objects are drawn as solid and wireframe is then drawn __norms__ (enum, default: _none_, updatable): normal vector drawing for debug -* none: no normals drawn -* face: one normal per face drawn -* vertex: one normal per vertex drawn + +- none: no normals drawn +- face: one normal per face drawn +- vertex: one normal per vertex drawn __rext__ (bool, default: _true_, updatable): use non power of two (rectangular) texture GL extension __cull__ (bool, default: _true_, updatable): use aabb culling: large objects are rendered in multiple calls when not fully in viewport __depth_gl_scale__ (flt, default: _100_, updatable): set depth scaler __depth_gl_type__ (enum, default: _none_, updatable): set geometry type used to draw depth video -* none: no geometric conversion -* point: compute point cloud from pixel+depth -* strip: same as point but thins point set + +- none: no geometric conversion +- point: compute point cloud from pixel+depth +- strip: same as point but thins point set __nbviews__ (uint, default: _0_, updatable): number of views to use in stereo mode __stereo__ (enum, default: _none_, updatable): stereo output type. If your graphic card does not support OpenGL shaders, only `top` and `side` modes will be available -* none: no stereo -* side: images are displayed side by side from left to right -* top: images are displayed from top (laft view) to bottom (right view) -* hmd: same as side except that view aspect ratio is not changed -* ana: standard color anaglyph (red for left view, green and blue for right view) is used (forces views=2) -* cols: images are interleaved by columns, left view on even columns and left view on odd columns (forces views=2) -* rows: images are interleaved by columns, left view on even rows and left view on odd rows (forces views=2) -* spv5: images are interleaved by for SpatialView 5 views display, fullscreen mode (forces views=5) -* alio8: images are interleaved by for Alioscopy 8 views displays, fullscreen mode (forces views=8) -* custom: images are interleaved according to the shader file indicated in [mvshader](#mvshader). The shader is exposed each view as uniform sampler2D gfViewX, where X is the view number starting from the left + +- none: no stereo +- side: images are displayed side by side from left to right +- top: images are displayed from top (laft view) to bottom (right view) +- hmd: same as side except that view aspect ratio is not changed +- ana: standard color anaglyph (red for left view, green and blue for right view) is used (forces views=2) +- cols: images are interleaved by columns, left view on even columns and left view on odd columns (forces views=2) +- rows: images are interleaved by columns, left view on even rows and left view on odd rows (forces views=2) +- spv5: images are interleaved by for SpatialView 5 views display, fullscreen mode (forces views=5) +- alio8: images are interleaved by for Alioscopy 8 views displays, fullscreen mode (forces views=8) +- custom: images are interleaved according to the shader file indicated in [mvshader](#mvshader). The shader is exposed each view as uniform sampler2D gfViewX, where X is the view number starting from the left __mvshader__ (str, updatable): file path to the custom multiview interleaving shader __fpack__ (enum, default: _none_, updatable): default frame packing of input video -* none: no frame packing -* top: top bottom frame packing -* side: side by side packing + +- none: no frame packing +- top: top bottom frame packing +- side: side by side packing __camlay__ (enum, default: _offaxis_, updatable): camera layout in multiview modes -* straight: camera is moved along a straight line, no rotation -* offaxis: off-axis projection is used -* linear: camera is moved along a straight line with rotation -* circular: camera is moved along a circle with rotation + +- straight: camera is moved along a straight line, no rotation +- offaxis: off-axis projection is used +- linear: camera is moved along a straight line with rotation +- circular: camera is moved along a circle with rotation __iod__ (flt, default: _6.4_, updatable): inter-ocular distance (eye separation) in cm (distance between the cameras). __rview__ (bool, default: _false_, updatable): reverse view order @@ -205,9 +226,10 @@ Whether the setting is applied or not depends on the graphics module and player __tvtn__ (uint, default: _30_, updatable): number of point sampling for tile visibility algorithm __tvtt__ (uint, default: _8_, updatable): number of points above which the tile is considered visible __tvtd__ (enum, default: _off_, updatable): debug tiles and full coverage SRD -* off: regular draw -* partial: only displaying partial tiles, not the full sphere video -* full: only display the full sphere video + +- off: regular draw +- partial: only displaying partial tiles, not the full sphere video +- full: only display the full sphere video __tvtf__ (bool, default: _false_, updatable): force all tiles to be considered visible, regardless of viewpoint __fov__ (flt, default: _1.570796326794897_, updatable): default field of view for VR @@ -221,17 +243,19 @@ Whether the setting is applied or not depends on the graphics module and player __dpi__ (v2di, default: _96x96_, updatable): default dpi if not indicated by video output __dbgpvr__ (flt, default: _0_, updatable): debug scene used by PVR addon __player__ (enum, default: _no_): set compositor in player mode -* no: regular mode -* base: player mode -* gui: player mode with GUI auto-start + +- no: regular mode +- base: player mode +- gui: player mode with GUI auto-start __noaudio__ (bool, default: _false_): disable audio output __opfmt__ (pfmt, default: _none_, Enum: none|yuv420|yvu420|yuv420_10|yuv422|yuv422_10|yuv444|yuv444_10|uyvy|vyuy|yuyv|yvyu|uyvl|vyul|yuyl|yvyl|nv12|nv21|nv1l|nv2l|yuva|yuvd|yuv444a|yuv444p|v308|yuv444ap|v408|v410|v210|grey|algr|gral|rgb4|rgb5|rgb6|rgba|argb|bgra|abgr|rgb|bgr|xrgb|rgbx|xbgr|bgrx|rgbd|rgbds|uncv): pixel format to use for output. Ignored in [player](#player) mode __drv__ (enum, default: _auto_): indicate if graphics driver should be used -* no: never loads a graphics driver, software blit is used, no 3D possible (in player mode, disables OpenGL) -* yes: always loads a graphics driver, output pixel format will be RGB (in player mode, same as `auto`) -* auto: decides based on the loaded content + +- no: never loads a graphics driver, software blit is used, no 3D possible (in player mode, disables OpenGL) +- yes: always loads a graphics driver, output pixel format will be RGB (in player mode, same as `auto`) +- auto: decides based on the loaded content __src__ (cstr): URL of source content __gaze_x__ (sint, default: _0_, updatable): horizontal gaze coordinate (0=left, width=right) diff --git a/docs/Filters/core_config.md b/docs/Filters/core_config.md index 497284ff..342ee6be 100644 --- a/docs/Filters/core_config.md +++ b/docs/Filters/core_config.md @@ -3,18 +3,22 @@ # Configuration file GPAC uses a configuration file to modify default options of libgpac and filters. This file is called `GPAC.cfg` and is located: + - on Windows platforms, in `C:\Users\FOO\AppData\Roaming\GPAC` or in `C:\Program Files\GPAC`. - on iOS platforms, in a .gpac folder in the app storage directory. - on Android platforms, in `/sdcard/GPAC/` if this directory exists, otherwise in `/data/data/io.gpac.gpac/GPAC`. - on other platforms, in a `$HOME/.gpac/`. + Applications in GPAC can also specify a different configuration file through the [-p](gpac_general/#p) profile option. EX gpac -p=foo [] This will load configuration from $HOME/.gpac/foo/GPAC.cfg, creating it if needed. The reserved name `0` is used to disable configuration file writing. The configuration file is structured in sections, each made of one or more keys: + - section `foo` is declared as `[foo]\n` - key `bar` with value `N` is declared as `bar=N\n`. The key value `N` is not interpreted and always handled as ASCII text. + By default the configuration file only holds a few system specific options and directories. It is possible to serialize the entire set of options to the configuration file, using [-wc](gpac_general/#wc) [-wf](gpac_general/#wf). This should be avoided as the resulting configuration file size will be quite large, hence larger memory usage for the applications. diff --git a/docs/Filters/core_logs.md b/docs/Filters/core_logs.md index cf6bbf54..3d5e9ed0 100644 --- a/docs/Filters/core_logs.md +++ b/docs/Filters/core_logs.md @@ -13,40 +13,44 @@ You can independently log different tools involved in a session. log_args is formatted as a colon (':') separated list of `toolX[:toolZ]@levelX` `levelX` can be one of: -* quiet: skip logs -* error: logs only error messages -* warning: logs error+warning messages -* info: logs error+warning+info messages -* debug: logs all messages + +- quiet: skip logs +- error: logs only error messages +- warning: logs error+warning messages +- info: logs error+warning+info messages +- debug: logs all messages + `toolX` can be one of: -* core: libgpac core -* mutex: log all mutex calls -* mem: GPAC memory tracker -* module: GPAC modules (av out, font engine, 2D rasterizer) -* filter: filter session debugging -* sched: filter session scheduler debugging -* codec: codec messages (used by encoder and decoder filters) -* coding: bitstream formats (audio, video, scene) -* container: container formats (ISO File, MPEG-2 TS, AVI, ...) and multiplexer/demultiplexer filters -* network: TCP/UDP sockets and TLS -* http: HTTP traffic -* cache: HTTP cache subsystem -* rtp: RTP traffic -* dash: HTTP streaming logs -* route: ROUTE (ATSC3) debugging -* media: messages from generic filters and reframer/rewriter filters -* parser: textual parsers (svg, xmt, bt, ...) -* mmio: I/O management (AV devices, file, pipes, OpenGL) -* audio: audio renderer/mixer/output -* script: script engine except console log -* console: script console log -* scene: scene graph and scene manager -* compose: composition engine (2D, 3D, etc) -* ctime: media and SMIL timing info from composition engine -* interact: interaction messages (UI events and triggered DOM events and VRML route) -* rti: run-time stats of compositor -* all: all tools logged - other tools can be specified afterwards. + +- core: libgpac core +- mutex: log all mutex calls +- mem: GPAC memory tracker +- module: GPAC modules (av out, font engine, 2D rasterizer) +- filter: filter session debugging +- sched: filter session scheduler debugging +- codec: codec messages (used by encoder and decoder filters) +- coding: bitstream formats (audio, video, scene) +- container: container formats (ISO File, MPEG-2 TS, AVI, ...) and multiplexer/demultiplexer filters +- network: TCP/UDP sockets and TLS +- http: HTTP traffic +- cache: HTTP cache subsystem +- rtp: RTP traffic +- dash: HTTP streaming logs +- route: ROUTE (ATSC3) debugging +- media: messages from generic filters and reframer/rewriter filters +- parser: textual parsers (svg, xmt, bt, ...) +- mmio: I/O management (AV devices, file, pipes, OpenGL) +- audio: audio renderer/mixer/output +- script: script engine except console log +- console: script console log +- scene: scene graph and scene manager +- compose: composition engine (2D, 3D, etc) +- ctime: media and SMIL timing info from composition engine +- interact: interaction messages (UI events and triggered DOM events and VRML route) +- rti: run-time stats of compositor +- all: all tools logged - other tools can be specified afterwards. + The special keyword `ncl` can be set to disable color logs. The special keyword `strict` can be set to exit at first error. diff --git a/docs/Filters/core_options.md b/docs/Filters/core_options.md index 083c90c8..ebfa074c 100644 --- a/docs/Filters/core_options.md +++ b/docs/Filters/core_options.md @@ -14,12 +14,13 @@ __-ifce__ (string): set default multicast interface (default is ANY), either an IP address or a device name as listed by `gpac -h net`. Prefix '+' will force using IPv6 for dual interface __-lang__ (string): set preferred language __-cfg__,__-opt__ (string): get or set configuration file value. The string parameter can be formatted as: -* `section:key=val`: set the key to a new value -* `section:key=null`, `section:key`: remove the key -* `section=null`: remove the section -* no argument: print the entire configuration file -* `section`: print the given section -* `section:key`: print the given `key` in `section` (section can be set to `*`)- `*:key`: print the given `key` in all sections + +- `section:key=val`: set the key to a new value +- `section:key=null`, `section:key`: remove the key +- `section=null`: remove the section +- no argument: print the entire configuration file +- `section`: print the given section +- `section:key`: print the given `key` in `section` (section can be set to `*`)- `*:key`: print the given `key` in all sections __-no-save__: discard any changes made to the config file upon exit __-mod-reload__: unload / reload module shared libs when no longer used @@ -40,22 +41,26 @@ __-xml-max-csize__ (int, default: __100k__): maximum XML content or attribute size __-netcap__ (string): set packet capture and filtering rules formatted as [CFG][RULES]. Each `-netcap` argument will define a configuration [CFG] is an optional comma-separated list of: -* id=ID: ID (string) for this configuration. If NULL, configuration will apply to all sockets not specifying a netcap ID -* src=F: read packets from `F`, as produced by GPAC or a pcap or pcapng file -* dst=F: output packets to `F` (GPAC or pcap/pcapng file), cannot be set if src is set -* loop[=N]: loop capture file N times, or forever if N is not set or negative -* nrt: disable real-time playback + +- id=ID: ID (string) for this configuration. If NULL, configuration will apply to all sockets not specifying a netcap ID +- src=F: read packets from `F`, as produced by GPAC or a pcap or pcapng file +- dst=F: output packets to `F` (GPAC or pcap/pcapng file), cannot be set if src is set +- loop[=N]: loop capture file N times, or forever if N is not set or negative +- nrt: disable real-time playback + [RULES] is an optional list of `[OPT,OPT2...]` with OPT in: -* m=K: set rule mode - `K` can be `r` for reception only (default), `w` for send only or `rw` for both -* s=K: set packet start range to `K` -* e=K: set packet end range to `K` - only used for `r` and `f` rules, 0 or not set means rule apply until end -* n=K: set number of packets to drop to `K` - not set, 0 or 1 means single packet -* r=K: random drop `n` packet every `K` -* f=K: drop first `n` packets every `K` -* d=K: reorder `n` packets after the next `K` packets, can be used with `f` or `r` rules -* p=K: filter packets on port `K` only, if not set the rule applies to all packets -* o=K: patch packet instead of droping (always true for TCP), replacing byte at offset `K` (0 is first byte, <0 for random) -* v=K: set patch byte value to `K` (hexa) or negative value for random (default) + +- m=K: set rule mode - `K` can be `r` for reception only (default), `w` for send only or `rw` for both +- s=K: set packet start range to `K` +- e=K: set packet end range to `K` - only used for `r` and `f` rules, 0 or not set means rule apply until end +- n=K: set number of packets to drop to `K` - not set, 0 or 1 means single packet +- r=K: random drop `n` packet every `K` +- f=K: drop first `n` packets every `K` +- d=K: reorder `n` packets after the next `K` packets, can be used with `f` or `r` rules +- p=K: filter packets on port `K` only, if not set the rule applies to all packets +- o=K: patch packet instead of droping (always true for TCP), replacing byte at offset `K` (0 is first byte, <0 for random) +- v=K: set patch byte value to `K` (hexa) or negative value for random (default) + Example ``` @@ -76,9 +81,7 @@ Example This will use regular network interface and drop packets 100 to 119 on port 1234 and patch one random packet every 200 starting from packet 500, setting byte 10 to FE __-cache__ (string): cache directory location -__-proxy-on__: enable HTTP proxy -__-proxy-name__ (string): set HTTP proxy address -__-proxy-port__ (int, default: __80__): set HTTP proxy port +__-proxy__ (string): set HTTP proxy server address and port __-maxrate__ (int): set max HTTP download rate in bits per sec. 0 means unlimited __-no-cache__: disable HTTP caching __-offline-cache__: enable offline HTTP caching (no re-validation of existing resource in cache) @@ -95,25 +98,33 @@ This will use regular network interface and drop packets 100 to 119 on port 1234 __-dm-threads__: force using threads for async download requests rather than session scheduler __-cte-rate-wnd__ (int, default: __20__): set window analysis length in milliseconds for chunk-transfer encoding rate estimation __-cred__ (string): path to 128 bits key for credential storage +__-no-h2__: disable HTTP2 +__-no-h2c__: disable HTTP2 upgrade (i.e. over non-TLS) +__-h2-copy__: enable intermediate copy of data in nghttp2 (default is disabled but may report as broken frames in wireshark) +__-curl__: use CURL instead of GPAC HTTP stack +__-no-h3__: disable HTTP3 (CURL only) __-dbg-edges__: log edges status in filter graph before dijkstra resolution (for debug). Edges are logged as edge_source(status(disable_depth), weight, src_cap_idx -> dst_cap_idx) __-full-link__: throw error if any PID in the filter graph cannot be linked __-no-dynf__: disable dynamically loaded filters __-no-block__ (Enum, default: __no__): disable blocking mode of filters -* no: enable blocking mode -* fanout: disable blocking on fan-out, unblocking the PID as soon as one of its destinations requires a packet -* all: disable blocking + +- no: enable blocking mode +- fanout: disable blocking on fan-out, unblocking the PID as soon as one of its destinations requires a packet +- all: disable blocking __-no-reg__: disable regulation (no sleep) in session __-no-reassign__: disable source filter reassignment in PID graph resolution __-sched__ (Enum, default: __free__): set scheduler mode -* free: lock-free queues except for task list (default) -* lock: mutexes for queues when several threads -* freex: lock-free queues including for task lists (experimental) -* flock: mutexes for queues even when no thread (debug mode) -* direct: no threads and direct dispatch of tasks whenever possible (debug mode) + +- free: lock-free queues except for task list (default) +- lock: mutexes for queues when several threads +- freex: lock-free queues including for task lists (experimental) +- flock: mutexes for queues even when no thread (debug mode) +- direct: no threads and direct dispatch of tasks whenever possible (debug mode) __-max-chain__ (int, default: __6__): set maximum chain length when resolving filter links. Default value covers for _[ in -> ] dmx -> reframe -> decode -> encode -> reframe -> mx [ -> out]_. Filter chains loaded for adaptation (e.g. pixel format change) are loaded after the link resolution. Setting the value to 0 disables dynamic link resolution. You will have to specify the entire chain manually __-max-sleep__ (int, default: __50__): set maximum sleep time slot in milliseconds when regulation is enabled +__-step-link__: load filters one by one when solvink a link instead of loading all filters for the solved path __-threads__ (int): set N extra thread for the session. -1 means use all available cores __-no-probe__: disable data probing on sources and relies on extension (faster load but more error-prone) __-no-argchk__: disable tracking of argument usage (all arguments will be considered as used) @@ -135,10 +146,11 @@ This will use regular network interface and drop packets 100 to 119 on port 1234 __-wait-fonts__: wait for SVG fonts to be loaded before displaying frames __-webvtt-hours__: force writing hour when serializing WebVTT __-charset__ (string): set charset when not recognized from input. Possible values are: -* utf8: force UTF-8 -* utf16: force UTF-16 little endian -* utf16be: force UTF-16 big endian -* other: attempt to parse anyway + +- utf8: force UTF-8 +- utf16: force UTF-16 little endian +- utf16be: force UTF-16 big endian +- other: attempt to parse anyway __-rmt__: enable profiling through [Remotery](https://github.com/Celtoys/Remotery). A copy of Remotery visualizer is in gpac/share/vis, usually installed in _/usr/share/gpac/vis_ or _Program Files/GPAC/vis_ __-rmt-port__ (int, default: __17815__): set remotery port diff --git a/docs/Filters/dasher.md b/docs/Filters/dasher.md index 153274cb..aa60983a 100644 --- a/docs/Filters/dasher.md +++ b/docs/Filters/dasher.md @@ -8,12 +8,14 @@ This filter requires the graph resolver to be activated. This filter provides segmentation and manifest generation for MPEG-DASH and HLS formats. The segmenter currently supports: + - MPD and m3u8 generation (potentially in parallel) - ISOBMFF, MPEG-2 TS, MKV and raw bitstream segment formats - override of profiles and levels in manifest for codecs - most MPEG-DASH profiles - static and dynamic (live) manifest offering - context store and reload for batch processing of live/dynamic sessions + The filter does perform per-segment real-time regulation using [sreg](#sreg). If you need per-frame real-time regulation on non-real-time inputs, insert a [reframer](reframer) before to perform real-time regulation. @@ -36,45 +38,55 @@ template=Great_$File$_$Width$ If input is `foo.mp4` with `640x360` video resolution, this will resolve in `Great_foo_640.mp4` for onDemand case. Standard DASH replacement strings: -* $Number[%%0Nd]$: replaced by the segment number, possibly prefixed with 0 -* $RepresentationID$: replaced by representation name -* $Time$: replaced by segment start time -* $Bandwidth$: replaced by representation bandwidth. + +- $Number[%%0Nd]$: replaced by the segment number, possibly prefixed with 0 +- $RepresentationID$: replaced by representation name +- $Time$: replaced by segment start time +- $Bandwidth$: replaced by representation bandwidth. + _Note: these strings are not replaced in the manifest templates elements._ Additional replacement strings (not DASH, not generic GPAC replacements but may occur multiple times in template): -* $Init=NAME$: replaced by NAME for init segment, ignored otherwise -* $XInit=NAME$: complete replace by NAME for init segment, ignored otherwise -* $InitExt=EXT$: replaced by EXT for init segment file extensions, ignored otherwise -* $Index=NAME$: replaced by NAME for index segments, ignored otherwise -* $Path=PATH$: replaced by PATH when creating segments, ignored otherwise -* $Segment=NAME$: replaced by NAME for media segments, ignored for init segments -* $SegExt=EXT$: replaced by EXT for media segment file extensions, ignored for init segments -* $FS$ (FileSuffix): replaced by `_trackN` in case the input is an AV multiplex, or kept empty otherwise + +- $Init=NAME$: replaced by NAME for init segment, ignored otherwise +- $XInit=NAME$: complete replace by NAME for init segment, ignored otherwise +- $InitExt=EXT$: replaced by EXT for init segment file extensions, ignored otherwise +- $Index=NAME$: replaced by NAME for index segments, ignored otherwise +- $Path=PATH$: replaced by PATH when creating segments, ignored otherwise +- $Segment=NAME$: replaced by NAME for media segments, ignored for init segments +- $SegExt=EXT$: replaced by EXT for media segment file extensions, ignored for init segments +- $FS$ (FileSuffix): replaced by `_trackN` in case the input is an AV multiplex, or kept empty otherwise + _Note: these strings are replaced in the manifest templates elements._ ## PID assignment and configuration To assign PIDs into periods and adaptation sets and configure the session, the segmenter looks for the following properties on each input PID: -* `Representation`: assigns representation ID to input PID. If not set, the default behavior is to have each media component in different adaptation sets. Setting the `Representation` allows explicit multiplexing of the source(s) -* `Period`: assigns period ID to input PID. If not set, the default behavior is to have all media in the same period with the same start time -* `PStart`: assigns period start. If not set, 0 is assumed, and periods appear in the Period ID declaration order. If negative, this gives the period order (-1 first, then -2 ...). If positive, this gives the true start time and will abort DASHing at period end + +- `Representation`: assigns representation ID to input PID. If not set, the default behavior is to have each media component in different adaptation sets. Setting the `Representation` allows explicit multiplexing of the source(s) +- `Period`: assigns period ID to input PID. If not set, the default behavior is to have all media in the same period with the same start time +- `PStart`: assigns period start. If not set, 0 is assumed, and periods appear in the Period ID declaration order. If negative, this gives the period order (-1 first, then -2 ...). If positive, this gives the true start time and will abort DASHing at period end + _Note: When both positive and negative values are found, the by-order periods (negative) will be inserted AFTER the timed period (positive)_ -* `ASID`: assigns parent adaptation set ID. If not 0, only sources with same AS ID will be in the same adaptation set + +- `ASID`: assigns parent adaptation set ID. If not 0, only sources with same AS ID will be in the same adaptation set + _Note: If multiple streams in source, only the first stream will have an AS ID assigned_ -* `xlink`: for remote periods, only checked for null PID -* `Role`, `PDesc`, `ASDesc`, `ASCDesc`, `RDesc`: various descriptors to set for period, AS or representation -* `BUrl`: overrides segmenter [-base] with a set of BaseURLs to use for the PID (per representation) -* `Template`: overrides segmenter [template](#template) for this PID -* `DashDur`: overrides segmenter segment duration for this PID -* `StartNumber`: sets the start number for the first segment in the PID, default is 1 -* `IntraOnly`: indicates input PID follows HLS EXT-X-I-FRAMES-ONLY guidelines -* `CropOrigin`: indicates x and y coordinates of video for SRD (size is video size) -* `SRD`: indicates SRD position and size of video for SRD, ignored if `CropOrigin` is set -* `SRDRef`: indicates global width and height of SRD, ignored if `CropOrigin` is set -* `HLSPL`: name of variant playlist, can use templates -* `HLSMExt`: list of extensions to add to master playlist entries, ['foo','bar=val'] added as `,foo,bar=val` -* `HLSVExt`: list of extensions to add to variant playlist, ['#foo','#bar=val'] added as `#foo \n #bar=val` -* Non-dash properties: `Bitrate`, `SAR`, `Language`, `Width`, `Height`, `SampleRate`, `NumChannels`, `Language`, `ID`, `DependencyID`, `FPS`, `Interlaced`, `Codec`. These properties are used to setup each representation and can be overridden on input PIDs using the general PID property settings (cf global help). + +- `xlink`: for remote periods, only checked for null PID +- `Role`, `PDesc`, `ASDesc`, `ASCDesc`, `RDesc`: various descriptors to set for period, AS or representation +- `BUrl`: overrides segmenter [-base] with a set of BaseURLs to use for the PID (per representation) +- `Template`: overrides segmenter [template](#template) for this PID +- `DashDur`: overrides segmenter segment duration for this PID +- `StartNumber`: sets the start number for the first segment in the PID, default is 1 +- `IntraOnly`: indicates input PID follows HLS EXT-X-I-FRAMES-ONLY guidelines +- `CropOrigin`: indicates x and y coordinates of video for SRD (size is video size) +- `SRD`: indicates SRD position and size of video for SRD, ignored if `CropOrigin` is set +- `SRDRef`: indicates global width and height of SRD, ignored if `CropOrigin` is set +- `HLSPL`: name of variant playlist, can use templates +- `HLSMExt`: list of extensions to add to master playlist entries, ['foo','bar=val'] added as `,foo,bar=val` +- `HLSVExt`: list of extensions to add to variant playlist, ['#foo','#bar=val'] added as `#foo \n #bar=val` +- Non-dash properties: `Bitrate`, `SAR`, `Language`, `Width`, `Height`, `SampleRate`, `NumChannels`, `Language`, `ID`, `DependencyID`, `FPS`, `Interlaced`, `Codec`. These properties are used to setup each representation and can be overridden on input PIDs using the general PID property settings (cf global help). + Example ``` @@ -149,19 +161,25 @@ This will put video segments and playlist in `dash/video/` and audio segments an ## Segmentation The default behavior of the segmenter is to estimate the theoretical start time of each segment based on target segment duration, and start a new segment when a packet with SAP type 1,2,3 or 4 with time greater than the theoretical time is found. This behavior can be changed to find the best SAP packet around a segment theoretical boundary using [sbound](#sbound): -* `closest` mode: the segment will start at the closest SAP of the theoretical boundary -* `in` mode: the segment will start at or before the theoretical boundary + +- `closest` mode: the segment will start at the closest SAP of the theoretical boundary +- `in` mode: the segment will start at or before the theoretical boundary + __Warning: These modes will introduce delay in the segmenter (typically buffering of one GOP) and should not be used for low-latency modes.__ The segmenter can also be configured to: + - completely ignore SAP when segmenting using [sap](#sap). - ignore SAP on non-video streams when segmenting using [strict_sap](#strict_sap). + When [seg_sync](#seg_sync) is disabled, the segmenter will by default announce a new segment in the manifest(s) as soon as its size/offset is known or its name is known, but the segment (or part in LL-HLS) may still not be completely written/sent. This may result in temporary mismatches between segment/part size currently received versus size as advertized in manifest. When [seg_sync](#seg_sync) is enabled, the segmenter will wait for the last byte of the fragment/segment to be pushed before announcing a new segment in the manifest(s). This can however slightly increase the latency in MPEG-DASH low-latency. +When (-sflush)[] is set to `single`, segmentation is skipped and a single segment is generated per input. + ## Dynamic (real-time live) Mode The dasher does not perform real-time regulation by default. For regular segmentation, you should enable segment regulation [sreg](#sreg) if your sources are not real-time. @@ -171,9 +189,11 @@ gpac -i source.mp4 -o live.mpd:segdur=2:profile=live:dmode=dynamic:sreg ``` For low latency segmentation with fMP4, you will need to specify the following options: -* cdur: set the fMP4 fragment duration -* asto: set the availability time offset for DASH. This value should be equal or slightly greater than segment duration minus cdur -* llhls: enable low latency for HLS + +- cdur: set the fMP4 fragment duration +- asto: set the availability time offset for DASH. This value should be equal or slightly greater than segment duration minus cdur +- llhls: enable low latency for HLS + _Note: [llhls](#llhls) does not force `cmaf` mode to allow for multiplexed media in segments but it enforces to `tfdt_traf` in the muxer._ @@ -219,15 +239,19 @@ The segmenter can take a list of instructions, or Cues, to use for the segmentat Cue files can be specified for the entire segmenter, or per PID using `DashCue` property. Cues are given in an XML file with a root element called <DASHCues>, with currently no attribute specified. The children are one or more <Stream> elements, with attributes: -* id: integer for stream/track/PID ID -* timescale: integer giving the units of following timestamps -* mode: if present and value is `edit`, the timestamp are in presentation time (edit list applied) otherwise they are in media time -* ts_offset: integer giving a value (in timescale) to subtract to the DTS/CTS values listed + +- id: integer for stream/track/PID ID +- timescale: integer giving the units of following timestamps +- mode: if present and value is `edit`, the timestamp are in presentation time (edit list applied) otherwise they are in media time +- ts_offset: integer giving a value (in timescale) to subtract to the DTS/CTS values listed + The children of <Stream> are one or more <Cue> elements, with attributes: -* sample: integer giving the sample/frame number of a sample at which splitting shall happen -* dts: long integer giving the decoding time stamp of a sample at which splitting shall happen -* cts: long integer giving the composition / presentation time stamp of a sample at which splitting shall happen + +- sample: integer giving the sample/frame number of a sample at which splitting shall happen +- dts: long integer giving the decoding time stamp of a sample at which splitting shall happen +- cts: long integer giving the composition / presentation time stamp of a sample at which splitting shall happen + __Warning: Cues shall be listed in decoding order.__ @@ -246,13 +270,17 @@ The segmenter can be used to generate manifests from already fragmented ISOBMFF In this case, segment boundaries are attached to each packet starting a segment and used to drive the segmentation. This can be used with single-track ISOBMFF sources, either single file or multi file. For single file source: + - if onDemand [profile](#profile) is requested, sources have to be formatted as a DASH self-initializing media segment with the proper sidx. - templates are disabled. - [sseg](#sseg) is forced for all profiles except onDemand ones. + For multi files source: + - input shall be a playlist containing the initial file followed by the ordered list of segments. - if no [template](#template) is provided, the full or main [profile](#profile) will be used -* if [-template]() is provided, it shall be correct: the filter will not try to guess one from the input file names and will not validate it either. +- if [-template]() is provided, it shall be correct: the filter will not try to guess one from the input file names and will not validate it either. + The manifest generation-only mode supports both MPD and HLS generation. @@ -285,9 +313,11 @@ The segmentation logic is not changed, and packets are forwarded with the same i Output PIDs are forwarded with `DashCue=inband` property, so that any subsequent dasher follows the same segmentation process (see above). The first packet in a segment has: + - property `FileNumber` (and, if multiple files, `FileName`) set as usual - property `CueStart` set - property `DFPStart=0` set if this is the first packet in a period + This mode can be used to pre-segment the streams for later processing that must take place before final dashing. Example @@ -300,9 +330,11 @@ Example gpac -i s1.mp4 -i s2.mp4:#CryptInfo=clear:#Period=3 -i s3.mp4:#Period=3 dasher:gencues cecrypt:cfile=roll_period.xml -o live.mpd ``` If the DRM file uses `keyRoll=period`, this will generate: + - first period crypted with one key - second period clear - third period crypted with another key + ## Forced-Template mode When [tpl_force](#tpl_force) is set, the [template](#template) string is not analyzed nor modified for missing elements. @@ -315,6 +347,46 @@ This will trash the manifest and open `mypipe` as destination for the muxer resu __Warning: Options for segment destination cannot be set through the [template](#template), global options must be used.__ +## Batch Operations +The segmentation can be performed in multiple calls using a DASH context set with [state](#state). +Between calls, the PIDs are reassigned by checking that the PID ID match between the calls and: + +- the input file names match between the calls +- or the representation ID (and period ID if specified) match between the calls + + +If a PID is not matched, it will be assigned to a new period. + +The default behaviour assume that the same inputs are used for segmentation and rebuilds a contiguous timeline at each new file start. +If the inputs change but form a continuous timeline, [-keep_ts])() must be used to skip timeline reconstruction. + +The inputs will be segmented for a duration of [subdur](#subdur) if set, otherwise the input media duration. +When inputs are over, they are restarted if [loop](#loop) is set otherwise a new period is created. +To avoid this behaviour, the [sflush](#sflush) option should be set to `end` or `single`, indicating that further sources for the same representations will be added in subsequent calls. When [sflush](#sflush) is not `off`, the (-loop)[] option is ignored. + +Example +``` +gpac -i SRC -o dash.mpd:segdur=2:state=CTX && gpac -i SRC -o dash.mpd:segdur=2:state=CTX +``` +This will generate all dash segments for `SRC` (last one possibly shorter) and create a new period at end of input. +Example +``` +gpac -i SRC -o dash.mpd:segdur=2:state=CTX:loop && gpac -i SRC -o dash.mpd:segdur=2:state=CTX:loop +``` +This will generate all dash segments for `SRC` and restart `SRC` to fill-up last segment. +Example +``` +gpac -i SRC -o dash.mpd:segdur=2:state=CTX:sflush=end && gpac -i SRC -o dash.mpd:segdur=2:state=CTX:sflush=end +``` +This will generate all dash segments for `SRC` without looping/closing the period at end of input. Timestamps in the second call will be rewritten to be contiguous with timestamp at end of first call. +Example +``` +gpac -i SRC1 -o dash.mpd:segdur=2:state=CTX:sflush=end:keep_ts && gpac -i SRC2 -o dash.mpd:segdur=2:state=CTX:sflush=end:keep_ts +``` +This will generate all dash segments for `SRC1` without looping/closing the period at end of input, then for `SRC2`. Timestamps of the sources will not be rewritten. + +_Note: The default behaviour of MP4Box `-dash-ctx` option is to set the (-loop)[] to true._ + ## Output redirecting When loaded implicitly during link resolution, the dasher will only link its outputs to the target sink Example @@ -335,25 +407,32 @@ When explicitly loading the filter, the [dual](#dual) option will be disabled un ## Multiplexer development considerations Output multiplexers allowing segmented output must obey the following: + - inspect packet properties - * FileNumber: if set, indicate the start of a new DASH segment - * FileName: if set, indicate the file name. If not present, output shall be a single file. This is only set for packet carrying the `FileNumber` property, and only on one PID (usually the first) for multiplexed outputs - * IDXName: gives the optional index name. If not present, index shall be in the same file as dash segment. Only used for MPEG-2 TS for now - * EODS: property is set on packets with no payload and no timestamp to signal the end of a DASH segment. This is only used when stopping/resuming the segmentation process, in order to flush segments without dispatching an EOS (see [subdur](#subdur) ) + + - FileNumber: if set, indicate the start of a new DASH segment + - FileName: if set, indicate the file name. If not present, output shall be a single file. This is only set for packet carrying the `FileNumber` property, and only on one PID (usually the first) for multiplexed outputs + - IDXName: gives the optional index name. If not present, index shall be in the same file as dash segment. Only used for MPEG-2 TS for now + - EODS: property is set on packets with no payload and no timestamp to signal the end of a DASH segment. This is only used when stopping/resuming the segmentation process, in order to flush segments without dispatching an EOS (see [subdur](#subdur) ) + - for each segment done, send a downstream event on the first connected PID signaling the size of the segment and the size of its index if any - for multiplexers with init data, send a downstream event signaling the size of the init and the size of the global index if any - the following filter options are passed to multiplexers, which should declare them as arguments: - * noinit: disables output of init segment for the multiplexer (used to handle bitstream switching with single init in DASH) - * frag: indicates multiplexer shall use fragmented format (used for ISOBMFF mostly) - * subs_sidx=0: indicates an SIDX shall be generated - only added if not already specified by user - * xps_inband=all|no|both: indicates AVC/HEVC/... parameter sets shall be sent inband, out of band, or both - * nofragdef: indicates fragment defaults should be set in each segment rather than in init segment + + - noinit: disables output of init segment for the multiplexer (used to handle bitstream switching with single init in DASH) + - frag: indicates multiplexer shall use fragmented format (used for ISOBMFF mostly) + - subs_sidx=0: indicates an SIDX shall be generated - only added if not already specified by user + - xps_inband=all|no|both: indicates AVC/HEVC/... parameter sets shall be sent inband, out of band, or both + - nofragdef: indicates fragment defaults should be set in each segment rather than in init segment + The segmenter adds the following properties to the output PIDs: -* DashMode: identifies VoD (single file with global index) or regular DASH mode used by segmenter -* DashDur: identifies target DASH segment duration - this can be used to estimate the SIDX size for example -* LLHLS: identifies LLHLS is used; the multiplexer must send fragment size events back to the dasher, and set `LLHLSFragNum` on the first packet of each fragment -* SegSync: indicates that fragments/segments must be completely flushed before sending back size events + +- DashMode: identifies VoD (single file with global index) or regular DASH mode used by segmenter +- DashDur: identifies target DASH segment duration - this can be used to estimate the SIDX size for example +- LLHLS: identifies LLHLS is used; the multiplexer must send fragment size events back to the dasher, and set `LLHLSFragNum` on the first packet of each fragment +- SegSync: indicates that fragments/segments must be completely flushed before sending back size events + # Options @@ -362,10 +441,11 @@ The segmenter adds the following properties to the output PIDs: __tpl__ (bool, default: _true_): use template mode (multiple segment, template URLs) __stl__ (bool, default: _false_): use segment timeline (ignored in on_demand mode) __dmode__ (enum, default: _static_, updatable): dash content mode -* static: static content -* dynamic: live generation -* dynlast: last call for live, will turn the MPD into static -* dynauto: live generation and move to static manifest upon end of stream + +- static: static content +- dynamic: live generation +- dynlast: last call for live, will turn the MPD into static +- dynauto: live generation and move to static manifest upon end of stream __sseg__ (bool, default: _false_): single segment is used __sfile__ (bool, default: _false_): use a single file for all segments (default in on_demand) @@ -373,59 +453,65 @@ The segmenter adds the following properties to the output PIDs: __sap__ (bool, default: _true_): enable splitting segments at SAP boundaries __mix_codecs__ (bool, default: _false_): enable mixing different codecs in an adaptation set __ntp__ (enum, default: _rem_): insert/override NTP clock at the beginning of each segment -* rem: removes NTP from all input packets -* yes: inserts NTP at each segment start -* keep: leaves input packet NTP untouched + +- rem: removes NTP from all input packets +- yes: inserts NTP at each segment start +- keep: leaves input packet NTP untouched __no_sar__ (bool, default: _false_): do not check for identical sample aspect ratio for adaptation sets __bs_switch__ (enum, default: _def_): bitstream switching mode (single init segment) -* def: resolves to off for onDemand and inband for live -* off: disables BS switching -* on: enables it if same decoder configuration is possible -* inband: moves decoder config inband if possible -* both: inband and outband parameter sets -* pps: moves PPS and APS inband, keep VPS,SPS and DCI out of band (used for VVC RPR) -* force: enables it even if only one representation -* multi: uses multiple stsd entries in ISOBMFF + +- def: resolves to off for onDemand and inband for live +- off: disables BS switching +- on: enables it if same decoder configuration is possible +- inband: moves decoder config inband if possible +- both: inband and outband parameter sets +- pps: moves PPS and APS inband, keep VPS,SPS and DCI out of band (used for VVC RPR) +- force: enables it even if only one representation +- multi: uses multiple stsd entries in ISOBMFF __template__ (str): template string to use to generate segment name __segext__ (str): file extension to use for segments __initext__ (str): file extension to use for the init segment __muxtype__ (enum, default: _auto_): muxtype to use for the segments -* mp4: uses ISOBMFF format -* ts: uses MPEG-2 TS format -* mkv: uses Matroska format -* webm: uses WebM format -* ogg: uses OGG format -* raw: uses raw media format (disables multiplexed representations) -* auto: guess format based on extension, default to mp4 if no extension + +- mp4: uses ISOBMFF format +- ts: uses MPEG-2 TS format +- mkv: uses Matroska format +- webm: uses WebM format +- ogg: uses OGG format +- raw: uses raw media format (disables multiplexed representations) +- auto: guess format based on extension, default to mp4 if no extension __rawsub__ (bool, default: _no_): use raw subtitle format instead of encapsulating in container __asto__ (dbl, default: _0_): availabilityStartTimeOffset to use in seconds. A negative value simply increases the AST, a positive value sets the ASToffset to representations __profile__ (enum, default: _auto_): target DASH profile. This will set default option values to ensure conformance to the desired profile. For MPEG-2 TS, only main and live are used, others default to main -* auto: turns profile to live for dynamic and full for non-dynamic -* live: DASH live profile, using segment template -* onDemand: MPEG-DASH live profile -* main: MPEG-DASH main profile, using segment list -* full: MPEG-DASH full profile -* hbbtv1.5.live: HBBTV 1.5 DASH profile -* dashavc264.live: DASH-IF live profile -* dashavc264.onDemand: DASH-IF onDemand profile -* dashif.ll: DASH IF low-latency profile (set UTC server to time.akamai.com if none set) + +- auto: turns profile to live for dynamic and full for non-dynamic +- live: DASH live profile, using segment template +- onDemand: MPEG-DASH live profile +- main: MPEG-DASH main profile, using segment list +- full: MPEG-DASH full profile +- hbbtv1.5.live: HBBTV 1.5 DASH profile +- dashavc264.live: DASH-IF live profile +- dashavc264.onDemand: DASH-IF onDemand profile +- dashif.ll: DASH IF low-latency profile (set UTC server to time.akamai.com if none set) __profX__ (str): list of profile extensions, as used by DASH-IF and DVB. The string will be colon-concatenated with the profile used. If starting with `+`, the profile string by default is erased and `+` is skipped __cp__ (enum, default: _set_): content protection element location -* set: in adaptation set element -* rep: in representation element -* both: in both adaptation set and representation elements + +- set: in adaptation set element +- rep: in representation element +- both: in both adaptation set and representation elements __pssh__ (enum, default: _v_): storage mode for PSSH box -* f: stores in movie fragment only -* v: stores in movie only, or movie and fragments if key roll is detected -* m: stores in mpd only -* mf: stores in mpd and movie fragment -* mv: stores in mpd and movie -* n: discard pssh from mpd and segments + +- f: stores in movie fragment only +- v: stores in movie only, or movie and fragments if key roll is detected +- m: stores in mpd only +- mf: stores in mpd and movie fragment +- mv: stores in mpd and movie +- n: discard pssh from mpd and segments __buf__ (sint, default: _-100_): min buffer duration in ms. negative value means percent of segment duration (e.g. -150 = 1.5*seg_dur) __spd__ (sint, default: _0_): suggested presentation delay in ms @@ -442,78 +528,94 @@ The segmenter adds the following properties to the output PIDs: __refresh__ (dbl, default: _0_): refresh rate for dynamic manifests, in seconds (a negative value sets the MPD duration, value 0 uses dash duration) __tsb__ (dbl, default: _30_): time-shift buffer depth in seconds (a negative value means infinity) __keep_segs__ (bool, default: _false_): do not delete segments no longer in time-shift buffer -__subdur__ (dbl, default: _0_): maximum duration of the input file to be segmented. This does not change the segment duration, segmentation stops once segments produced exceeded the duration __ast__ (str): set start date (as xs:date, e.g. YYYY-MM-DDTHH:MM:SSZ) for live mode. Default is now. !! Do not use with multiple periods, nor when DASH duration is not a multiple of GOP size !! __state__ (str): path to file used to store/reload state info when simulating live. This is stored as a valid MPD with GPAC XML extensions +__keep_ts__ (bool, default: _false_): do not shift timestamp when reloading a context __loop__ (bool, default: _false_): loop sources when dashing with subdur and state. If not set, a new period is created once the sources are over +__subdur__ (dbl, default: _0_): maximum duration of the input file to be segmented. This does not change the segment duration, segmentation stops once segments produced exceeded the duration __split__ (bool, default: _true_): enable cloning samples for text/metadata/scene description streams, marking further clones as redundant __hlsc__ (bool, default: _false_): insert clock reference in variant playlist in live HLS __cues__ (str): set cue file __strict_cues__ (bool, default: _false_): strict mode for cues, complains if splitting is not on SAP type 1/2/3 or if unused cue is found __strict_sap__ (enum, default: _off_): strict mode for sap -* off: ignore SAP types for PID other than video, enforcing _startsWithSAP=1_ -* sig: same as [off](#off) but keep _startsWithSAP_ to the true SAP value -* on: warn if any PID uses SAP 3 or 4 and switch to FULL profile -* intra: ignore SAP types greater than 3 on all media types + +- off: ignore SAP types for PID other than video, enforcing `AdaptationSet@startsWithSAP=1` +- sig: same as [off](#off) but keep `AdaptationSet@startsWithSAP` to the true SAP value +- on: warn if any PID uses SAP 3 or 4 and switch to FULL profile +- intra: ignore SAP types greater than 3 on all media types -__subs_sidx__ (sint, default: _-1_): number of subsegments per sidx. negative value disables sidx. Only used to inherit sidx option of destination +__subs_sidx__ (sint, default: _-1_): number of subsegments per sidx. Negative value disables sidx. Only used to inherit sidx option of destination __cmpd__ (bool, default: _false_): skip line feed and spaces in MPD XML for compactness __styp__ (str): indicate the 4CC to use for styp boxes when using ISOBMFF output __dual__ (bool): indicate to produce both MPD and M3U files __sigfrag__ (bool): use manifest generation only mode __sbound__ (enum, default: _out_): indicate how the theoretical segment start `TSS (= segment_number * duration)` should be handled -* out: segment split as soon as `TSS` is exceeded (`TSS` <= segment_start) -* closest: segment split at closest SAP to theoretical bound -* in: `TSS` is always in segment (`TSS` >= segment_start) + +- out: segment split as soon as `TSS` is exceeded (`TSS` <= segment_start) +- closest: segment split at closest SAP to theoretical bound +- in: `TSS` is always in segment (`TSS` >= segment_start) __reschedule__ (bool, default: _false_): reschedule sources with no period ID assigned once done (dynamic mode only) __sreg__ (bool, default: _false_): regulate the session + - when using subdur and context, only generate segments from the past up to live edge - otherwise in dynamic mode without context, do not generate segments ahead of time __scope_deps__ (bool, default: _true_): scope PID dependencies to be within source. If disabled, PID dependencies will be checked across all input PIDs regardless of their sources __utcs__ (str): URL to use as time server / UTCTiming source. Special value `inband` enables inband UTC (same as publishTime), special prefix `xsd@` uses xsDateTime schemeURI rather than ISO -__force_flush__ (bool, default: _false_): force generating a single segment for each input. This can be useful in batch mode when average source duration is known and used as segment duration but actual duration may sometimes be greater +__sflush__ (enum, default: _off_): segment flush mode - see filter help: + +- off: no specific actions +- single: force generating a single segment for each input +- end: skip loop detection and clamp duration adjustment at end of input, used for state mode + __last_seg_merge__ (bool, default: _false_): force merging last segment if less than half the target duration __mha_compat__ (enum, default: _no_): adaptation set generation mode for compatible MPEG-H Audio profile -* no: only generate the adaptation set for the main profile -* comp: only generate the adaptation sets for all compatible profiles -* all: generate the adaptation set for the main profile and all compatible profiles + +- no: only generate the adaptation set for the main profile +- comp: only generate the adaptation sets for all compatible profiles +- all: generate the adaptation set for the main profile and all compatible profiles __mname__ (str): output manifest name for ATSC3 multiplexing (using 'm3u8' only toggles HLS generation) __llhls__ (enum, default: _off_): HLS low latency type -* off: do not use LL-HLS -* br: use LL-HLS with byte-range for segment parts, pointing to full segment (DASH-LL compatible) -* sf: use separate files for segment parts (post-fixed .1, .2 etc.) -* brsf: generate two sets of manifest, one for byte-range and one for files (`_IF` added before extension of manifest) + +- off: do not use LL-HLS +- br: use LL-HLS with byte-range for segment parts, pointing to full segment (DASH-LL compatible) +- sf: use separate files for segment parts (post-fixed .1, .2 etc.) +- brsf: generate two sets of manifest, one for byte-range and one for files (`_IF` added before extension of manifest) __hlsdrm__ (str): cryp file info for HLS full segment encryption __hlsx__ (strl): list of string to append to master HLS header before variants with `['#foo','#bar=val']` added as `#foo \n #bar=val` +__hlsiv__ (bool, default: _true_): inject IV in variant HLS playlist`` __ll_preload_hint__ (bool, default: _true_): inject preload hint for LL-HLS __ll_rend_rep__ (bool, default: _true_): inject rendition reports for LL-HLS __ll_part_hb__ (dbl, default: _-1_): user-defined part hold-back for LLHLS, negative value means 3 times max part duration in session __ckurl__ (str): set the ClearKey URL common to all encrypted streams (overriden by `CKUrl` pid property) __hls_absu__ (enum, default: _no_): use absolute url in HLS generation using first URL in [base]() -* no: do not use absolute URL -* var: use absolute URL only in variant playlists -* mas: use absolute URL only in master playlist -* both: use absolute URL everywhere + +- no: do not use absolute URL +- var: use absolute URL only in variant playlists +- mas: use absolute URL only in master playlist +- both: use absolute URL everywhere __hls_ap__ (bool, default: _false_): use audio as primary media instead of video when generating playlists __seg_sync__ (enum, default: _auto_): control how waiting on last packet P of fragment/segment to be written impacts segment injection in manifest -* no: do not wait for P -* yes: wait for P -* auto: wait for P if HLS is used + +- no: do not wait for P +- yes: wait for P +- auto: wait for P if HLS is used __cmaf__ (enum, default: _no_): use cmaf guidelines -* no: CMAF not enforced -* cmfc: use CMAF `cmfc` guidelines -* cmf2: use CMAF `cmf2` guidelines + +- no: CMAF not enforced +- cmfc: use CMAF `cmfc` guidelines +- cmf2: use CMAF `cmf2` guidelines __pswitch__ (enum, default: _single_): period switch control mode -* single: change period if PID configuration changes -* force: force period switch at each PID reconfiguration instead of absorbing PID reconfiguration (for splicing or add insertion not using periodID) -* stsd: change period if PID configuration changes unless new configuration was advertised in initial config + +- single: change period if PID configuration changes +- force: force period switch at each PID reconfiguration instead of absorbing PID reconfiguration (for splicing or add insertion not using periodID) +- stsd: change period if PID configuration changes unless new configuration was advertised in initial config __chain__ (str): URL of next MPD for regular chaining __chain_fbk__ (str): URL of fallback MPD @@ -522,9 +624,11 @@ The segmenter adds the following properties to the output PIDs: __keep_src__ (bool, default: _false_): keep source URLs in manifest generation mode __gxns__ (bool, default: _false_): insert some gpac extensions in manifest (for now, only tfdt of first segment) __dkid__ (enum, default: _auto_): control injection of default KID in MPD -* off: default KID not injected -* on: default KID always injected -* auto: default KID only injected if no key roll is detected (as per DASH-IF guidelines) + +- off: default KID not injected +- on: default KID always injected +- auto: default KID only injected if no key roll is detected (as per DASH-IF guidelines) __tpl_force__ (bool, default: _false_): use template string as is without trying to add extension or solve conflicts in names +__ttml_agg__ (bool, default: _false_): force aggregation of TTML samples of a DASH segment into a single sample diff --git a/docs/Filters/dashin.md b/docs/Filters/dashin.md index 98c26b4f..2d36fc1a 100644 --- a/docs/Filters/dashin.md +++ b/docs/Filters/dashin.md @@ -12,12 +12,16 @@ This filter reads MPEG-DASH, HLS and MS Smooth manifests. This is the default mode, in which the filter produces media PIDs and frames from sources indicated in the manifest. The default behavior is to perform adaptation according to [algo](#algo), but the filter can: + - run with no adaptation, to grab maximum quality. + Example ``` gpac -i MANIFEST_URL:algo=none:start_with=max_bw -o dest.mp4 ``` + - run with no adaptation, fetching all qualities. + Example ``` gpac -i MANIFEST_URL:split_as -o dst=$File$.mp4 @@ -60,28 +64,34 @@ This will encrypt an existing DASH session and republish it as HLS, using same s This mode will force [noseek](#noseek)=`true` to ensure the first segment fetched is complete, and [split_as](#split_as)=`true` to fetch all qualities. Each first packet of a segment will have the following properties attached: -* `CueStart`: indicate this is a segment start -* `FileNumber`: current segment number -* `FileName`: current segment file name without manifest (MPD or master HLS) base url -* `DFPStart`: set with value `0` if this is the first packet in the period, absent otherwise + +- `CueStart`: indicate this is a segment start +- `FileNumber`: current segment number +- `FileName`: current segment file name without manifest (MPD or master HLS) base url +- `DFPStart`: set with value `0` if this is the first packet in the period, absent otherwise + If [forward](#forward) is set to `mani`, the first packet of a segment dispatched after a manifest update will also carry the manifest payload as a property: -* `DFManifest`: contains main manifest (MPD, M3U8 master) -* `DFVariant`: contains list of HLS child playlists as strings for the given quality -* `DFVariantName`: contains list of associated HLS child playlists name, in same order as manifests in `DFVariant` + +- `DFManifest`: contains main manifest (MPD, M3U8 master) +- `DFVariant`: contains list of HLS child playlists as strings for the given quality +- `DFVariantName`: contains list of associated HLS child playlists name, in same order as manifests in `DFVariant` + Each output PID will have the following properties assigned: -* `DFMode`: set to 1 for `segb` or 2 for `mani` -* `DCue`: set to `inband` -* `DFPStart`: set to current period start value -* `FileName`: set to associated init segment if any -* `Representation`: set to the associated representation ID in the manifest -* `DashDur`: set to the average segment duration as indicated in the manifest -* `source_template`: set to true to indicate the source template is known -* `stl_timescale`: timescale used by SegmentTimeline, or 0 if no SegmentTimeline -* `init_url`: unresolved intialization URL (as it appears in the MPD or in the variant playlist) -* `manifest_url`: manifest URL -* `hls_variant_name`: HLS variant playlist name (as it appears in the HLS master playlist) + +- `DFMode`: set to 1 for `segb` or 2 for `mani` +- `DCue`: set to `inband` +- `DFPStart`: set to current period start value +- `FileName`: set to associated init segment if any +- `Representation`: set to the associated representation ID in the manifest +- `DashDur`: set to the average segment duration as indicated in the manifest +- `source_template`: set to true to indicate the source template is known +- `stl_timescale`: timescale used by SegmentTimeline, or 0 if no SegmentTimeline +- `init_url`: unresolved intialization URL (as it appears in the MPD or in the variant playlist) +- `manifest_url`: manifest URL +- `hls_variant_name`: HLS variant playlist name (as it appears in the HLS master playlist) + When the [dasher](dasher) is used together with this mode, this will force all generated segments to have the same name, duration and fragmentation properties as the input ones. It is therefore not recommended for sessions stored/generated on local storage to generate the output in the same directory. @@ -89,56 +99,62 @@ When the [dasher](dasher) is used together with this mode, this will force all g # Options __auto_switch__ (sint, default: _0_): switch quality every N segments -* positive: go to higher quality or loop to lowest -* negative: go to lower quality or loop to highest -* 0: disabled + +- positive: go to higher quality or loop to lowest +- negative: go to lower quality or loop to highest +- 0: disabled __segstore__ (enum, default: _mem_): enable file caching -* mem: all files are stored in memory, no disk IO -* disk: files are stored to disk but discarded once played -* cache: all files are stored to disk and kept + +- mem: all files are stored in memory, no disk IO +- disk: files are stored to disk but discarded once played +- cache: all files are stored to disk and kept __algo__ (str, default: _gbuf_, Enum: none|grate|gbuf|bba0|bolaf|bolab|bolau|bolao|JS): adaptation algorithm to use -* none: no adaptation logic -* grate: GPAC legacy algo based on available rate -* gbuf: GPAC legacy algo based on buffer occupancy -* bba0: BBA-0 -* bolaf: BOLA Finite -* bolab: BOLA Basic -* bolau: BOLA-U -* bolao: BOLA-O -* JS: use file JS (either with specified path or in $GSHARE/scripts/) for algo (.js extension may be omitted) + +- none: no adaptation logic +- grate: GPAC legacy algo based on available rate +- gbuf: GPAC legacy algo based on buffer occupancy +- bba0: BBA-0 +- bolaf: BOLA Finite +- bolab: BOLA Basic +- bolau: BOLA-U +- bolao: BOLA-O +- JS: use file JS (either with specified path or in $GSHARE/scripts/) for algo (.js extension may be omitted) __start_with__ (enum, default: _max_bw_): initial selection criteria -* min_q: start with lowest quality -* max_q: start with highest quality -* min_bw: start with lowest bitrate -* max_bw: start with highest bitrate; if tiles are used, all low priority tiles will have the lower (below max) bandwidth selected -* max_bw_tiles: start with highest bitrate; if tiles are used, all low priority tiles will have their lowest bandwidth selected + +- min_q: start with lowest quality +- max_q: start with highest quality +- min_bw: start with lowest bitrate +- max_bw: start with highest bitrate; if tiles are used, all low priority tiles will have the lower (below max) bandwidth selected +- max_bw_tiles: start with highest bitrate; if tiles are used, all low priority tiles will have their lowest bandwidth selected __max_res__ (bool, default: _true_): use max media resolution to configure display __abort__ (bool, default: _false_): allow abort during a segment download __use_bmin__ (enum, default: _auto_): playout buffer handling -* no: use default player settings -* auto: notify player of segment duration if not low latency -* mpd: use the indicated min buffer time of the MPD + +- no: use default player settings +- auto: notify player of segment duration if not low latency +- mpd: use the indicated min buffer time of the MPD __shift_utc__ (sint, default: _0_): shift DASH UTC clock in ms __spd__ (sint, default: _-I_): suggested presentation delay in ms -__route_shift__ (sint, default: _0_): shift ROUTE requests time by given ms +__mcast_shift__ (sint, default: _0_): shift requests time by given ms for multicast sources __server_utc__ (bool, default: _yes_): use `ServerUTC` or `Date` HTTP headers instead of local UTC __screen_res__ (bool, default: _yes_): use screen resolution in selection phase __init_timeshift__ (sint, default: _0_): set initial timeshift in ms (if >0) or in per-cent of timeshift buffer (if <0) __tile_mode__ (enum, default: _none_): tile adaptation mode -* none: bitrate is shared equally across all tiles -* rows: bitrate decreases for each row of tiles starting from the top, same rate for each tile on the row -* rrows: bitrate decreases for each row of tiles starting from the bottom, same rate for each tile on the row -* mrows: bitrate decreased for top and bottom rows only, same rate for each tile on the row -* cols: bitrate decreases for each columns of tiles starting from the left, same rate for each tile on the columns -* rcols: bitrate decreases for each columns of tiles starting from the right, same rate for each tile on the columns -* mcols: bitrate decreased for left and right columns only, same rate for each tile on the columns -* center: bitrate decreased for all tiles on the edge of the picture -* edges: bitrate decreased for all tiles on the center of the picture + +- none: bitrate is shared equally across all tiles +- rows: bitrate decreases for each row of tiles starting from the top, same rate for each tile on the row +- rrows: bitrate decreases for each row of tiles starting from the bottom, same rate for each tile on the row +- mrows: bitrate decreased for top and bottom rows only, same rate for each tile on the row +- cols: bitrate decreases for each columns of tiles starting from the left, same rate for each tile on the columns +- rcols: bitrate decreases for each columns of tiles starting from the right, same rate for each tile on the columns +- mcols: bitrate decreased for left and right columns only, same rate for each tile on the columns +- center: bitrate decreased for all tiles on the edge of the picture +- edges: bitrate decreased for all tiles on the center of the picture __tiles_rate__ (uint, default: _100_): indicate the amount of bandwidth to use at each quality level. The rate is recursively applied at each level, e.g. if 50%, Level1 gets 50%, level2 gets 25%, ... If 100, automatic rate allocation will be done by maximizing the quality in order of priority. If 0, bitstream will not be smoothed across tiles/qualities, and concurrency may happen between different media __delay40X__ (uint, default: _500_): delay in milliseconds to wait between two 40X on the same segment @@ -153,24 +169,27 @@ When the [dasher](dasher) is used together with this mode, this will force all g __noseek__ (bool, default: _no_): disable seeking of initial segment(s) in dynamic mode (useful when UTC clocks do not match) __bwcheck__ (uint, default: _5_): minimum time in milliseconds between two bandwidth checks when allowing segment download abort __lowlat__ (enum, default: _early_): segment scheduling policy in low latency mode -* no: disable low latency -* strict: strict respect of AST offset in low latency -* early: allow fetching segments earlier than their AST in low latency when input PID is empty + +- no: disable low latency +- strict: strict respect of AST offset in low latency +- early: allow fetching segments earlier than their AST in low latency when input PID is empty __forward__ (enum, default: _none_): segment forwarding mode -* none: regular DASH read -* file: do not demultiplex files and forward them as file PIDs (imply `segstore=mem`) -* segb: turn on [split_as](#split_as), segment and fragment bounds signaling (`sigfrag`) in sources and DASH cue insertion -* mani: same as `segb` and also forward manifests + +- none: regular DASH read +- file: do not demultiplex files and forward them as file PIDs (imply `segstore=mem`) +- segb: turn on [split_as](#split_as), segment and fragment bounds signaling (`sigfrag`) in sources and DASH cue insertion +- mani: same as `segb` and also forward manifests __fmodefwd__ (bool, default: _yes_): forward packet rather than copy them in `file` forward mode. Packet copy might improve performances in low latency mode __skip_lqt__ (bool, default: _no_): disable decoding of tiles with highest degradation hints (not visible, not gazed at) for debug purposes __llhls_merge__ (bool, default: _yes_): merge LL-HLS byte range parts into a single open byte range request __groupsel__ (bool, default: _no_): select groups based on language (by default all playable groups are exposed) __chain_mode__ (enum, default: _on_): MPD chaining mode -* off: do not use MPD chaining -* on: use MPD chaining once over, fallback if MPD load failure -* error: use MPD chaining once over or if error (MPD or segment download) + +- off: do not use MPD chaining +- on: use MPD chaining once over, fallback if MPD load failure +- error: use MPD chaining once over or if error (MPD or segment download) __asloop__ (bool, default: _false_): when auto switch is enabled, iterates back and forth from highest to lowest qualities __bsmerge__ (bool, default: _true_): allow merging of video bitstreams (only HEVC for now) diff --git a/docs/Filters/dvbin.md b/docs/Filters/dvbin.md index e2c626e0..91493a96 100644 --- a/docs/Filters/dvbin.md +++ b/docs/Filters/dvbin.md @@ -8,8 +8,10 @@ This filter may be automatically loaded during graph resolution. Experimental DVB support for linux, requires a channel config file through [chcfg](#chcfg) The URL syntax is `dvb://CHANNAME[@FRONTEND]`, with: - * CHANNAME: the channel name as listed in the channel config file - * frontend: the index of the DVB adapter to use (optional, default is 0) + + - CHANNAME: the channel name as listed in the channel config file + - frontend: the index of the DVB adapter to use (optional, default is 0) + # Options diff --git a/docs/Filters/evgs.md b/docs/Filters/evgs.md index d4dad26a..f0e92171 100644 --- a/docs/Filters/evgs.md +++ b/docs/Filters/evgs.md @@ -22,18 +22,24 @@ evgs:osize=288x240:osar=3/2 The output dimensions will be 192x240. When aspect ratio is not kept ([keepar=off](#keepar=off)): + - source is resampled to desired dimensions - if output aspect ratio is not set, output will use source sample aspect ratio + When aspect ratio is partially kept ([keepar=nosrc](#keepar=nosrc)): + - resampling is done on the input data without taking input sample aspect ratio into account - if output sample aspect ratio is not set ([osar=0/N](#osar=0/N)), source aspect ratio is forwarded to output. + When aspect ratio is fully kept ([keepar=full](#keepar=full)), output aspect ratio is force to 1/1 if not set. When sample aspect ratio is kept, the filter will: + - center the rescaled input frame on the output frame - fill extra pixels with [padclr](#padclr) + # Options @@ -42,9 +48,10 @@ When sample aspect ratio is kept, the filter will: __ofmt__ (pfmt, default: _none_): pixel format for output video. When not set, input format is used __ofr__ (bool, default: _false_): force output full range __keepar__ (enum, default: _off_): keep aspect ratio -* off: ignore aspect ratio -* full: respect aspect ratio, applying input sample aspect ratio info -* nosrc: respect aspect ratio but ignore input sample aspect ratio + +- off: ignore aspect ratio +- full: respect aspect ratio, applying input sample aspect ratio info +- nosrc: respect aspect ratio but ignore input sample aspect ratio __padclr__ (str, default: _black_): clear color when aspect ration preservation is used __osar__ (frac, default: _0/1_): force output pixel aspect ratio diff --git a/docs/Filters/ffavf.md b/docs/Filters/ffavf.md index 06a18419..db1c3f95 100644 --- a/docs/Filters/ffavf.md +++ b/docs/Filters/ffavf.md @@ -49,9 +49,11 @@ Example gpac -i video:#ffid=a -i logo:#ffid=b ffavf::f=[a][b]overlay=main_w-overlay_w-10:main_h-overlay_h-10 vout ``` In this example: + - the video source is identified as `a` - the logo source is identified as `b` - the filter declaration maps `a` to its first input (in this case, main video) and `b` to its second input (in this case the overlay) + When a graph has several outputs, output PIDs will be identified using the `ffid` property set to the output avfilter name. Example @@ -59,17 +61,21 @@ Example gpac -i source ffavf::f=split inspect:SID=#ffid=out0 vout#SID=out1 ``` In this example: + - the splitter produces 2 video streams `out0` and `out1` - the inspector only process stream with ffid `out0` - the video output only displays stream with ffid `out1` + The name(s) of the final output of the avfilter graph cannot be configured in GPAC. You can however name intermediate output(s) in a complex filter chain as usual. # Filter graph commands The filter handles option updates as commands passed to the AV filter graph. The syntax expected in the option name is: -* com_name=value: sends command `com_name` with value `value` to all filters -* name#com_name=value: sends command `com_name` with value `value` to filter named `name` + +- com_name=value: sends command `com_name` with value `value` to all filters +- name#com_name=value: sends command `com_name` with value `value` to filter named `name` + # Options diff --git a/docs/Filters/ffavin.md b/docs/Filters/ffavin.md index 9e1db959..b142c45e 100644 --- a/docs/Filters/ffavin.md +++ b/docs/Filters/ffavin.md @@ -14,14 +14,18 @@ To list all supported grabbers for your GPAC build, use `gpac -h ffavin:*`. Typical classes are `dshow` on windows, `avfoundation` on OSX, `video4linux2` or `x11grab` on linux Typical device name can be the webcam name: + - `FaceTime HD Camera` on OSX, device name on windows, `/dev/video0` on linux - `screen-capture-recorder`, see http://screencapturer.sf.net/ on windows - `Capture screen 0` on OSX (0=first screen), or `screenN` for short - X display name (e.g. `:0.0`) on linux + The general mapping from ffmpeg command line is: + - ffmpeg `-f` maps to [fmt](#fmt) option - ffmpeg `-i` maps to [dev](#dev) option + Example ``` @@ -42,10 +46,11 @@ gpac -i av://::dev=0:1 ... __fmt__ (str): name of device class. If not set, defaults to first device class __dev__ (str, default: _0_): name of device or index of device __copy__ (enum, default: _A_): set copy mode of raw frames -* N: frames are only forwarded (shared memory, no copy) -* A: audio frames are copied, video frames are forwarded -* V: video frames are copied, audio frames are forwarded -* AV: all frames are copied + +- N: frames are only forwarded (shared memory, no copy) +- A: audio frames are copied, video frames are forwarded +- V: video frames are copied, audio frames are forwarded +- AV: all frames are copied __sclock__ (bool, default: _false_): use system clock (us) instead of device timestamp (for buggy devices) __probes__ (uint, default: _10_, minmax: 0-100): probe a given number of video frames before emitting (this usually helps with bad timing of the first frames) diff --git a/docs/Filters/ffbsf.md b/docs/Filters/ffbsf.md index 3bfa30e4..b15808b1 100644 --- a/docs/Filters/ffbsf.md +++ b/docs/Filters/ffbsf.md @@ -13,8 +13,10 @@ Several BSF may be specified in [f](#f) for different coding types. BSF not matc When no BSF matches the input coding type, or when [f](#f) is empty, the filter acts as a passthrough filter. Options are specified after the desired filters: + - `ffbsf:f=h264_metadata:video_full_range_flag=0` - `ffbsf:f=h264_metadata,av1_metadata:video_full_range_flag=0:color_range=tv` + _Note: Using BSFs on some media types (e.g. avc, hevc) may trigger creation of a reframer filter (e.g. rfnalu)_ diff --git a/docs/Filters/ffdec.md b/docs/Filters/ffdec.md index 0d9ed510..eb9a0c1e 100644 --- a/docs/Filters/ffdec.md +++ b/docs/Filters/ffdec.md @@ -16,9 +16,11 @@ The default threading mode is to let libavcodec decide how many threads to use. The [ffcmap](#ffcmap) option allows specifying FFmpeg codecs for codecs not supported by GPAC. Each entry in the list is formatted as `GID@name` or `GID@+name`, with: -* GID: 4CC or 32 bit identifier of codec ID, as indicated by `gpac -i source inspect:full` -* name: FFmpeg codec name -* `+': is set and extra data is set and formatted as an ISOBMFF box, removes box header + +- GID: 4CC or 32 bit identifier of codec ID, as indicated by `gpac -i source inspect:full` +- name: FFmpeg codec name +- `+': is set and extra data is set and formatted as an ISOBMFF box, removes box header + Example ``` diff --git a/docs/Filters/ffenc.md b/docs/Filters/ffenc.md index 01ce1e82..f6d68d24 100644 --- a/docs/Filters/ffenc.md +++ b/docs/Filters/ffenc.md @@ -17,8 +17,10 @@ Options can be passed from prompt using `--OPT=VAL` (global options) or appendin The filter will look for property `TargetRate` on input PID to set the desired bitrate per PID. The filter will force a closed gop boundary: + - at each packet with a `FileNumber` property set or a `CueStart` property set to true. - if [fintra](#fintra) and [rc](#rc) is set. + When forcing a closed GOP boundary, the filter will flush, destroy and recreate the encoder to make sure a clean context is used, as currently many encoders in libavcodec do not support clean reset when forcing picture types. If [fintra](#fintra) is not set and the output of the encoder is a DASH session in live profile without segment timeline, [fintra](#fintra) will be set to the target segment duration and [rc](#rc) will be set. diff --git a/docs/Filters/ffsws.md b/docs/Filters/ffsws.md index a87efbb4..fb23ec75 100644 --- a/docs/Filters/ffsws.md +++ b/docs/Filters/ffsws.md @@ -22,23 +22,31 @@ ffsws:osize=288x240:osar=3/2 The output dimensions will be 192x240. When aspect ratio is not kept ([keepar=off](#keepar=off)): + - source is resampled to desired dimensions - if output aspect ratio is not set, output will use source sample aspect ratio + When aspect ratio is partially kept ([keepar=nosrc](#keepar=nosrc)): + - resampling is done on the input data without taking input sample aspect ratio into account - if output sample aspect ratio is not set ([osar=0/N](#osar=0/N)), source aspect ratio is forwarded to output. + When aspect ratio is fully kept ([keepar=full](#keepar=full)), output aspect ratio is force to 1/1 if not set. When sample aspect ratio is kept, the filter will: + - center the rescaled input frame on the output frame - fill extra pixels with [padclr](#padclr) + ## Algorithms options + - for bicubic, to tune the shape of the basis function, [p1](#p1) tunes f(1) and [p2](#p2) f´(1) - for gauss [p1](#p1) tunes the exponent and thus cutoff frequency - for lanczos [p1](#p1) tunes the width of the window function + See FFmpeg documentation (https://ffmpeg.org/documentation.html) for more details @@ -59,9 +67,10 @@ See FFmpeg documentation (https://ffmpeg.org/documentation.html) for more detail __otable__ (sintl): the yuv2rgb coefficients describing the output yuv space, normally ff_yuv2rgb_coeffs[x], use default if not set __itable__ (sintl): the yuv2rgb coefficients describing the input yuv space, normally ff_yuv2rgb_coeffs[x], use default if not set __keepar__ (enum, default: _off_): keep aspect ratio -* off: ignore aspect ratio -* full: respect aspect ratio, applying input sample aspect ratio info -* nosrc: respect aspect ratio but ignore input sample aspect ratio + +- off: ignore aspect ratio +- full: respect aspect ratio, applying input sample aspect ratio info +- nosrc: respect aspect ratio but ignore input sample aspect ratio __padclr__ (str, default: _black_): clear color when aspect ration preservation is used __osar__ (frac, default: _0/1_): force output pixel aspect ratio diff --git a/docs/Filters/filters_general.md b/docs/Filters/filters_general.md index d7dea8ea..c8c96b21 100644 --- a/docs/Filters/filters_general.md +++ b/docs/Filters/filters_general.md @@ -11,26 +11,35 @@ Each filter exposes a set of argument to configure itself, using property types # Property and filter option format -* boolean: formatted as `yes`,`true`,`1` or `no`,`false`,`0` -* enumeration (for filter arguments only): must use the syntax given in the argument description, otherwise value `0` (first in enum) is assumed. -* 1-dimension (numbers, floats, ints...): formatted as `value[unit]`, where `unit` can be `k`,`K` (x 1000) or `m`,`M` (x 1000000) or `g`,`G` (x 1000000000) or `sec` (x 1000) or `min` (x 60000). `+I` means max float/int/uint value, `-I` min float/int/uint value. -* fraction: formatted as `num/den` or `num-den` or `num`, in which case the denominator is 1 if `num` is an integer, or 1000000 if `num` is a floating-point value. -* unsigned 32 bit integer: formatted as number or hexadecimal using the format `0xAABBCCDD`. -* N-dimension (vectors): formatted as `DIM1xDIM2[xDIM3[xDIM4]]` values, without unit multiplier. - * For 2D integer vectors, the following resolution names can be used: `360`, `480`, `576`, `720`, `1080`, `hd`, `2k`, `2160`, `4k`, `4320`, `8k` -* string: formatted as: - * `value`: copies value to string. - * `file@FILE`: load string from local `FILE` (opened in binary mode). - * `bxml@FILE`: binarize XML from local `FILE` and set property type to data - see https://wiki.gpac.io/xmlformats/NHML-Format. -* data: formatted as: - * `size@address`: constant data block, not internally copied; `size` gives the size of the block, `address` the data pointer. - * `0xBYTESTRING`: data block specified in hexadecimal, internally copied. - * `file@FILE`: load data from local `FILE` (opened in binary mode). - * `bxml@FILE`: binarize XML from local `FILE` - see https://wiki.gpac.io/xmlformats/NHML-Format. - * `b64@DATA`: load data from base-64 encoded `DATA`. -* pointer: pointer address as formatted by `%p` in C. -* string lists: formatted as `val1,val2[,...]`. Each value can also use `file@FILE` syntax. -* integer lists: formatted as `val1,val2[,...]` + +- boolean: formatted as `yes`,`true`,`1` or `no`,`false`,`0` +- enumeration (for filter arguments only): must use the syntax given in the argument description, otherwise value `0` (first in enum) is assumed. +- 1-dimension (numbers, floats, ints...): formatted as `value[unit]`, where `unit` can be `k`,`K` (x 1000) or `m`,`M` (x 1000000) or `g`,`G` (x 1000000000) or `sec` (x 1000) or `min` (x 60000). `+I` means max float/int/uint value, `-I` min float/int/uint value. +- fraction: formatted as `num/den` or `num-den` or `num`, in which case the denominator is 1 if `num` is an integer, or 1000000 if `num` is a floating-point value. +- unsigned 32 bit integer: formatted as number or hexadecimal using the format `0xAABBCCDD`. +- N-dimension (vectors): formatted as `DIM1xDIM2[xDIM3[xDIM4]]` values, without unit multiplier. + + - For 2D integer vectors, the following resolution names can be used: `360`, `480`, `576`, `720`, `1080`, `hd`, `2k`, `2160`, `4k`, `4320`, `8k` + +- string: formatted as: + + - `value`: copies value to string. + - `file@FILE`: load string from local `FILE` (opened in binary mode). + - `bxml@FILE`: binarize XML from local `FILE` and set property type to data - see https://wiki.gpac.io/xmlformats/NHML-Format. + +- data: formatted as: + + - `size@address`: constant data block, not internally copied; `size` gives the size of the block, `address` the data pointer. + - `0xBYTESTRING`: data block specified in hexadecimal, internally copied. + - `file@FILE`: load data from local `FILE` (opened in binary mode). + - `bxml@FILE`: binarize XML from local `FILE` - see https://wiki.gpac.io/xmlformats/NHML-Format. + - `b64@DATA`: load data from base-64 encoded `DATA`. + - `FMT@val`: load values from val (comma-separated list) with `FMT` being `u8`, `s8`, `u16`, `s16`, `u32`, `s32`, `u64`, `s64`, `flt`, `dbl`, `hex` or `str`. + +- pointer: pointer address as formatted by `%p` in C. +- string lists: formatted as `val1,val2[,...]`. Each value can also use `file@FILE` syntax. +- integer lists: formatted as `val1,val2[,...]` + _Note: The special characters in property formats (0x,/,-,+I,-I,x) cannot be configured._ @@ -40,8 +49,10 @@ Numbers and fraction can be expressed as `THH:MM:SS.ms`, `TMM:SS.ms`, `THH:MM:SS ## Generic declaration Each filter is declared by its name, with optional filter arguments appended as a list of colon-separated `name=value` pairs. Additional syntax is provided for: -* boolean: `value` can be omitted, defaulting to `true` (e.g. `:allt`). Using `!` before the name negates the result (e.g. `:!moof_first`) -* enumerations: name can be omitted, e.g. `:disp=pbo` is equivalent to `:pbo`. + +- boolean: `value` can be omitted, defaulting to `true` (e.g. `:allt`). Using `!` before the name negates the result (e.g. `:!moof_first`) +- enumerations: name can be omitted, e.g. `:disp=pbo` is equivalent to `:pbo`. + When string parameters are used (e.g. URLs), it is recommended to escape the string using the keyword `gpac`. @@ -56,7 +67,7 @@ filter:ARG=http://foo/bar?yes:opt=VAL ``` This will fail to extract it and keep `:opt=VAL` as part of the URL. The escape mechanism is not needed for local source, for which file existence is probed during argument parsing. It is also not needed for builtin protocol handlers (`avin://`, `video://`, `audio://`, `pipe://`) -For `tcp://` and `udp://` protocols, the escape is not needed if a trailing `/` is appended after the port number. +For schemes not using a server path, e.g. `tcp://` and `udp://`, the escape is not needed if a trailing `/` is appended after the port number. Example ``` -i tcp://127.0.0.1:1234:OPT @@ -69,7 +80,7 @@ Example This will extract the URL and options. _Note: one trick to avoid the escape sequence is to declare the URLs option at the end, e.g. `f1:opt1=foo:url=http://bar`, provided you have only one URL parameter to specify on the filter._ -It is possible to disable option parsing (for string options) by duplicating the separator. +It is possible to locally disable option parsing (usefull for string options) by duplicating the separator. Example ``` filter::opt1=UDP://IP:PORT/:someopt=VAL::opt2=VAL2 @@ -105,11 +116,13 @@ This can be used to test a specific filter when alternate filter chains are poss ## Specifying encoders and decoders By default filters chain will be resolved without any decoding/encoding if the destination accepts the desired format. Otherwise, decoders/encoders will be dynamically loaded to perform the conversion, unless dynamic resolution is disabled. There is a special shortcut filter name for encoders `enc` allowing to match a filter providing the desired encoding. The parameters for `enc` are: -* c=NAME: identifies the desired codec. `NAME` can be the GPAC codec name or the encoder instance for ffmpeg/others -* b=UINT, rate=UINT, bitrate=UINT: indicates the bitrate in bits per second -* g=UINT, gop=UINT: indicates the GOP size in frames -* pfmt=NAME: indicates the target pixel format name (see [properties (-h props)](filters_properties) ) of the source, if supported by codec -* all_intra=BOOL: indicates all frames should be intra frames, if supported by codec + +- c=NAME: identifies the desired codec. `NAME` can be the GPAC codec name or the encoder instance for ffmpeg/others +- b=UINT, rate=UINT, bitrate=UINT: indicates the bitrate in bits per second +- g=UINT, gop=UINT: indicates the GOP size in frames +- pfmt=NAME: indicates the target pixel format name (see [properties (-h props)](filters_properties) ) of the source, if supported by codec +- all_intra=BOOL: indicates all frames should be intra frames, if supported by codec + Other options will be passed to the filter if it accepts generic argument parsing (as is the case for ffmpeg). The shortcut syntax `c=TYPE` (e.g. `c=aac:opts`) is also supported. @@ -159,12 +172,15 @@ _They do not specify which destination a filter can connect to._ When no link instructions are given (see below), the default linking strategy used is either _implicit mode_ (default in `gpac`) or _complete mode_ (if [-cl](gpac_general/#cl) is set). Each PID is checked for possible connection to all defined filters, in their declaration order. For each filter `DST` accepting a connection from the PID, directly or with intermediate filters: + - if `DST` filter has link directives, use them to allow or reject PID connection. - otherwise, if _complete mode_ is enabled, allow connection.. - otherwise (_implicit mode_): - - if `DST` is not a sink and is the first matching filter with no link directive, allow connection. - - otherwise, if `DST` is not a sink and is not the first matching filter with no link directive, reject connection. - - otherwise (`DST` is a sink) and no previous connections to a non-sink filter, allow connection. + + - if `DST` is not a sink and is the first matching filter with no link directive, allow connection. + - otherwise, if `DST` is not a sink and is not the first matching filter with no link directive, reject connection. + - otherwise (`DST` is a sink) and no previous connections to a non-sink filter, allow connection. + In all linking modes, a filter can prevent being linked to a filter with no link directives by setting `RSID` option on the filter. This is typically needed when dynamically inserting/removing filters in an existing session where some filters have no ID defined and are not desired for the inserted chain. @@ -175,16 +191,20 @@ Example gpac -i file.mp4 c=avc -o output ``` With this setup in _implicit mode_: + - if the file has a video PID, it will connect to `enc` but not to `output`. The output PID of `enc` will connect to `output`. - if the file has other PIDs than video, they will connect to `output`, since this `enc` filter accepts only video. + Example ``` gpac -cl -i file.mp4 c=avc -o output ``` With this setup in _complete mode_: + - if the file has a video PID, it will connect both to `enc` and to `output`, and the output PID of `enc` will connect to `output`. - if the file has other PIDs than video, they will connect to `output`. + Furthermore in _implicit mode_, filter connections are restricted to filters defined between the last source and the sink(s). Example @@ -192,8 +212,10 @@ Example gpac -i video1 reframer:saps=1 -i video2 ffsws:osize=128x72 -o output ``` This will connect: + - `video1` to `reframer` then `reframer` to `output` but will prevent `reframer` to `ffsws` connection. - `video2` to `ffsws` then `ffsws` to `output` but will prevent `video2` to `reframer` connection. + Example ``` @@ -218,8 +240,10 @@ Example gpac -i file.mp4 ffswf=osize:128x72 c=avc resample=osr=48k c=aac -o output ``` This will force: + - `SRC(video)->ffsws->enc(video)->output` and prevent `SRC(video)->output`, `SRC(video)->enc(video)` and `ffsws->output` connections which would happen in _complete mode_. - `SRC(audio)->resample->enc(audio)->output` and prevent `SRC(audio)->output`, `SRC(audio)->enc(audio)` and `resample->output` connections which would happen in _complete mode_. + ## Quick links Link between filters may be manually specified. The syntax is an `@` character optionally followed by an integer (0 if omitted). @@ -245,8 +269,10 @@ This indicates that `fZ` only accepts inputs from `fB`. ## Complex links The `@` link directive is just a quick shortcut to set the following filter arguments: -* FID=name: assigns an identifier to the filter -* SID=name1[,name2...]: sets a list of filter identifiers, or _sourceIDs_, restricting the list of possible inputs for a filter. + +- FID=name: assigns an identifier to the filter +- SID=name1[,name2...]: sets a list of filter identifiers, or _sourceIDs_, restricting the list of possible inputs for a filter. + Example ``` @@ -266,21 +292,25 @@ This indicates that `fD` only accepts input from `fA` and `fB` and `fC` only fro _Note: A filter with sourceID set cannot get input from filters with no IDs._ A sourceID name can be further extended using fragment identifier (`#` by default): -* name#PIDNAME: accepts only PID(s) with name `PIDNAME` -* name#TYPE: accepts only PIDs of matching media type. TYPE can be `audio`, `video`, `scene`, `text`, `font`, `meta` -* name#TYPEN: accepts only `N` (1-based index) PID of matching type from source (e.g. `video2` to only accept second video PID) -* name#TAG=VAL: accepts the PID if its parent filter has no tag or a tag matching `VAL` -* name#ITAG=VAL: accepts the PID if its parent filter has no inherited tag or an inherited tag matching `VAL` -* name#P4CC=VAL: accepts only PIDs with builtin property of type `P4CC` and value `VAL`. -* name#PName=VAL: same as above, using the builtin name corresponding to the property. -* name#AnyName=VAL: same as above, using the name of a non built-in property. -* name#Name=OtherPropName: compares the value with the value of another property of the PID. The matching will fail if the value to compare to is not present or different from the value to check. The property to compare with shall be a built-in property. + +- name#PIDNAME: accepts only PID(s) with name `PIDNAME` +- name#TYPE: accepts only PIDs of matching media type. TYPE can be `audio`, `video`, `scene`, `text`, `font`, `meta` +- name#TYPEN: accepts only `N` (1-based index) PID of matching type from source (e.g. `video2` to only accept second video PID) +- name#TAG=VAL: accepts the PID if its parent filter has no tag or a tag matching `VAL` +- name#ITAG=VAL: accepts the PID if its parent filter has no inherited tag or an inherited tag matching `VAL` +- name#P4CC=VAL: accepts only PIDs with builtin property of type `P4CC` and value `VAL`. +- name#PName=VAL: same as above, using the builtin name corresponding to the property. +- name#AnyName=VAL: same as above, using the name of a non built-in property. +- name#Name=OtherPropName: compares the value with the value of another property of the PID. The matching will fail if the value to compare to is not present or different from the value to check. The property to compare with shall be a built-in property. + If the property is not defined on the PID, the property is matched. Otherwise, its value is checked against the given value. The following modifiers for comparisons are allowed (for any fragment format using `=`): -* name#P4CC=!VAL: accepts only PIDs with property NOT matching `VAL`. -* name#P4CC-VAL: accepts only PIDs with property strictly less than `VAL` (only for 1-dimension number properties). -* name#P4CC+VAL: accepts only PIDs with property strictly greater than `VAL` (only for 1-dimension number properties). + +- name#P4CC=!VAL: accepts only PIDs with property NOT matching `VAL`. +- name#P4CC-VAL: accepts only PIDs with property strictly less than `VAL` (only for 1-dimension number properties). +- name#P4CC+VAL: accepts only PIDs with property strictly greater than `VAL` (only for 1-dimension number properties). + A sourceID name can also use wildcard or be empty to match a property regardless of the source filter. Example @@ -352,14 +382,18 @@ gpac -i file.mp4 -o dump.mp4:nomux This will result in a direct file copy. This only applies to local files destination. For pipes, sockets or other file outputs (HTTP, ROUTE): + - direct copy is enabled by default - `nomux=0` can be used to force remultiplex + ## Sub-session tagging Filters may be assigned to a sub-session using `:FS=N`, with `N` a positive integer. Filters belonging to different sub-sessions may only link to each-other: + - if explicitly allowed through sourceID directives (`@` or `SID`) - or if they have the same sub-session identifier + This is mostly used for _implicit mode_ in `gpac`: each first source filter specified after a sink filter will trigger a new sub-session. Example @@ -417,16 +451,18 @@ A filter may also be assigned an inherited tag (any string) using `:ITAG=name` o Destination URLs can be dynamically constructed using templates. Pattern `$KEYWORD$` is replaced in the template with the resolved value and `$KEYWORD%%0Nd$` is replaced in the template with the resolved integer, padded with up to N zeros if needed. `KEYWORD` is __case sensitive__, and may be present multiple times in the string. Supported `KEYWORD`: -* num: replaced by file number if defined, 0 otherwise -* PID: ID of the source PID -* URL: URL of source file -* File: path on disk for source file; if not found, use URL if set, or PID name otherwise -* Type: name of stream type of PID (`video`, `audio` ...) -* OType: same as `Type` but uses original type when stream is encrypted (e.g. move from `crypt` to `video`) -* p4cc=ABCD: uses PID property with 4CC value `ABCD` -* pname=VAL: uses PID property with name `VAL` -* cts, dts, dur, sap: uses properties of first packet in PID at template resolution time -* OTHER: locates property 4CC for the given name, or property name if no 4CC matches. + +- num: replaced by file number if defined, 0 otherwise +- PID: ID of the source PID +- URL: URL of source file +- File: path on disk for source file; if not found, use URL if set, or PID name otherwise +- Type: name of stream type of PID (`video`, `audio` ...) +- OType: same as `Type` but uses original type when stream is encrypted (e.g. move from `crypt` to `video`) +- p4cc=ABCD: uses PID property with 4CC value `ABCD` +- pname=VAL: uses PID property with name `VAL` +- cts, dts, dur, sap: uses properties of first packet in PID at template resolution time +- OTHER: locates property 4CC for the given name, or property name if no 4CC matches. + `$$` is an escape for $ @@ -496,10 +532,12 @@ Each audio track will be dumped to aac (potentially reencoding if needed). It is possible to define properties on output PIDs that will be declared by a filter. This allows tagging parts of the graph with different properties than other parts (for example `ServiceID`). The syntax is the same as filter option, and uses the fragment separator to identify properties, e.g. `#Name=Value`. This sets output PIDs property (4cc, built-in name or any name) to the given value. Value can be omitted for boolean (defaults to true, e.g. `:#Alpha`). Non built-in properties are parsed as follows: + - `file@FOO` will be declared as string with a value set to the content of `FOO`. - `bxml@FOO` will be declared as data with a value set to the binarized content of `FOO`. - `FOO` will be declared as string with a value set to `FOO`. - `TYPE@FOO` will be parsed according to `TYPE`. If the type is not recognized, the entire value is copied as string. See `gpac -h props` for defined types. + User-assigned PID properties on filter `fA` will be inherited by all filters dynamically loaded to solve `fA -> fB` connection. If `fB` also has user-assigned PID properties, these only apply starting from `fB` in the chain and are not inherited by filters between `fA` and `fB`. @@ -540,8 +578,10 @@ gpac -i source.mp4:#MyProp=(Width+1280)HD This will assign property `MyProp` to `HD` for PIDs with property `Width` greater than 1280. The property value can use templates with the following keywords: -* $GINC(init[,inc]) or @GINC(...): replaced by integer for each new output PID of the filter (see specific filter options for details on syntax) -* PROP (enclosed between `$` or `@`): replaced by serialized value of property `PROP` (name or 4CC) of the PID or with empty string if no such property + +- $GINC(init[,inc]) or @GINC(...): replaced by integer for each new output PID of the filter (see specific filter options for details on syntax) +- PROP (enclosed between `$` or `@`): replaced by serialized value of property `PROP` (name or 4CC) of the PID or with empty string if no such property + Example ``` gpac -i source.ts:#ASID=$PID$ @@ -553,6 +593,13 @@ gpac -i source.ts:#RepresentationID=$ServiceID$ ``` This will assign DASH Representation ID to the PID ServiceID value. +A property can also be removed by not specifying any value. Conditional removal is possible using the above syntax. +Example +``` +gpac -i source.ts:#FOO= +``` +This will remove the `FOO` property on the output PID. + # Using option files It is possible to use a file to define options of a filter, by specifying the target file name as an option without value, i.e. `:myopts.txt`. @@ -560,8 +607,10 @@ It is possible to use a file to define options of a filter, by specifying the ta __Warning: Only local files are allowed.__ An option file is a simple text file containing one or more options or PID properties on one or more lines. + - A line beginning with "//" is a comment and is ignored (not configurable). - A line beginning with ":" indicates an escaped option (the entire line is parsed as a single option). + Options in an option file may point to other option files, with a maximum redirection level of 5. An option file declaration (`filter:myopts.txt`) follows the same inheritance rules as regular options. Example @@ -598,15 +647,19 @@ Some specific keywords are replaced when processing filter options. __Warning: These keywords do not apply to PID properties. Multiple keywords cannot be defined for a single option.__ Defined keywords: -* $GSHARE: replaced by system path to GPAC shared directory (e.g. /usr/share/gpac) -* $GJS: replaced by the first path from global share directory and paths set through [-js-dirs](core_options/#js-dirs) that contains the file name following the macro, e.g. $GJS/source.js -* $GDOCS: replaced by system path to: - - application document directory for iOS - - `EXTERNAL_STORAGE` environment variable if present or `/sdcard` otherwise for Android - - user home directory for other platforms -* $GLANG: replaced by the global config language option [-lang](core_options/#lang) -* $GUA: replaced by the global config user agent option [-user-agent](core_options/#user-agent) -* $GINC(init_val[,inc]): replaced by `init_val` and increment `init_val` by `inc` (positive or negative number, 1 if not specified) each time a new filter using this string is created. + +- $GSHARE: replaced by system path to GPAC shared directory (e.g. /usr/share/gpac) +- $GJS: replaced by the first path from global share directory and paths set through [-js-dirs](core_options/#js-dirs) that contains the file name following the macro, e.g. $GJS/source.js +- $GDOCS: replaced by system path to: + + - application document directory for iOS + - `EXTERNAL_STORAGE` environment variable if present or `/sdcard` otherwise for Android + - user home directory for other platforms + +- $GLANG: replaced by the global config language option [-lang](core_options/#lang) +- $GUA: replaced by the global config user agent option [-user-agent](core_options/#user-agent) +- $GINC(init_val[,inc]): replaced by `init_val` and increment `init_val` by `inc` (positive or negative number, 1 if not specified) each time a new filter using this string is created. + The `$GINC` construct can be used to dynamically assign numbers in filter chains: Example @@ -616,38 +669,44 @@ gpac -i source.ts tssplit @#ServiceID= -o dump_$GINC(10,2).ts This will dump first service in dump_10.ts, second service in dump_12.ts, etc... As seen previously, the following options may be set on any filter, but are not visible in individual filter help: -* FID: filter identifier -* SID: filter source(s) (string value) -* N=NAME: filter name (string value) -* FS: sub-session identifier (unsigned int value) -* RSID: require sourceID to be present on target filters (no value) -* TAG: filter tag (string value) -* ITAG: filter inherited tag (string value) -* FBT: buffer time in microseconds (unsigned int value) -* FBU: buffer units (unsigned int value) -* FBD: decode buffer time in microseconds (unsigned int value) -* clone: explicitly enable/disable filter cloning flag (no value) -* nomux: enable/disable direct file copy (no value) -* gfreg: preferred filter registry names for link solving (string value) -* gfloc: following options are local to filter declaration, not inherited (no value) -* gfopt: following options are not tracked (no value) -* gpac: argument separator for URLs (no value) -* ccp: filter replacement control (string list value) -* NCID: ID of netcap configuration to use (string) -* LT: set additionnal log tools and levels for the filter usin same syntax as -logs, e.g. `:LT=filter@debug` (string value) -* DBG: debug missing input PID property (`=pid`), missing input packet property (`=pck`) or both (`=all`) + +- FID: filter identifier +- SID: filter source(s) (string value) +- N=NAME: filter name (string value) +- FS: sub-session identifier (unsigned int value) +- RSID: require sourceID to be present on target filters (no value) +- TAG: filter tag (string value) +- ITAG: filter inherited tag (string value) +- FBT: buffer time in microseconds (unsigned int value) +- FBU: buffer units (unsigned int value) +- FBD: decode buffer time in microseconds (unsigned int value) +- clone: explicitly enable/disable filter cloning flag (no value) +- nomux: enable/disable direct file copy (no value) +- gfreg: preferred filter registry names for link solving (string value) +- gfloc: following options are local to filter declaration, not inherited (no value) +- gfopt: following options are not tracked (no value) +- gpac: argument separator for URLs (no value) +- ccp: filter replacement control (string list value) +- NCID: ID of netcap configuration to use (string) +- LT: set additionnal log tools and levels for the filter usin same syntax as -logs, e.g. `:LT=filter@debug` (string value) +- DBG: debug missing input PID property (`=pid`), missing input packet property (`=pck`) or both (`=all`) + The buffer control options are used to change the default buffering of PIDs of a filter: + - `FBT` controls the maximum buffer time of output PIDs of a filter - `FBU` controls the maximum number of packets in buffer of output PIDs of a filter when timing is not available - `FBD` controls the maximum buffer time of input PIDs of a decoder filter, ignored for other filters + If another filter sends a buffer requirement messages, the maximum value of `FBT` (resp. `FBD`) and the user requested buffer time will be used for output buffer time (resp. decoding buffer time). The options `FBT`, `FBU`, `FBD` and `DBG` can be set: -* per filter instance: `fA reframer:FBU=2` -* per filter class for the run: `--reframer@FBU=2` -* in the GPAC config file in a per-filter section: `[filter@reframer]FBU=2` + +- per filter instance: `fA reframer:FBU=2` +- per filter class for the run: `--reframer@FBU=2` +- in the GPAC config file in a per-filter section: `[filter@reframer]FBU=2` + The default values are defined by the session default parameters `-buffer-gen`, `buffer-units` and `-buffer-dec`. diff --git a/docs/Filters/filters_properties.md b/docs/Filters/filters_properties.md index a8b1f0e3..82137654 100644 --- a/docs/Filters/filters_properties.md +++ b/docs/Filters/filters_properties.md @@ -41,8 +41,10 @@ alay | channel layout configuration, string or int value from ISO/IEC 23091-3 ## Built-in properties for PIDs and packets, pixel formats and audio formats Flags can be: -* D: droppable property, see [GSF multiplexer](gsfmx) filter help for more info -* P: property applying to packet + +- D: droppable property, see [GSF multiplexer](gsfmx) filter help for more info +- P: property applying to packet + Name | type | Flags | Description | 4CC --- | --- | --- | --- | --- @@ -55,7 +57,8 @@ ServiceID | uint | D | ID of parent service | PSID ClockID | uint | D | ID of clock reference PID | CKID DependencyID | uint | | ID of layer depended on | DPID SubLayer | bool | | PID is a sublayer of the stream depended on rather than an enhancement layer | DPSL -PlaybackMode | uint | D | Playback mode supported:
* 0: no time control
* 1: play/pause/seek,speed=1
* 2: play/pause/seek,speed>=0
* 3: play/pause/seek, reverse playback | PBKM +PlaybackMode | uint | D | Playback mode supported:
+- 0: no time control
- 1: play/pause/seek,speed=1
- 2: play/pause/seek,speed>=0
- 3: play/pause/seek, reverse playback | PBKM Scalable | bool | | Scalable stream | SCAL TileBase | bool | | Tile base stream | SABT TileID | uint | | ID of the tile for hvt1/hvt2 PIDs | PTID @@ -79,7 +82,7 @@ TimeshiftDepth | frac | D | Depth of the timeshift buffer | PTSD TimeshiftTime | dbl | D | Time in the timeshift buffer in seconds - changes are signaled through PID info (no reconfigure) | PTST TimeshiftState | uint | D | State of timeshift buffer: 0 is OK, 1 is underflow, 2 is overflow - changes are signaled through PID info (no reconfigure) | PTSS Timescale | uint | | Media timescale (a timestamp delta of N is N/timescale seconds) | TIMS -ProfileLevel | uint | D | MPEG-4 profile and level | PRPL +ProfileLevel | uint | D | Profile and level indication | PRPL DecoderConfig | mem | | Decoder configuration data | DCFG DecoderConfigEnhancement | mem | | Decoder configuration data of the enhancement layer(s). Also used by 3GPP/Apple text streams to give the full sample description table used in SDP. | ECFG DSISuperset | bool | | Decoder config is a superset of previous decoder config | DCFS @@ -104,7 +107,7 @@ BitDepthLuma | uint | | Bit depth for luma components | YBPS BitDepthChroma | uint | | Bit depth for chroma components | CBPS FPS | frac | | Video framerate | VFPF Interlaced | bool | | Video is interlaced | VILC -SAR | frac | | Sample (i.e. pixel) aspect ratio | PSAR +SAR | frac | | Sample (i.e. pixel) aspect ratio (negative values mean no SAR and removal of info in containers) | PSAR MaxWidth | uint | | Maximum width (video / text / graphics) of all enhancement layers | MWID MaxHeight | uint | | Maximum height (video / text / graphics) of all enhancement layers | MHEI ZOrder | sint | | Z-order of the video, from 0 (first) to max int (last) | VZIX @@ -117,7 +120,8 @@ CropOrigin | v2di | | Position in source window, X,Y indicate coordinates in so OriginalSize | v2di | | Original resolution of video | VOWH SRD | v4di | | Position and size of the video in the referential given by SRDRef | SRD SRDRef | v2di | | Width and Height of the SRD referential | SRDR -SRDMap | uintl | | Mapping of input videos in reconstructed video, expressed as {Ox,Oy,Ow,Oh,Dx,Dy,Dw,Dh} per input, with:
* Ox,Oy,Ow,Oh: position and size of the input video (usually matching its `SRD` property), expressed in the output referential given by `SRDRef`
* Dx,Dy,Dw,Dh: Position and Size of the input video in the reconstructed output, expressed in the output referential given by `SRDRef` | SRDM +SRDMap | uintl | | Mapping of input videos in reconstructed video, expressed as {Ox,Oy,Ow,Oh,Dx,Dy,Dw,Dh} per input, with:
+- Ox,Oy,Ow,Oh: position and size of the input video (usually matching its `SRD` property), expressed in the output referential given by `SRDRef`
- Dx,Dy,Dw,Dh: Position and Size of the input video in the reconstructed output, expressed in the output referential given by `SRDRef` | SRDM Alpha | bool | | Video in this PID is an alpha map | VALP Mirror | uint | | Mirror mode (as bit mask with flags 0: no mirror, 1: along Y-axis, 2: along X-axis) | VMIR Rotate | uint | | Video rotation as value*90 degree anti-clockwise | VROT @@ -178,7 +182,8 @@ CENC_SAI | mem | P | CENC SAI for the packet, formatted as (char(IV_Size))IV(u16 KeyInfo | mem | | Multi key info formatted as:
`is_mkey(u8);`
nb_keys(u16);
[
IV_size(u8);
KID(bin128);
if (!IV_size) {;
const_IV_size(u8);
constIV(const_IV_size);
}
]
` | CBIV ` CENCPattern | frac | | CENC crypt pattern, CENC pattern, skip as frac.num crypt as frac.den | CPTR CENCStore | 4cc | | Storage location 4CC of SAI data | CSTR -CENCstsdMode | uint | | Mode for CENC sample description when using clear samples:
* 0: single sample description is used
* 1: a clear clone of the sample description is created, inserted before the CENC sample description
* 2: a clear clone of the sample description is created, inserted after the CENC sample description | CSTM +CENCstsdMode | uint | | Mode for CENC sample description when using clear samples:
+- 0: single sample description is used
- 1: a clear clone of the sample description is created, inserted before the CENC sample description
- 2: a clear clone of the sample description is created, inserted after the CENC sample description | CSTM AMRModeSet | uint | | ModeSet for AMR and AMR-WideBand | AMST SubSampleInfo | mem | | Binary blob describing N subsamples of the sample, formatted as N [(u32)flags(u32)size(u32)codec_param(u8)priority(u8) discardable]. Subsamples for a given flag MUST appear in order, however flags can be interleaved | SUBS NALUMaxSize | uint | | Max size of NAL units in stream - changes are signaled through PID info change (no reconfigure) | NALS @@ -282,7 +287,8 @@ EQRClamp | v4di | D | Clamping of frame for EQR as 0.32 fixed point (x is top, y SceneNode | bool | | PID is a scene node decoder (AFX BitWrapper in BIFS) | PSND OrigCryptoScheme | 4cc | | Original crypto scheme on a decrypted PID | POCS TSBSegs | uint | D | Time shift in number of segments for HAS streams, only set by dashin and dasher filters | PTSN -IsManifest | uint | D | PID is a HAS manifest (MSB=1 if live)
* 0: not a manifest
* 1: DASH manifest
* 2: HLS manifest
* 3: GHI(X) manifest | PHSM +IsManifest | uint | D | PID is a HAS manifest (MSB=1 if live)
+- 0: not a manifest
- 1: DASH manifest
- 2: HLS manifest
- 3: GHI(X) manifest | PHSM Sparse | bool | D | PID has potentially empty times between packets | PSPA CharSet | str | D | Character set for input text PID | PCHS ForcedSub | uint | D | PID or Packet is forced sub
0: not forced
1: forced frame
2: all frames are forced (PID only) | PFCS @@ -521,6 +527,7 @@ dvbs | DVB Subtitles dvbs | DVB-TeleText div3 | MS-MPEG4 V3 caf | Apple Lossless Audio +dnx | AViD DNxHD # Audio channel layout code points (ISO/IEC 23091-3) @@ -530,17 +537,17 @@ mono | 1 | 0x0000000000000004 stereo | 2 | 0x0000000000000003 3/0.0 | 3 | 0x0000000000000007 3/1.0 | 4 | 0x0000000000000407 -3/2.0 | 5 | 0x0000000000000307 -3/2.1 | 6 | 0x000000000000030f -5/2.1 | 7 | 0x000000000000030f +3/2.0 | 5 | 0x0000000000000037 +3/2.1 | 6 | 0x000000000000003f +5/2.1 | 7 | 0x000000000000003f 1+1 | 8 | 0x0000000000000003 2/1.0 | 9 | 0x0000000000000403 2/2.0 | 10 | 0x0000000000000033 3/3.1 | 11 | 0x000000000000043f 3/4.1 | 12 | 0x000000000000033f 11/11.2 | 13 | 0x000000003ffe67cf -5/2.1 | 14 | 0x000000000006030f -5/5.2 | 15 | 0x000000000606630f +5/2.1 | 14 | 0x000000000006003f +5/5.2 | 15 | 0x000000000606603f 5/4.1 | 16 | 0x000000000036003f 6/5.1 | 17 | 0x00000000023e003f 6/7.1 | 18 | 0x00000600023e003f @@ -838,12 +845,28 @@ gmem | fin httpin | n/a gfio | fin | fout http | httpin | httpout https | httpin | httpout +dict | httpin | n/a +ftp | httpin | n/a +ftps | httpin | n/a +gopher | httpin | n/a +gophers | httpin | n/a +imap | httpin | n/a +imaps | httpin | n/a +mqtt | httpin | n/a +pop3 | httpin | n/a +pop3s | httpin | n/a +rtsp | httpin rtpin | rtspout +smb | httpin | n/a +smbs | httpin | n/a +smtp | httpin | n/a +smtps | httpin | n/a +telnet | httpin | n/a +tftp | httpin | n/a tcp | sockin | sockout udp | sockin | sockout tcpu | sockin | sockout udpu | sockin | sockout rtp | rtpin | rtpout -rtsp | rtpin | rtspout rtspu | rtpin | n/a rtsph | rtpin | rtspout satip | rtpin | n/a diff --git a/docs/Filters/fin.md b/docs/Filters/fin.md index 858c827d..49590d9f 100644 --- a/docs/Filters/fin.md +++ b/docs/Filters/fin.md @@ -15,6 +15,15 @@ The special file name `randsc` is used to generate random data with `0x000001` s The filter handles both files and GF_FileIO objects as input URL. +## Packet Injecting +The filter can be used to inject a single packet instead of a file using (-pck)[] option. +No specific properties are attached, except a timescale if (-ptime)[] is set. +Example +``` +gpac fin:pck=str@"My Sample Text":ptime=2500/100:#CodecID=stxt:#StreamType=text +``` +This will declare the PID as WebVTT and send a single packet with payload `My Sample Text` and a timestamp value of 25 second. + # Options @@ -24,4 +33,5 @@ The filter handles both files and GF_FileIO objects as input URL. __ext__ (cstr): override file extension __mime__ (cstr): set file mime type __pck__ (mem): data to use instead of file +__ptime__ (frac, default: _0/0_): timing for data packet, ignored if den is 0 diff --git a/docs/Filters/flist.md b/docs/Filters/flist.md index 70ebfc6c..057675b4 100644 --- a/docs/Filters/flist.md +++ b/docs/Filters/flist.md @@ -16,21 +16,27 @@ At each new source, the filter tries to remap input PIDs to already declared out The source list mode is activated by using `flist:srcs=f1[,f2]`, where f1 can be a file or a directory to enumerate. The syntax for directory enumeration is: -* dir, dir/ or dir/*: enumerates everything in directory `dir` -* foo/*.png: enumerates all files with extension png in directory `foo` -* foo/*.png;*.jpg: enumerates all files with extension png or jpg in directory `foo` + +- dir, dir/ or dir/*: enumerates everything in directory `dir` +- foo/*.png: enumerates all files with extension png in directory `foo` +- foo/*.png;*.jpg: enumerates all files with extension png or jpg in directory `foo` + The resulting file list can be sorted using [fsort](#fsort). If the sort mode is `datex` and source files are images or single frame files, the following applies: + - options [floop](#floop), [revert](#revert) and [fdur](#fdur) are ignored - the files are sorted by modification time - the first frame is assigned a timestamp of 0 - each frame (coming from each file) is assigned a duration equal to the difference of modification time between the file and the next file - the last frame is assigned the same duration as the previous one + When sorting by names: + - shorter filenames are inserted before longer filenames - alphabetical sorting is used if same filename length + # Playlist mode @@ -43,32 +49,40 @@ If the last URL played cannot be found in the playlist, the first URL in the pla When [ka](#ka) is used to keep refreshing the playlist on regular basis, the playlist must end with a new line. Playlist refreshing will abort: + - if the input playlist has a line not ending with a LF `(\n)` character, in order to avoid asynchronous issues when reading the playlist. - if the input playlist has not been modified for the [timeout](#timeout) option value (infinite by default). + ## Playlist directives A playlist directive line can contain zero or more directives, separated with space. The following directives are supported: -* repeat=N: repeats `N` times the content (hence played N+1). -* start=T: tries to play the file from start time `T` seconds (double format only). This may not work with some files/formats not supporting seeking. -* stop=T: stops source playback after `T` seconds (double format only). This works on any source (implemented independently from seek support). -* cat: specifies that the following entry should be concatenated to the previous source rather than opening a new source. This can optionally specify a byte range if desired, otherwise the full file is concatenated. + +- repeat=N: repeats `N` times the content (hence played N+1). +- start=T: tries to play the file from start time `T` seconds (double format only). This may not work with some files/formats not supporting seeking. +- stop=T: stops source playback after `T` seconds (double format only). This works on any source (implemented independently from seek support). +- cat: specifies that the following entry should be concatenated to the previous source rather than opening a new source. This can optionally specify a byte range if desired, otherwise the full file is concatenated. + _Note: When sources are ISOBMFF files or segments on local storage or GF_FileIO objects, the concatenation will be automatically detected._ -* srange=T: when cat is set, indicates the start `T` (64 bit decimal, default 0) of the byte range from the next entry to concatenate. -* send=T: when cat is set, indicates the end `T` (64 bit decimal, default 0) of the byte range from the next entry to concatenate. -* props=STR: assigns properties described in `STR` to all PIDs coming from the listed sources on next line. `STR` is formatted according to `gpac -h doc` using the default parameter set. -* del: specifies that the source file(s) must be deleted once processed, true by default if [fdel](#fdel) is set. -* out=V: specifies splicing start time (cf below). -* in=V: specifies splicing end time (cf below). -* nosync: prevents timestamp adjustments when joining sources (implied if `cat` is set). -* keep: keeps spliced period in output (cf below). -* mark: only inject marker for the splice period and do not load any replacement content (cf below). -* sprops=STR: assigns properties described in `STR` to all PIDs of the main content during a splice (cf below). `STR` is formatted according to `gpac -h doc` using the default parameter set. -* chap=NAME: assigns chapter name at the start of next URL (filter always removes source chapter names). + +- srange=T: when cat is set, indicates the start `T` (64 bit decimal, default 0) of the byte range from the next entry to concatenate. +- send=T: when cat is set, indicates the end `T` (64 bit decimal, default 0) of the byte range from the next entry to concatenate. +- props=STR: assigns properties described in `STR` to all PIDs coming from the listed sources on next line. `STR` is formatted according to `gpac -h doc` using the default parameter set. +- del: specifies that the source file(s) must be deleted once processed, true by default if [fdel](#fdel) is set. +- out=V: specifies splicing start time (cf below). +- in=V: specifies splicing end time (cf below). +- nosync: prevents timestamp adjustments when joining sources (implied if `cat` is set). +- keep: keeps spliced period in output (cf below). +- mark: only inject marker for the splice period and do not load any replacement content (cf below). +- sprops=STR: assigns properties described in `STR` to all PIDs of the main content during a splice (cf below). `STR` is formatted according to `gpac -h doc` using the default parameter set. +- chap=NAME: assigns chapter name at the start of next URL (filter always removes source chapter names). + The following global options (applying to the filter, not the sources) may also be set in the playlist: -* ka=N: force [ka](#ka) option to `N` millisecond refresh. -* floop=N: set [floop](#floop) option from within playlist. -* raw: set [raw](#raw) option from within playlist. + +- ka=N: force [ka](#ka) option to `N` millisecond refresh. +- floop=N: set [floop](#floop) option from within playlist. +- raw: set [raw](#raw) option from within playlist. + The default behavior when joining sources is to realign the timeline origin of the new source to the maximum time in all PIDs of the previous sources. This may create gaps in the timeline in case previous source PIDs are not of equal duration (quite common with most audio codecs). @@ -136,11 +150,13 @@ Directive can be used for the main media except concatenation directives. The splicing operations do not alter media frames and do not perform uncompressed domain operations such as cross-fade or mixing. The `out` (resp. `in`) directive specifies the media splice start (resp. end) time. The value can be formatted as follows: -* empty: the time is not yet assigned -* `now`: the time is resolved to the next SAP point in the media -* integer, float or fraction: set time in seconds -* `+VAL`: used for `in` only, specify the end point as delta in seconds from the start point (`VAL` can be integer, float or fraction) -* DATE: set splice time according to wall clock `DATE`, formatted as an `XSD dateTime` + +- empty: the time is not yet assigned +- `now`: the time is resolved to the next SAP point in the media +- integer, float or fraction: set time in seconds +- `+VAL`: used for `in` only, specify the end point as delta in seconds from the start point (`VAL` can be integer, float or fraction) +- DATE: set splice time according to wall clock `DATE`, formatted as an `XSD dateTime` + The splice times (except wall clock) are expressed in the source (main media) timing, not the reconstructed output timeline. When a splice begins (`out` time reached), the source items following the main media are played until the end of the splice or the end of the main media. @@ -149,12 +165,16 @@ Sources used during the splice period can use directives such as `start`, `dur` Once a splice is done (`in` time reached), the main media `out` splice time is reset to undefined. When the main media has undefined `out` or `in` splice times, the playlist is reloaded at each new main media packet to check for resolved values. + - `out` can only be modified when no splice is active, otherwise it is ignored. If modified, it resets the next source to play to be the one following the modified main media. - `in` can only be modified when a splice is active with an undefined end time, otherwise it is ignored. + When the main media is over: + - if `repeat` directive is set, the main media is repeated, `in` and `out` set to their initial values and the next splicing content is the one following the main content, - otherwise, the next source queued is the one following the last source played during the last splice period. + It is allowed to defined several main media in the playlist, but a main media is not allowed as media for a splice period. @@ -186,20 +206,22 @@ Directives `mark`, `keep` and `sprops` are reset at the end of the splice period __ka__ (uint, default: _0_): keep playlist alive (disable loop), waiting for a new input to be added or `#end` directive to end playlist. The value specifies the refresh rate in ms __timeout__ (luint, default: _-1_): timeout in ms after which the playlist is considered dead (`-1` means indefinitely) __fsort__ (enum, default: _no_): sort list of files -* no: no sorting, use default directory enumeration of OS -* name: sort by alphabetical name -* size: sort by increasing size -* date: sort by increasing modification time -* datex: sort by increasing modification time + +- no: no sorting, use default directory enumeration of OS +- name: sort by alphabetical name +- size: sort by increasing size +- date: sort by increasing modification time +- datex: sort by increasing modification time __sigcues__ (bool, default: _false_): inject `CueStart` property at each source begin (new or repeated) for DASHing __fdel__ (bool, default: _false_): delete source files after processing in playlist mode (does not delete the playlist) __keepts__ (bool, default: _false_): keep initial timestamps unmodified (no reset to 0) __raw__ (enum, default: _no_): force input AV streams to be in raw format -* no: do not force decoding of inputs -* av: force decoding of audio and video inputs -* a: force decoding of audio inputs -* v: force decoding of video inputs + +- no: do not force decoding of inputs +- av: force decoding of audio and video inputs +- a: force decoding of audio inputs +- v: force decoding of video inputs __flush__ (bool, default: _false_): send a flush signal once playlist is done before entering keepalive diff --git a/docs/Filters/fout.md b/docs/Filters/fout.md index 1ddae11f..efe8f266 100644 --- a/docs/Filters/fout.md +++ b/docs/Filters/fout.md @@ -18,9 +18,11 @@ In this case it accepts ANY type of input PID, not just file ones. # HTTP streaming recording When recording a DASH or HLS session, the number of segments to keep per quality can be set using [max_cache_segs](#max_cache_segs). + - value `0` keeps everything (default behaviour) - a negative value `N` will keep `-N` files regardless of the time-shift buffer value - a positive value `N` will keep `MAX(N, time-shift buffer)` files + Example ``` @@ -39,14 +41,16 @@ This will force keeping a maximum of 3 media segments while recording the DASH s __ext__ (cstr): set extension for graph resolution, regardless of file extension __mime__ (cstr): set mime type for graph resolution __cat__ (enum, default: _none_): cat each file of input PID rather than creating one file per filename -* none: never cat files -* auto: only cat if files have same names -* all: always cat regardless of file names + +- none: never cat files +- auto: only cat if files have same names +- all: always cat regardless of file names __ow__ (enum, default: _yes_): overwrite output mode when concatenation is not used -* yes: override file if existing -* no: throw error if file existing -* ask: interactive prompt + +- yes: override file if existing +- no: throw error if file existing +- ask: interactive prompt __mvbk__ (uint, default: _8192_): block size used when moving parts of the file around in patch mode __redund__ (bool, default: _false_): keep redundant packet in output file diff --git a/docs/Filters/ghidmx.md b/docs/Filters/ghidmx.md index 896b6a57..ab5f3e46 100644 --- a/docs/Filters/ghidmx.md +++ b/docs/Filters/ghidmx.md @@ -65,7 +65,10 @@ This generates init segment for representation `FOO` in file `BAR2`. The filter outputs are PIDs using framed packets marked with segment boundaries and can be chained to other filters before entering the dasher (e.g. for encryption, transcode...). If representation IDs are not assigned during index creation, they default to the 1-based index of the source. You can check them using: -EX: `gpac -i src.ghi inspect:full` +Example +``` +gpac -i src.ghi inspect:full +``` # Muxed Representations @@ -89,26 +92,31 @@ gpac -i index.ghi:rep=V2:sn=5:mux=A@V2 -o dash/vod.mpd This will generate the 5th segment containing representations `A` and `V2`. The filter does not store any state, it is the user responsibility to use consistent information across calls: + - do not change segment templates - do not change muxed representations to configurations not advertised in the generated manifests + # Recommendations Indexing supports fragmented and non-fragmented MP4, MPEG-2 TS and seekable inputs. + - It is recommended to use fragmented MP4 as input format since this greatly reduces file loading times. - If non-fragmented MP4 are used, it is recommended to use single-track files to decrease the movie box size and speedup parsing. - MPEG-2 TS sources will be slower since they require PES reframing and AU reformating, resulting in more IOs than with mp4. - other seekable sources will likely be slower (seeking, reframing) and are not recommended. + # Options __gm__ (enum, default: _main_): manifest generation mode -* none: no manifest generation (implied if sn is not 0) -* all: generate all manifests and init segments -* main: generate main manifest (MPD or master M3U8) -* child: generate child playlist for HLS -* init: generate init segment + +- none: no manifest generation (implied if sn is not 0) +- all: generate all manifests and init segments +- main: generate main manifest (MPD or master M3U8) +- child: generate child playlist for HLS +- init: generate init segment __force__ (bool, default: _false_): force loading sources in manifest generation for debug __rep__ (str): representation to generate diff --git a/docs/Filters/glpush.md b/docs/Filters/glpush.md index 4cfb1c03..2e59203d 100644 --- a/docs/Filters/glpush.md +++ b/docs/Filters/glpush.md @@ -3,7 +3,7 @@ # GPU texture uploader Register name used to load filter: __glpush__ -This is a JavaScript filter, not checked during graph resolution and needs explicit loading. +This is a JavaScript filter. It is not checked during graph resolution and needs explicit loading. Author: GPAC team This filter pushes input video streams to GPU as OpenGL textures. It can be used to simulate hardware decoders dispatching OpenGL textures diff --git a/docs/Filters/gpac_general.md b/docs/Filters/gpac_general.md index 53726f93..964e0d6c 100644 --- a/docs/Filters/gpac_general.md +++ b/docs/Filters/gpac_general.md @@ -6,8 +6,10 @@ gpac is GPAC's command line tool for setting up and running filter chains. _FILTER_: a single filter declaration (e.g., `-i file`, `-o dump`, `inspect`, ...), see [gpac -h doc](filters_general#filter-declaration-filter). _[LINK]_: a link instruction (e.g., `@`, `@2`, `@2#StreamType=Visual`, ...), see [gpac -h doc](filters_general#explicit-links-between-filters-link). _[options]_: one or more option strings, each starting with a `-` character. - - an option using a single `-` indicates an option of gpac (see [gpac -hx](gpac_general#h)) or of libgpac (see [gpac -hx core](core_options)) - - an option using `--` indicates a global filter or meta-filter (e.g. FFmpeg) option, e.g. `--block_size=1000` or `--profile=Baseline` (see [gpac -h doc](core_config#global-filter-options)) + + - an option using a single `-` indicates an option of gpac (see [gpac -hx](gpac_general#h)) or of libgpac (see [gpac -hx core](core_options)) + - an option using `--` indicates a global filter or meta-filter (e.g. FFmpeg) option, e.g. `--block_size=1000` or `--profile=Baseline` (see [gpac -h doc](core_config#global-filter-options)) + Filter declaration order may impact the link resolver which will try linking in declaration order. Most of the time for simple graphs, this has no impact. However, for complex graphs with no link declarations, this can lead to different results. Options do not require any specific order, and may be present anywhere, including between link statements or filter declarations. @@ -17,6 +19,8 @@ The session can be interrupted at any time using `ctrl+c`, which can also be use The possible options for gpac are: +__-mem-track__: enable memory tracker +__-mem-track-stack__: enable memory tracker with stack dumping __-ltf__: load test-unit filters (used for for unit tests only) __-sloop__ (int): loop execution of session, creating a session at each loop, mainly used for testing. If no value is given, loops forever __-runfor__ (int): run for the given amount of milliseconds, exit with full session flush @@ -29,11 +33,13 @@ The possible options for gpac are: __-qe__: enable quick exit (no mem cleanup) __-k__: enable keyboard interaction from command line __-r__ (string): enable reporting -* r: runtime reporting -* r=FA[,FB]: runtime reporting but only print given filters, e.g. `r=mp4mx` for ISOBMFF multiplexer only -* r=: only print final report + +- r: runtime reporting +- r=FA[,FB]: runtime reporting but only print given filters, e.g. `r=mp4mx` for ISOBMFF multiplexer only +- r=: only print final report __-seps__ (string, default: __:=#,!@__): set the default character sets used to separate various arguments + - the first char is used to separate argument names - the second char, if present, is used to separate names and values - the third char, if present, is used to separate fragments for PID sources @@ -55,40 +61,45 @@ The possible options for gpac are: __-step__: test step mode in non-blocking session __-h__,__-help,-ha,-hx,-hh__ (string): print help. Use `-help` or `-h` for basic options, `-ha` for advanced options, `-hx` for expert options and `-hh` for all. _Note: The `@` character can be used in place of the `*` character. String parameter can be:_ -* empty: print command line options help -* doc: print the general filter info -* alias: print the gpac alias syntax -* log: print the log system help -* core: print the supported libgpac core options. Use -ha/-hx/-hh for advanced/expert options -* cfg: print the GPAC configuration help -* net: print network interfaces -* prompt: print the GPAC prompt help when running in interactive mode (see [-k](gpac_general/#k) ) -* modules: print available modules -* module NAME: print info and options of module `NAME` -* creds: print credential help -* filters: print name of all available filters -* filters:*: print name of all available filters, including meta filters -* codecs: print the supported builtin codecs - use `-hx` to include unmapped codecs (ffmpeg, ...) -* formats: print the supported formats (`-ha`: print filter names, `-hx`: include meta filters (ffmpeg,...), `-hh`: print mime types) -* protocols: print the supported protocol schemes (`-ha`: print filter names, `-hx`: include meta filters (ffmpeg,...), `-hh`: print all) -* props: print the supported builtin PID and packet properties -* props PNAME: print the supported builtin PID and packet properties mentioning `PNAME` -* colors: print the builtin color names and their values -* layouts: print the builtin CICP audio channel layout names and their values -* links: print possible connections between each supported filters (use -hx to view src->dst cap bundle detail) -* links FNAME: print sources and sinks for filter `FNAME` (either builtin or JS filter) -* defer: print defer mode help -* FNAME: print filter `FNAME` info (multiple FNAME can be given) - - For meta-filters, use `FNAME:INST`, e.g. `ffavin:avfoundation` - - Use `*` to print info on all filters (_big output!_), `*:*` to print info on all filters including meta filter instances (_really big output!_) - - By default only basic filter options and description are shown. Use `-ha` to show advanced options capabilities, `-hx` for expert options, `-hh` for all options and filter capabilities including on filters disabled in this build -* FNAME.OPT: print option `OPT` in filter `FNAME` -* OPT: look in filter names and options for `OPT` and suggest possible matches if none found. Use `-hx` to look for keyword in all option descriptions + +- empty: print command line options help +- doc: print the general filter info +- alias: print the gpac alias syntax +- log: print the log system help +- core: print the supported libgpac core options. Use -ha/-hx/-hh for advanced/expert options +- cfg: print the GPAC configuration help +- net: print network interfaces +- prompt: print the GPAC prompt help when running in interactive mode (see [-k](gpac_general/#k) ) +- modules: print available modules +- module NAME: print info and options of module `NAME` +- creds: print credential help +- filters: print name of all available filters +- filters:*: print name of all available filters, including meta filters +- codecs: print the supported builtin codecs - use `-hx` to include unmapped codecs (ffmpeg, ...) +- formats: print the supported formats (`-ha`: print filter names, `-hx`: include meta filters (ffmpeg,...), `-hh`: print mime types) +- protocols: print the supported protocol schemes (`-ha`: print filter names, `-hx`: include meta filters (ffmpeg,...), `-hh`: print all) +- props: print the supported builtin PID and packet properties +- props PNAME: print the supported builtin PID and packet properties mentioning `PNAME` +- colors: print the builtin color names and their values +- layouts: print the builtin CICP audio channel layout names and their values +- links: print possible connections between each supported filters (use -hx to view src->dst cap bundle detail) +- links FNAME: print sources and sinks for filter `FNAME` (either builtin or JS filter) +- defer: print defer mode help +- FNAME: print filter `FNAME` info (multiple FNAME can be given) + + - For meta-filters, use `FNAME:INST`, e.g. `ffavin:avfoundation` + - Use `*` to print info on all filters (_big output!_), `*:*` to print info on all filters including meta filter instances (_really big output!_) + - By default only basic filter options and description are shown. Use `-ha` to show advanced options capabilities, `-hx` for expert options, `-hh` for all options and filter capabilities including on filters disabled in this build + +- FNAME.OPT: print option `OPT` in filter `FNAME` +- OPT: look in filter names and options for `OPT` and suggest possible matches if none found. Use `-hx` to look for keyword in all option descriptions __-p__ (string): use indicated profile for the global GPAC config. If not found, config file is created. If a file path is indicated, this will load profile from that file. Otherwise, this will create a directory of the specified name and store new config there. The following reserved names create a temporary profile (not stored on disk): -* 0: full profile -* n: null profile disabling shared modules/filters and system paths in config (may break GUI and other filters) + +- 0: full profile +- n: null profile disabling shared modules/filters and system paths in config (may break GUI and other filters) + Appending `:reload` to the profile name will force recreating a new configuration file __-alias__ (string): assign a new alias or remove an alias. Can be specified several times. See [alias usage (-h alias)](#using-aliases) @@ -102,6 +113,7 @@ Appending `:reload` to the profile name will force recreating a new configuratio __-xopt__: unrecognized options and filters declaration following this option are ignored - used to pass arguments to GUI __-creds__ (string): setup credentials as used by servers +__-rv__: return absolute value of GPAC internal error instead of 1 when error The following libgpac core options allow customizing the filter session: @@ -110,21 +122,24 @@ The following libgpac core options allow customizing the filter session: __-full-link__: throw error if any PID in the filter graph cannot be linked __-no-dynf__: disable dynamically loaded filters __-no-block__ (Enum, default: __no__): disable blocking mode of filters -* no: enable blocking mode -* fanout: disable blocking on fan-out, unblocking the PID as soon as one of its destinations requires a packet -* all: disable blocking + +- no: enable blocking mode +- fanout: disable blocking on fan-out, unblocking the PID as soon as one of its destinations requires a packet +- all: disable blocking __-no-reg__: disable regulation (no sleep) in session __-no-reassign__: disable source filter reassignment in PID graph resolution __-sched__ (Enum, default: __free__): set scheduler mode -* free: lock-free queues except for task list (default) -* lock: mutexes for queues when several threads -* freex: lock-free queues including for task lists (experimental) -* flock: mutexes for queues even when no thread (debug mode) -* direct: no threads and direct dispatch of tasks whenever possible (debug mode) + +- free: lock-free queues except for task list (default) +- lock: mutexes for queues when several threads +- freex: lock-free queues including for task lists (experimental) +- flock: mutexes for queues even when no thread (debug mode) +- direct: no threads and direct dispatch of tasks whenever possible (debug mode) __-max-chain__ (int, default: __6__): set maximum chain length when resolving filter links. Default value covers for _[ in -> ] dmx -> reframe -> decode -> encode -> reframe -> mx [ -> out]_. Filter chains loaded for adaptation (e.g. pixel format change) are loaded after the link resolution. Setting the value to 0 disables dynamic link resolution. You will have to specify the entire chain manually __-max-sleep__ (int, default: __50__): set maximum sleep time slot in milliseconds when regulation is enabled +__-step-link__: load filters one by one when solvink a link instead of loading all filters for the solved path __-threads__ (int): set N extra thread for the session. -1 means use all available cores __-no-probe__: disable data probing on sources and relies on extension (faster load but more error-prone) __-no-argchk__: disable tracking of argument usage (all arguments will be considered as used) @@ -138,8 +153,10 @@ The following libgpac core options allow customizing the filter session: The gpac command line can become quite complex when many sources or filters are used. In order to simplify this, an alias system is provided. To assign an alias, use the syntax `gpac -alias="NAME VALUE"`. -* `NAME`: shall be a single string, with no space. -* `VALUE`: the list of argument this alias replaces. If not set, the alias is destroyed + +- `NAME`: shall be a single string, with no space. +- `VALUE`: the list of argument this alias replaces. If not set, the alias is destroyed + When parsing arguments, the alias will be replace by its value. Example @@ -149,17 +166,21 @@ gpac -alias="output aout vout" This allows later audio and video playback using `gpac -i src.mp4 output` Aliases can use arguments from the command line. The allowed syntaxes are: -* `@{a}`: replaced by the value of the argument with index `a` after the alias -* `@{a,b}`: replaced by the value of the arguments with index `a` and `b` -* `@{a:b}`: replaced by the value of the arguments between index `a` and `b` -* `@{-a,b}`: replaced by the value of the arguments with index `a` and `b`, inserting a list separator (comma by default) between them -* `@{-a:b}`: replaced by the value of the arguments between index `a` and `b`, inserting a list separator (comma by default) between them -* `@{+a,b}`: clones the parent word in the alias for `a` and `b`, replacing this pattern in each clone by the corresponding argument -* `@{+a:b}`: clones the parent word in the alias for each argument between index `a` and `b`, replacing this pattern in each clone by the corresponding argument + +- `@{a}`: replaced by the value of the argument with index `a` after the alias +- `@{a,b}`: replaced by the value of the arguments with index `a` and `b` +- `@{a:b}`: replaced by the value of the arguments between index `a` and `b` +- `@{-a,b}`: replaced by the value of the arguments with index `a` and `b`, inserting a list separator (comma by default) between them +- `@{-a:b}`: replaced by the value of the arguments between index `a` and `b`, inserting a list separator (comma by default) between them +- `@{+a,b}`: clones the parent word in the alias for `a` and `b`, replacing this pattern in each clone by the corresponding argument +- `@{+a:b}`: clones the parent word in the alias for each argument between index `a` and `b`, replacing this pattern in each clone by the corresponding argument + The specified index can be: -* forward index: a strictly positive integer, 1 being the first argument after the alias -* backward index: the value 'n' (or 'N') to indicate the last argument on the command line. This can be followed by `-x` to rewind arguments (e.g. `@{n-1}` is the before last argument) + +- forward index: a strictly positive integer, 1 being the first argument after the alias +- backward index: the value 'n' (or 'N') to indicate the last argument on the command line. This can be followed by `-x` to rewind arguments (e.g. `@{n-1}` is the before last argument) + Before solving aliases, all option arguments are moved at the beginning of the command line. This implies that alias arguments cannot be options. Arguments not used by any aliases are kept on the command line, other ones are removed @@ -198,17 +219,19 @@ The file can be overwritten using the [-users](core_options/#users) option. By default, this file does not exist until at least one user has been configured. The [creds](#creds) option allows inspecting or modifying the users and groups information. The syntax for the option value is: -* `show` or no value: prints the `users.cfg` file -* `reset`: deletes the `users.cfg` file (i.e. deletes all users and groups) -* `NAME`: show information of user `NAME` -* `+NAME`: adds user `NAME` -* `+NAME:I1=V1[,I2=V2]`: sets info `I1` with value `V1` to user `NAME`. The info name `password` resets password without prompt. -* `-NAME`: removes user `NAME` -* `_NAME`: force password change of user `NAME` -* `@NAME`: show information of group `NAME` -* `@+NAME[:u1[,u2]]`: adds group `NAME` if not existing and adds specified users to group -* `@-NAME:u1[,u2]`: removes specified users from group `NAME` -* `@-NAME`: removes group `NAME` + +- `show` or no value: prints the `users.cfg` file +- `reset`: deletes the `users.cfg` file (i.e. deletes all users and groups) +- `NAME`: show information of user `NAME` +- `+NAME`: adds user `NAME` +- `+NAME:I1=V1[,I2=V2]`: sets info `I1` with value `V1` to user `NAME`. The info name `password` resets password without prompt. +- `-NAME`: removes user `NAME` +- `_NAME`: force password change of user `NAME` +- `@NAME`: show information of group `NAME` +- `@+NAME[:u1[,u2]]`: adds group `NAME` if not existing and adds specified users to group +- `@-NAME:u1[,u2]`: removes specified users from group `NAME` +- `@-NAME`: removes group `NAME` + By default all added users are members of the group `users`. Passwords are not stored, only a SHA256 hash is stored. @@ -223,12 +246,14 @@ rg=bar ``` The following keys are defined per directory, but may be ignored by the server depending on its operation mode: -* ru: comma-separated list of user names with read access to the directory -* rg: comma-separated list of group names with read access to the directory -* wu: comma-separated list of user names with write access to the directory -* wg: comma-separated list of group names with write access to the directory -* mcast: comma-separated list of user names with multicast creation rights (RTSP server only) -* filters: comma-separated list of filter names for which the directory is valid. If not found or `all`, applies to all filters + +- ru: comma-separated list of user names with read access to the directory +- rg: comma-separated list of group names with read access to the directory +- wu: comma-separated list of user names with write access to the directory +- wg: comma-separated list of group names with write access to the directory +- mcast: comma-separated list of user names with multicast creation rights (RTSP server only) +- filters: comma-separated list of filter names for which the directory is valid. If not found or `all`, applies to all filters + Rights can be configured on sub-directories by adding sections for the desired directories. Example @@ -239,7 +264,69 @@ rg=bar ru=foo ``` With this configuration: + - the directory `d1` will be readable by all members of group `bar` - the directory `d1/d2` will be readable by user `foo` only + Servers in GPAC currently only support the `Basic` HTTP authentication scheme, and should preferably be run over TLS. + +# Defer test mode + +This mode can be used to test loading filters one by one and asking for link resolution explicitly. +This is mostly used to reproduce how sessions are build in more complex applications. + +The options `rl`, `pi`, `pl` and `pd` allow adressing a filter by index `F` in a list. + +- if the option is suffixed with an `x` (e.g. `rlx=`), `F=0` means the last filter in the list of filters in the session +- otherwise, `F=0` means the last filter declared before the option + + +The relink options `-rl` and `-rlx` always flush the session (run until no more tasks are scheduled). +The last run can be omitted. + +Example +``` +gpac -dl -np -i SRC reframer -g -rl -g inspect -g -rl +``` +This will load SRC and reframer, print the graph (no connection), relink SRC, print the graph (connection to reframer), insert inspect, print the graph (no connection), relink reframer and run. No play event is sent here. +Example +``` +gpac -dl -np -i SRC reframer inspect:deep -g -rl=2 -g -rl -se +``` +This will load SRC, reframer and inspect, print the graph (no connection), relink SRC, print the graph (connection to reframer), print the graph (no connection), relink reframer, send play and run. + +Linking can be done once filters are loaded, using the syntax `@F@SRC` or `@@F@SRC`: + +- `@F` indicates the destination filter using a 0-based index `F` starting from the last laoded filter, e.g. `@0` indicates the last loaded filter. +- `@@F` indicates the target filter using a 0-based index `F` starting from the first laoded filter, e.g. `@@1` indicates the second loaded filter. +- `@SRC`or `@@SRC`: same syntax as link directives + +Sources MUST be set before relinking outputs using (-rl)[]. +Example +``` +gpac -dl -i SRC F1 F2 [...] @1@2 @0@2 +``` +This will set SRC as source to F1 and SRC as source to F2 after loading all filters. + +The following options are used in defer mode: + +__-dl__: enable defer linking mode for step-by-step graph building tests +__-np__: prevent play event from sinks +__-rl[=F]__ (string): relink outputs of filter `F` (default 1) +__-wl[=F]__ (string): same as `-rl` but does not flush session) +__-pi=[+|-][F[:i]]__ (string): print PID properties (all or of index `i`) of filter `F` (default 0) + +- if prefixed with `-`: only list PIDs +- if prefixed with `+`: also print PID info + +__-pl=[+][F[:i]]@NAME__ (string): probe filter chain from filter `F` (default 0) to the given filter `NAME`: + +- if prefixed with `+`: print all known chains and their priorities + +__-pd=[F[:i]]__ (string): print possible PID destinations (all or of index `i`) of filter `F` (default 0) +__-f__: flush session until no more tasks +__-g__: print graph +__-s__: print stats +__-se__: send PLAY event from sinks (only done once) +__-m__ (string): print message diff --git a/docs/Filters/gsfmx.md b/docs/Filters/gsfmx.md index 6cbd3c9e..038d4c5c 100644 --- a/docs/Filters/gsfmx.md +++ b/docs/Filters/gsfmx.md @@ -60,9 +60,10 @@ This will DASH the source, store the manifest file and the media streams with th __sigbo__ (bool, default: _false_): signal byte offset __sigdts__ (bool, default: _true_): signal decoding timestamp __dbg__ (enum, default: _no_): set debug mode -* no: disable debug -* nodata: force packet size to 0 -* nopck: skip packet + +- no: disable debug +- nodata: force packet size to 0 +- nopck: skip packet __key__ (mem): encrypt packets using given key __IV__ (mem): set IV for encryption - a constant IV is used to keep packet overhead small (cbcs-like) diff --git a/docs/Filters/hevcmerge.md b/docs/Filters/hevcmerge.md index 6ad04ac0..ed886194 100644 --- a/docs/Filters/hevcmerge.md +++ b/docs/Filters/hevcmerge.md @@ -22,8 +22,10 @@ If `CropOrigin` is used, it shall be set on all input sources. If positive coordinates are used, they specify absolute positioning in pixels of the tiles. The coordinates are automatically adjusted to the next multiple of max CU width and height. If negative coordinates are used, they specify relative positioning (e.g. `0x-1` indicates to place the tile below the tile 0x0). In this mode, it is the caller responsibility to set coordinates so that all tiles in a column have the same width and only the last row/column uses non-multiple of max CU width/height values. The filter will complain and abort if this is not respected. + - If an horizontal blank is detected in the layout, an empty column in the tiling grid will be inserted. - If a vertical blank is detected in the layout, it is ignored. + ## Spatial Relationship Description (SRD) @@ -32,8 +34,10 @@ The filter will create an `SRDMap` property in the output PID if `SRDRef` and `S The `SRDMap` allows forwarding the logical sources `SRD` in the merged PID. The output PID `SRDRef` is set to the output video size. The input `SRDRef` and `SRD` are usually specified in DASH MPD, but can be manually assigned to inputs. + - `SRDRef` gives the size of the referential used for the input `SRD` (usually matches the original video size, but not always) - `SRD` gives the size and position of the input in the original video, expressed in `SRDRef` referential of the input. + The inputs do not need to have matching `SRDRef` .EX src1:SRD=0x0x640x480:SRDRef=1280x720 This indicates that `src1` contains a video located at 0,0, with a size of 640x480 pixels in a virtual source of 1280x720 pixels. @@ -44,15 +48,19 @@ src2:SRD=640x0x640x480:SRDRef=1280x720 This indicates that `src1` contains a video located at 640,0, with a size of 640x480 pixels in a virtual source of 1280x720 pixels. Each merged input is described by 8 integers in the output `SRDMap`: + - the source `SRD` is rescaled in the output `SRDRef` to form the first part (4 integers) of the `SRDMap` (i.e. _where was the input ?_) - the source location in the reconstructed video forms the second part (4 integers) of the `SRDMap` (i.e. _where are the input pixels in the output ?_) + Assuming the two sources are encoded at 320x240 and merged as src2 above src1, the output will be a 320x480 video with a `SRDMap` of {0,160,160,240,0,0,320,240,0,0,160,240,0,240,320,240} _Note: merged inputs are always listed in `SRDMap` in their tile order in the output bitstream._ Alternatively to using `SRD` and `SRDRef`, it is possible to specify `CropOrigin` property on the inputs, in which case: + - the `CropOrigin` gives the location in the source - the input size gives the size in the source, and no rescaling of referential is done + Example ``` src1:CropOrigin=0x0 src1:CropOrigin=640x0 diff --git a/docs/Filters/httpin.md b/docs/Filters/httpin.md index 0a521eec..d28ae49a 100644 --- a/docs/Filters/httpin.md +++ b/docs/Filters/httpin.md @@ -19,13 +19,14 @@ _Note: Unless disabled at session level (see [-no-probe](core_options/#no-probe) __src__ (cstr): URL of source content __block_size__ (uint, default: _100000_): block size used to read file __cache__ (enum, default: _none_): set cache mode -* auto: cache to disk if content length is known, no cache otherwise -* disk: cache to disk, discard once session is no longer used -* keep: cache to disk and keep -* mem: stores to memory, discard once session is no longer used -* mem_keep: stores to memory, keep after session is reassigned but move to `mem` after first download -* none: no cache -* none_keep: stores to memory, keep after session is reassigned but move to `none` after first download + +- auto: cache to disk if content length is known, no cache otherwise +- disk: cache to disk, discard once session is no longer used +- keep: cache to disk and keep +- mem: stores to memory, discard once session is no longer used +- mem_keep: stores to memory, keep after session is reassigned but move to `mem` after first download +- none: no cache +- none_keep: stores to memory, keep after session is reassigned but move to `none` after first download __range__ (lfrac, default: _0-0_): set byte range, as fraction __ext__ (cstr): override file extension diff --git a/docs/Filters/httpout.md b/docs/Filters/httpout.md index 52218a7c..878a9a61 100644 --- a/docs/Filters/httpout.md +++ b/docs/Filters/httpout.md @@ -6,16 +6,20 @@ Register name used to load filter: __httpout__ This filter may be automatically loaded during graph resolution. 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, and basic OPTIONS support. Single or multiple byte ranges are supported for both GET and PUT/POST methods, in all server modes. + - 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. + __Warning: the partial PUT request is RFC2616 compliant but not compliant with RFC7230. PATCH method is not yet implemented in GPAC.__ @@ -26,9 +30,11 @@ When multiple read directories are specified, the server root `/` contains the l 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). A directory rule file (cf `gpac -h creds`) can be specified in [rdirs](#rdirs) but NOT in [wdir](#wdir). When rules are used: + - if a directory has a `name` rule, it will be used in the URL - otherwise, the directory is directly available under server root `/` - read and write access rights are checked + Example ``` [foodir] @@ -102,10 +108,14 @@ This mode should not be used with multiple files muxers such as DASH or HLS. 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 URL matches the name of a file currently being written by the server. + - If so, the server will: - - send the content using HTTP chunk transfer mode, starting with what is already written on disk - - push remaining data to the client as soon as received while writing it to disk, until source file is done + + - send the content using HTTP chunk transfer mode, starting with what is already written on disk + - push remaining data to the client as soon as received while writing it to disk, until source file is done + - If not so, the server will simply send the file from the disk as a regular HTTP session, without chunk transfer. + This mode is typically used for origin server in HAS sessions where clients may request files while they are being produced (low latency DASH). Example @@ -118,10 +128,12 @@ The server can store incoming files to memory mode by setting the read directory In this mode, [max_cache_segs](#max_cache_segs) is always at least 1. If [max_cache_segs](#max_cache_segs) value `N` is not 0, each incoming PID will store at most: + - `MIN(N, time-shift depth)` files if stored in memory - `-N` files if stored locally and `N` is negative - `MAX(N, time-shift depth)` files if stored locally and `N` is positive - unlimited otherwise (files stored locally, `N` is positive and no time-shift info) + # HTTP client sink @@ -158,16 +170,20 @@ The server currently only operates in either HTTPS or HTTP mode and cannot run b # Multiple destinations on single server When running in server mode, multiple HTTP outputs with same URL/port may be used: + - the first loaded HTTP output filter with same URL/port will be reused - all httpout options of subsequent httpout filters, except [dst](#dst) will be ignored, other options will be inherited as usual + Example ``` gpac -i dash.mpd dashin:forward=file:FID=D1 dashin:forward=segb:FID=D2 -o http://localhost:80/live.mpd:SID=D1:rdirs=dash -o http://localhost:80/live_rw.mpd:SID=D2:sigfrag ``` This will: + - load the HTTP server and forward (through `D1`) the dash session to this server using `live.mpd` as manifest name - reuse the HTTP server and regenerate the manifest (through `D2` and `sigfrag` option), using `live_rw.mpd` as manifest name + # Options @@ -187,9 +203,10 @@ This will: __cache_control__ (str): specify the `Cache-Control` string to add (`none` disable cache control and ETag) __hold__ (bool, default: _false_): hold packets until one client connects __hmode__ (enum, default: _default_): filter operation mode, ignored if [wdir](#wdir) is set -* default: run in server mode -* push: run in client mode using PUT or POST -* source: use server as source filter on incoming PUT/POST + +- default: run in server mode +- push: run in client mode using PUT or POST +- source: use server as source filter on incoming PUT/POST __timeout__ (uint, default: _30_): timeout in seconds for persistent connections (0 disable timeout) __ext__ (cstr): set extension for graph resolution, regardless of file extension @@ -199,9 +216,10 @@ This will: __dlist__ (bool, default: _false_): enable HTML listing for GET requests on directories __sutc__ (bool, default: _false_): insert server UTC in response headers as `Server-UTC: VAL_IN_MS` __cors__ (enum, default: _auto_): insert CORS header allowing all domains -* off: disable CORS -* on: enable CORS -* auto: enable CORS when `Origin` is found in request + +- off: disable CORS +- on: enable CORS +- auto: enable CORS when `Origin` is found in request __reqlog__ (str): provide short log of the requests indicated in this option (comma separated list, `*` for all) regardless of HTTP log settings. Value `REC` logs file writing start/end. If prefix `-` is set, do not log request end __ice__ (bool, default: _false_): insert ICE meta-data in response headers in sink mode diff --git a/docs/Filters/inspect.md b/docs/Filters/inspect.md index 5bfc9691..020e6f7a 100644 --- a/docs/Filters/inspect.md +++ b/docs/Filters/inspect.md @@ -16,50 +16,54 @@ _Note: specifying [xml](#xml), [analyze](#analyze), [fmt](#fmt) or using `-for-t The packet inspector can be configured to dump specific properties of packets using [fmt](#fmt). When the option is not present, all properties are dumped. Otherwise, only properties identified by `$TOKEN$` are printed. You may use '$', '@' or '%' for `TOKEN` separator. `TOKEN` can be: -* pn: packet (frame in framed mode) number -* dts: decoding time stamp in stream timescale, N/A if not available -* ddts: difference between current and previous packets decoding time stamp in stream timescale, N/A if not available -* cts: composition time stamp in stream timescale, N/A if not available -* dcts: difference between current and previous packets composition time stamp in stream timescale, N/A if not available -* ctso: difference between composition time stamp and decoding time stamp in stream timescale, N/A if not available -* dur: duration in stream timescale -* frame: framing status - * interface: complete AU, interface object (no size info). Typically a GL texture - * frame_full: complete AU - * frame_start: beginning of frame - * frame_end: end of frame - * frame_cont: frame continuation (not beginning, not end) -* sap or rap: SAP type of the frame -* ilace: interlacing flag (0: progressive, 1: top field, 2: bottom field) -* corr: corrupted packet flag -* seek: seek flag -* bo: byte offset in source, N/A if not available -* roll: roll info -* crypt: crypt flag -* vers: carousel version number -* size: size of packet -* csize: total size of packets received so far -* crc: 32 bit CRC of packet -* lf or n: insert new line -* t: insert tab -* data: hex dump of packet (_big output!_) or as string if legal UTF-8 -* lp: leading picture flag -* depo: depends on other packet flag -* depf: is depended on other packet flag -* red: redundant coding flag -* start: packet composition time as HH:MM:SS.ms -* startc: packet composition time as HH:MM:SS,ms -* end: packet end time as HH:MM:SS.ms -* endc: packet end time as HH:MM:SS,ms -* ck: clock type used for PCR discontinuities -* pcr: MPEG-2 TS last PCR, n/a if not available -* pcrd: difference between last PCR and decoding time, n/a if no PCR available -* pcrc: difference between last PCR and composition time, n/a if no PCR available -* P4CC: 4CC of packet property -* PropName: Name of packet property -* pid.P4CC: 4CC of PID property -* pid.PropName: Name of PID property -* fn: Filter name + +- pn: packet (frame in framed mode) number +- dts: decoding time stamp in stream timescale, N/A if not available +- ddts: difference between current and previous packets decoding time stamp in stream timescale, N/A if not available +- cts: composition time stamp in stream timescale, N/A if not available +- dcts: difference between current and previous packets composition time stamp in stream timescale, N/A if not available +- ctso: difference between composition time stamp and decoding time stamp in stream timescale, N/A if not available +- dur: duration in stream timescale +- frame: framing status + + - interface: complete AU, interface object (no size info). Typically a GL texture + - frame_full: complete AU + - frame_start: beginning of frame + - frame_end: end of frame + - frame_cont: frame continuation (not beginning, not end) + +- sap or rap: SAP type of the frame +- ilace: interlacing flag (0: progressive, 1: top field, 2: bottom field) +- corr: corrupted packet flag +- seek: seek flag +- bo: byte offset in source, N/A if not available +- roll: roll info +- crypt: crypt flag +- vers: carousel version number +- size: size of packet +- csize: total size of packets received so far +- crc: 32 bit CRC of packet +- lf or n: insert new line +- t: insert tab +- data: hex dump of packet (_big output!_) or as string if legal UTF-8 +- lp: leading picture flag +- depo: depends on other packet flag +- depf: is depended on other packet flag +- red: redundant coding flag +- start: packet composition time as HH:MM:SS.ms +- startc: packet composition time as HH:MM:SS,ms +- end: packet end time as HH:MM:SS.ms +- endc: packet end time as HH:MM:SS,ms +- ck: clock type used for PCR discontinuities +- pcr: MPEG-2 TS last PCR, n/a if not available +- pcrd: difference between last PCR and decoding time, n/a if no PCR available +- pcrc: difference between last PCR and composition time, n/a if no PCR available +- P4CC: 4CC of packet property +- PropName: Name of packet property +- pid.P4CC: 4CC of PID property +- pid.PropName: Name of PID property +- fn: Filter name + Example ``` @@ -86,18 +90,21 @@ This will play the session at 2x speed, using 30s of maximum buffering, consumin # Options -__log__ (str, default: _stdout_, Enum: _any|stderr|stdout|GLOG|null): set probe log filename -* _any: target file path and name -* stderr: dump to stderr -* stdout: dump to stdout -* GLOG: use GPAC logs `app@info` -* null: silent mode +__log__ (str, default: _stdout_, Enum: _any|stderr|stdout|GLOG|TL|null): set probe log filename + +- _any: target file path and name +- stderr: dump to stderr +- stdout: dump to stdout +- GLOG: use GPAC logs `app@info` +- TL: use GPAC log tool `TL` at level `info` +- null: silent mode __mode__ (enum, default: _pck_): dump mode -* pck: dump full packet -* blk: dump packets before reconstruction -* frame: force reframer -* raw: dump source packets without demultiplexing + +- pck: dump full packet +- blk: dump packets before reconstruction +- frame: force reframer +- raw: dump source packets without demultiplexing __interleave__ (bool, default: _true_): dump packets as they are received on each PID. If false, logs are reported for each PID at end of session __deep__ (bool, default: _false_, updatable): dump packets along with PID state change, implied when [fmt](#fmt) is set @@ -113,10 +120,11 @@ This will play the session at 2x speed, using 30s of maximum buffering, consumin __start__ (dbl, default: _0.0_): set playback start offset. A negative value means percent of media duration with -1 equal to duration __dur__ (frac, default: _0/0_): set inspect duration __analyze__ (enum, default: _off_, updatable): analyze sample content (NALU, OBU), similar to `-bsdbg` option of reframer filters -* off: no analyzing -* on: simple analyzing -* bs: log bitstream syntax (all elements read from bitstream) -* full: log bitstream syntax and bit sizes signaled as `(N)` after field value, except 1-bit fields (omitted) + +- off: no analyzing +- on: simple analyzing +- bs: log bitstream syntax (all elements read from bitstream) +- full: log bitstream syntax and bit sizes signaled as `(N)` after field value, except 1-bit fields (omitted) __xml__ (bool, default: _false_, updatable): use xml formatting (implied if (-analyze]() is set) and disable [fmt](#fmt) __crc__ (bool, default: _false_, updatable): dump crc of samples of subsamples (NALU or OBU) when analyzing @@ -125,14 +133,16 @@ This will play the session at 2x speed, using 30s of maximum buffering, consumin __buffer__ (uint, default: _0_): set playback buffer in ms __mbuffer__ (uint, default: _0_): set max buffer occupancy in ms. If less than buffer, use buffer __rbuffer__ (uint, default: _0_, updatable): rebuffer trigger in ms. If 0 or more than buffer, disable rebuffering +__stats__ (bool, default: _false_): compute statistics for PIDs __test__ (enum, default: _no_, updatable): skip predefined set of properties, used for test mode -* no: no properties skipped -* noprop: all properties/info changes on PID are skipped, only packets are dumped -* network: URL/path dump, cache state, file size properties skipped (used for hashing network results) -* netx: same as network but skip track duration and templates (used for hashing progressive load of fmp4) -* encode: same as network plus skip decoder config (used for hashing encoding results) -* encx: same as encode and skip bitrates, media data size and co -* nocrc: disable packet CRC dump -* nobr: skip bitrate + +- no: no properties skipped +- noprop: all properties/info changes on PID are skipped, only packets are dumped +- network: URL/path dump, cache state, file size properties skipped (used for hashing network results) +- netx: same as network but skip track duration and templates (used for hashing progressive load of fmp4) +- encode: same as network plus skip decoder config (used for hashing encoding results) +- encx: same as encode and skip bitrates, media data size and co +- nocrc: disable packet CRC dump +- nobr: skip bitrate diff --git a/docs/Filters/jpgenc.md b/docs/Filters/jpgenc.md index fd87c2d6..9e9c3c6d 100644 --- a/docs/Filters/jpgenc.md +++ b/docs/Filters/jpgenc.md @@ -11,9 +11,10 @@ This filter encodes a single uncompressed video PID to JPEG using libjpeg. # Options __dctmode__ (enum, default: _fast_): type of DCT used -* slow: precise but slow integer DCT -* fast: less precise but faster integer DCT -* float: float DCT + +- slow: precise but slow integer DCT +- fast: less precise but faster integer DCT +- float: float DCT __quality__ (uint, default: _100_, minmax: 0-100, updatable): compression quality diff --git a/docs/Filters/m2tsmx.md b/docs/Filters/m2tsmx.md index d21080fb..1ac905f5 100644 --- a/docs/Filters/m2tsmx.md +++ b/docs/Filters/m2tsmx.md @@ -12,11 +12,13 @@ This filter multiplexes one or more input PIDs into a MPEG-2 Transport Stream mu The MPEG-2 TS multiplexer assigns M2TS PID for media streams using the PID of the PMT plus the stream index. For example, the default config creates the first program with a PMT PID 100, the first stream will have a PID of 101. Streams are grouped in programs based on input PID property ServiceID if present. If absent, stream will go in the program with service ID as indicated by [sid](#sid) option. + - [name](#name) option is overridden by input PID property `ServiceName`. - [provider](#provider) option is overridden by input PID property `ServiceProvider`. - [pcr_offset](#pcr_offset) option is overridden by input PID property `"tsmux:pcr_offset"` - [first_pts](#first_pts) option is overridden by input PID property `"tsmux:force_pts"` - [temi](#temi) option is overridden by input PID property `"tsmux:temi"` + # Time and External Media Information (TEMI) @@ -24,22 +26,28 @@ The [temi](#temi) option allows specifying a list of URLs or timeline IDs to ins One or more TEMI timeline can be specified per PID. The syntax is a comma-separated list of one or more TEMI description. Each TEMI description is formatted as ID_OR_URL or #OPT1[#OPT2]#ID_OR_URL. Options are: -* S`N`: indicate the target service with ID `N` -* T`N`: set timescale to use (default: PID timescale) -* D`N`: set delay in ms between two TEMI url descriptors (default 1000) -* O`N`: set offset (max 64 bits) to add to TEMI timecodes (default 0). If timescale is not specified, offset value is in ms, otherwise in timescale units. -* I`N`: set initial value (max 64 bits) of TEMI timecodes. If not set, initial value will match first packet CTS. If timescale is not specified, value is in PID timescale units, otherwise in specified timescale units. -* P`N`: indicate target PID in program. Possible values are - * `V`: only insert for video streams. - * `A`: only insert for audio streams. - * `T`: only insert for text streams. - * N: only insert for stream with index `N` (0-based) in the program. -* L`C`: set 64bit timecode signaling. Possible values for `C` are: - * `A`: automatic switch between 32 and 64 bit depending on timecode value (default if not specified). - * `Y`: use 64 bit signaling only. - * `N`: use 32 bit signaling only and wrap around timecode value. -* N: insert NTP timestamp in TEMI timeline descriptor -* ID_OR_URL: If number, indicate the TEMI ID to use for external timeline. Otherwise, give the URL to insert + +- S`N`: indicate the target service with ID `N` +- T`N`: set timescale to use (default: PID timescale) +- D`N`: set delay in ms between two TEMI url descriptors (default 1000) +- O`N`: set offset (max 64 bits) to add to TEMI timecodes (default 0). If timescale is not specified, offset value is in ms, otherwise in timescale units. +- I`N`: set initial value (max 64 bits) of TEMI timecodes. If not set, initial value will match first packet CTS. If timescale is not specified, value is in PID timescale units, otherwise in specified timescale units. +- P`N`: indicate target PID in program. Possible values are + + - `V`: only insert for video streams. + - `A`: only insert for audio streams. + - `T`: only insert for text streams. + - N: only insert for stream with index `N` (0-based) in the program. + +- L`C`: set 64bit timecode signaling. Possible values for `C` are: + + - `A`: automatic switch between 32 and 64 bit depending on timecode value (default if not specified). + - `Y`: use 64 bit signaling only. + - `N`: use 32 bit signaling only and wrap around timecode value. + +- N: insert NTP timestamp in TEMI timeline descriptor +- ID_OR_URL: If number, indicate the TEMI ID to use for external timeline. Otherwise, give the URL to insert + Example ``` @@ -72,9 +80,11 @@ __Warning: multipliers (k,m,g) are not supported in TEMI options.__ # Adaptive Streaming In DASH and HLS mode: + - the PCR is always initialized at 0, and [flush_rap](#flush_rap) is automatically set. - unless `nb_pack` is specified, 200 TS packets will be used as pack output in DASH mode. - `pes_pack=none` is forced since some demultiplexers have issues with non-aligned ADTS PES. + The filter watches the property `FileNumber` on incoming packets to create new files, or new segments in DASH mode. The filter will look for property `M2TSRA` set on the input stream. @@ -95,9 +105,10 @@ In LATM mux mode, the decoder configuration is inserted at the given [repeat_rat __first_pts__ (luint, default: _0_): force PTS value of first packet, in 90kHz __pcr_offset__ (luint, default: _-1_): offset all timestamps from PCR by V, in 90kHz (default value is computed based on input media) __mpeg4__ (enum, default: _none_): force usage of MPEG-4 signaling (IOD and SL Config) -* none: disables 4on2 -* full: sends AUs as SL packets over section for OD, section/pes for scene (cf bifs_pes) -* scene: sends only scene streams as 4on2 but uses regular PES without SL for audio and video + +- none: disables 4on2 +- full: sends AUs as SL packets over section for OD, section/pes for scene (cf bifs_pes) +- scene: sends only scene streams as 4on2 but uses regular PES without SL for audio and video __pmt_version__ (uint, default: _200_): set version number of the PMT __disc__ (bool, default: _false_): set the discontinuity marker for the first packet of each stream @@ -106,15 +117,17 @@ In LATM mux mode, the decoder configuration is inserted at the given [repeat_rat __max_pcr__ (uint, default: _100_): set max interval in ms between 2 PCR __nb_pack__ (uint, default: _4_): pack N TS packets in output packets __pes_pack__ (enum, default: _audio_): set AU to PES packing mode -* audio: will pack only multiple audio AUs in a PES -* none: make exactly one AU per PES -* all: will pack multiple AUs per PES for all streams + +- audio: will pack only multiple audio AUs in a PES +- none: make exactly one AU per PES +- all: will pack multiple AUs per PES for all streams __realtime__ (bool, default: _false_): use real-time output __bifs_pes__ (enum, default: _off_): select BIFS streams packetization (PES vs sections) -* on: uses BIFS PES -* off: uses BIFS sections -* copy: uses BIFS PES but removes timestamps in BIFS SL and only carries PES timestamps + +- on: uses BIFS PES +- off: uses BIFS sections +- copy: uses BIFS PES but removes timestamps in BIFS SL and only carries PES timestamps __flush_rap__ (bool, default: _false_): force flushing mux program when RAP is found on video, and injects PAT and PMT before the next video PES begin __pcr_only__ (bool, default: _false_): enable PCR-only TS packets diff --git a/docs/Filters/mp4dmx.md b/docs/Filters/mp4dmx.md index 94e5da06..3ef146c2 100644 --- a/docs/Filters/mp4dmx.md +++ b/docs/Filters/mp4dmx.md @@ -11,24 +11,32 @@ Input ISOBMFF/QT can be regular or fragmented, and available as files or as raw # Track Selection The filter can use fragment identifiers of source to select a single track for playback. The allowed fragments are: - * #audio: only use the first audio track - * #video: only use the first video track - * #auxv: only use the first auxiliary video track - * #pict: only use the first picture track - * #text: only use the first text track - * #trackID=VAL: only use the track with given ID - * #itemID=VAL: only use the item with given ID - * #ID=VAL: only use the track/item with given ID - * #VAL: only use the track/item with given ID + + - #audio: only use the first audio track + - #video: only use the first video track + - #auxv: only use the first auxiliary video track + - #pict: only use the first picture track + - #text: only use the first text track + - #trackID=VAL: only use the track with given ID + - #itemID=VAL: only use the item with given ID + - #ID=VAL: only use the track/item with given ID + - #VAL: only use the track/item with given ID + # Scalable Tracks When scalable tracks are present in a file, the reader can operate in 3 modes using [smode](#smode) option: -* smode=single: resolves all extractors to extract a single bitstream from a scalable set. The highest level is used + +- smode=single: resolves all extractors to extract a single bitstream from a scalable set. The highest level is used + In this mode, there is no enhancement decoder config, only a base one resulting from the merge of the layers configurations -* smode=split: all extractors are removed and every track of the scalable set is declared. In this mode, each enhancement track has no base decoder config + +- smode=split: all extractors are removed and every track of the scalable set is declared. In this mode, each enhancement track has no base decoder config + and an enhancement decoder config. -* smode=splitx: extractors are kept in the bitstream, and every track of the scalable set is declared. In this mode, each enhancement track has a base decoder config + +- smode=splitx: extractors are kept in the bitstream, and every track of the scalable set is declared. In this mode, each enhancement track has a base decoder config + (copied from base) and an enhancement decoder config. This is mostly used for DASHing content. __Warning: smode=splitx will result in extractor NAL units still present in the output bitstream, which shall only be true if the output is ISOBMFF based__ @@ -39,26 +47,29 @@ __Warning: smode=splitx will result in extractor NAL units still present in the __src__ (cstr): local file name of source content (only used when explicitly loading the filter) __allt__ (bool, default: _false_): load all tracks even if unknown media type __edits__ (enum, default: _auto_): do not use edit lists -* auto: track delay and no edit list when possible -* no: ignore edit list -* strict: use edit list even if only signaling a delay + +- auto: track delay and no edit list when possible +- no: ignore edit list +- strict: use edit list even if only signaling a delay __itt__ (bool, default: _false_): convert all items of root meta into a single PID __itemid__ (bool, default: _true_): keep item IDs in PID properties __smode__ (enum, default: _split_): load mode for scalable/tile tracks -* split: each track is declared, extractors are removed -* splitx: each track is declared, extractors are kept -* single: a single track is declared (highest level for scalable, tile base for tiling) + +- split: each track is declared, extractors are removed +- splitx: each track is declared, extractors are kept +- single: a single track is declared (highest level for scalable, tile base for tiling) __alltk__ (bool, default: _false_): declare disabled tracks __frame_size__ (uint, default: _1024_): frame size for raw audio samples (dispatches frame_size samples per packet) __expart__ (bool, default: _false_): expose cover art as a dedicated video PID __sigfrag__ (bool, default: _false_): signal fragment and segment boundaries of source on output packets, fails if source is not fragmented __tkid__ (str): declare only track based on given param -* integer value: declares track with the given ID -* audio: declares first audio track -* video: declares first video track -* 4CC: declares first track with matching 4CC for handler type + +- integer value: declares track with the given ID +- audio: declares first audio track +- video: declares first video track +- 4CC: declares first track with matching 4CC for handler type __stsd__ (uint, default: _0_): only extract sample mapped to the given sample description index (0 means extract all) __nocrypt__ (bool): signal encrypted tracks as non encrypted (mostly used for export) @@ -67,19 +78,24 @@ __Warning: smode=splitx will result in extractor NAL units still present in the __mstore_samples__ (uint, default: _50_): minimum number of samples to be present before purging sample tables when reading from memory stream (pipe etc...), 0 means purge as soon as possible __strtxt__ (bool, default: _false_): load text tracks (apple/tx3g) as MPEG-4 streaming text tracks __xps_check__ (enum, default: _auto_): parameter sets extraction mode from AVC/HEVC/VVC samples -* keep: do not inspect sample (assumes input file is compliant when generating DASH/HLS/CMAF) -* rem: removes all inband xPS and notify configuration changes accordingly -* auto: resolves to `keep` for `smode=splitx` (dasher mode), `rem` otherwise + +- keep: do not inspect sample (assumes input file is compliant when generating DASH/HLS/CMAF) +- rem: removes all inband xPS and notify configuration changes accordingly +- auto: resolves to `keep` for `smode=splitx` (dasher mode), `rem` otherwise __nodata__ (enum, default: _no_): control sample data loading -* no: regular load -* yes: skip data loading -* fake: allocate sample but no data copy + +- no: regular load +- yes: skip data loading +- fake: allocate sample but no data copy __lightp__ (bool, default: _false_): load minimal set of properties __initseg__ (str): local init segment name when input is a single ISOBMFF segment __ctso__ (sint): value to add to CTS offset for tracks using negative ctts + - set to `-1` to use the `cslg` box info or the minimum cts offset present in the track - set to `-2` to use the minimum cts offset present in the track (`cslg` ignored) +__norw__ (bool, default: _false_): skip reformating of samples - should only be used when rewriting fragments +__keepc__ (bool, default: _false_): keep corrupted samples - should only be used in multicast modes diff --git a/docs/Filters/mp4mx.md b/docs/Filters/mp4mx.md index 3882a40f..6c4be772 100644 --- a/docs/Filters/mp4mx.md +++ b/docs/Filters/mp4mx.md @@ -29,9 +29,11 @@ gpac -i source.jpg:#ItemID=1 -o file.mp4 The [store](#store) option allows controlling if the file is fragmented or not, and when not fragmented, how interleaving is done. For cases where disk requirements are tight and fragmentation cannot be used, it is recommended to use either `flat` or `fstart` modes. The [vodcache](#vodcache) option allows controlling how DASH onDemand segments are generated: + - If set to `on`, file data is stored to a temporary file on disk and flushed upon completion, no padding is present. - If set to `insert`, SIDX/SSIX will be injected upon completion of the file by shifting bytes in file. In this case, no padding is required but this might not be compatible with all output sinks and will take longer to write the file. - If set to `replace`, SIDX/SSIX size will be estimated based on duration and DASH segment length, and padding will be used in the file _before_ the final SIDX. If input PIDs have the properties `DSegs` set, this will used be as the number of segments. + The `on` and `insert` modes will produce exactly the same file, while the mode `replace` may inject a `free` box before the sidx. @@ -60,19 +62,23 @@ When tagging is enabled, the filter will watch the property `CoverArt` and all c The built-in tag names are indicated by `MP4Box -h tags`. QT tags can be specified using `qtt_NAME` property names, and will be added using formatting specified in `MP4Box -h tags`. Other tag class may be specified using `tag_NAME` property names, and will be added if [tags](#tags) is set to `all` using: + - `NAME` as a box 4CC if `NAME` is four characters long - `NAME` as a box 4CC if `NAME` is 3 characters long, and will be prefixed by 0xA9 - the CRC32 of the `NAME` as a box 4CC if `NAME` is not four characters long + # User data The filter will look for the following PID properties to create user data entries: -* `udtab`: set the track user-data box to the property value which _must_ be a serialized box array blob -* `mudtab`: set the movie user-data box to the property value which _must_ be a serialized box array blob -* `udta_U4CC`: set track user-data box entry of type `U4CC` to property value -* `mudta_U4CC`: set movie user-data box entry of type `U4CC` to property value -* `tkgp_T4CC`: set/remove membership to track group with type `T4CC` and ID given by property value. A negative value N removes from track group with ID -N + +- `udtab`: set the track user-data box to the property value which _must_ be a serialized box array blob +- `mudtab`: set the movie user-data box to the property value which _must_ be a serialized box array blob +- `udta_U4CC`: set track user-data box entry of type `U4CC` to property value +- `mudta_U4CC`: set movie user-data box entry of type `U4CC` to property value +- `tkgp_T4CC`: set/remove membership to track group with type `T4CC` and ID given by property value. A negative value N removes from track group with ID -N + Example ``` @@ -84,14 +90,18 @@ gpac -i src.mp4:#mudtab=data@box.bin -o tag.mp4 # Custom sample group descriptions and sample auxiliary info The filter watches the following custom data properties on incoming packets: -* `grp_A4CC`: maps packet to sample group description of type `A4CC` and entry set to property payload -* `grp_A4CC_param`: same as above and sets sample to group `grouping_type_parameter` to `param` -* `sai_A4CC`: adds property payload as sample auxiliary information of type `A4CC` -* `sai_A4CC_param`: same as above and sets `aux_info_type_parameter`to `param` + +- `grp_A4CC`: maps packet to sample group description of type `A4CC` and entry set to property payload +- `grp_A4CC_param`: same as above and sets sample to group `grouping_type_parameter` to `param` +- `sai_A4CC`: adds property payload as sample auxiliary information of type `A4CC` +- `sai_A4CC_param`: same as above and sets `aux_info_type_parameter`to `param` + The property `grp_EMSG` consists in one or more `EventMessageBox` as defined in MPEG-DASH. + - in fragmented mode, presence of this property in a packet will start a new fragment, with the boxes written before the `moof` - in regular mode, an internal sample group of type `EMSG` is currently used for `emsg` box storage + # Notes @@ -107,9 +117,11 @@ This will wrap the unknown stream using `VIUK` code point in `stsd` and wrap any If [pad_sparse](#pad_sparse) is set, the filter watches the property `Sparse` on incoming PID to decide whether empty packets should be injected to keep packet duration info. Such packets are only injected when a whole in the timeline is detected. + - if `Sparse` is absent, empty packet is inserted for unknown text and metadata streams - if `Sparse` is true, empty packet is inserted for all stream types - if `Sparse` is false, empty packet is never injected + The default media type used for a PID can be overriden using property `StreamSubtype`. Example @@ -130,44 +142,49 @@ This will force the text stream to be used as a QT chapter track. __m4sys__ (bool, default: _false_): force MPEG-4 Systems signaling of tracks __dref__ (bool, default: _false_): only reference data from source file - not compatible with all media sources __ctmode__ (enum, default: _auto_): set composition offset mode for video tracks -* auto: if fragmenting an ISOBMFF source, use source settings otherwise resolve to `edit` -* edit: uses edit lists to shift first frame to presentation time 0 -* noedit: ignore edit lists and does not shift timeline -* negctts: uses ctts v1 with possibly negative offsets and no edit lists + +- auto: if fragmenting an ISOBMFF source, use source settings otherwise resolve to `edit` +- edit: uses edit lists to shift first frame to presentation time 0 +- noedit: ignore edit lists and does not shift timeline +- negctts: uses ctts v1 with possibly negative offsets and no edit lists __dur__ (frac, default: _0_): only import the specified duration. If negative, specify the number of coded frames to import __pack3gp__ (uint, default: _1_): pack a given number of 3GPP audio frames in one sample __importer__ (bool, default: _false_): compatibility with old importer, displays import progress __pack_nal__ (bool, default: _false_): repack NALU size length to minimum possible size for NALU-based video (AVC/HEVC/...) __xps_inband__ (enum, default: _no_): use inband (in sample data) parameter set for NALU-based video (AVC/HEVC/...) -* no: parameter sets are not inband, several sample descriptions might be created -* pps: picture parameter sets are inband, all other parameter sets are in sample description -* all: parameter sets are inband, no parameter sets in sample description -* both: parameter sets are inband, signaled as inband, and also first set is kept in sample description -* mix: creates non-standard files using single sample entry with first PSs found, and moves other PS inband -* auto: keep source config, or defaults to no if source is not ISOBMFF + +- no: parameter sets are not inband, several sample descriptions might be created +- pps: picture parameter sets are inband, all other parameter sets are in sample description +- all: parameter sets are inband, no parameter sets in sample description +- both: parameter sets are inband, signaled as inband, and also first set is kept in sample description +- mix: creates non-standard files using single sample entry with first PSs found, and moves other PS inband +- auto: keep source config, or defaults to no if source is not ISOBMFF __store__ (enum, default: _inter_): file storage mode -* inter: perform precise interleave of the file using [cdur](#cdur) (requires temporary storage of all media) -* flat: write samples as they arrive and `moov` at end (fastest mode) -* fstart: write samples as they arrive and `moov` before `mdat` -* tight: uses per-sample interleaving of all tracks (requires temporary storage of all media) -* frag: fragments the file using cdur duration -* sfrag: fragments the file using cdur duration but adjusting to start with SAP1/3 + +- inter: perform precise interleave of the file using [cdur](#cdur) (requires temporary storage of all media) +- flat: write samples as they arrive and `moov` at end (fastest mode) +- fstart: write samples as they arrive and `moov` before `mdat` +- tight: uses per-sample interleaving of all tracks (requires temporary storage of all media) +- frag: fragments the file using cdur duration +- sfrag: fragments the file using cdur duration but adjusting to start with SAP1/3 __cdur__ (frac, default: _-1/1_): chunk duration for flat and interleaving modes or fragment duration for fragmentation modes -* 0: no specific interleaving but moov first -* negative: defaults to 1.0 unless overridden by storage profile + +- 0: no specific interleaving but moov first +- negative: defaults to 1.0 unless overridden by storage profile __moovts__ (sint, default: _600_): timescale to use for movie. A negative value picks the media timescale of the first track added __moof_first__ (bool, default: _true_): generate fragments starting with moof then mdat __abs_offset__ (bool, default: _false_): use absolute file offset in fragments rather than offsets from moof __fsap__ (bool, default: _true_): split truns in video fragments at SAPs to reduce file size __subs_sidx__ (sint, default: _-1_): number of subsegments per sidx -* 0: single sidx -* >0: hierarchical or daisy-chained sidx -* <0: disables sidx -* -2: removes sidx if present in source PID + +- 0: single sidx +- >0: hierarchical or daisy-chained sidx +- <0: disables sidx +- -2: removes sidx if present in source PID __m4cc__ (str): 4 character code of empty box to append at the end of a segment (DASH mode) or of a fragment (non-DASH mode) __chain_sidx__ (bool, default: _false_): use daisy-chaining of SIDX @@ -178,34 +195,40 @@ This will force the text stream to be used as a QT chapter track. __nofragdef__ (bool, default: _false_): disable default flags in fragments __straf__ (bool, default: _false_): use a single traf per moof (smooth streaming and co) __strun__ (bool, default: _false_): use a single trun per traf (smooth streaming and co) +__prft__ (bool, default: _true_): set `prft` box at segment start, disabled if not fragmented mode __psshs__ (enum, default: _moov_): set `pssh` boxes store mode -* moof: in first moof of each segments -* moov: in movie box -* both: in movie box and in first moof of each segment -* none: pssh is discarded + +- moof: in first moof of each segments +- moov: in movie box +- both: in movie box and in first moof of each segment +- none: pssh is discarded __sgpd_traf__ (bool, default: _false_): store sample group descriptions in traf (duplicated for each traf). If not used, sample group descriptions are stored in the movie box __vodcache__ (enum, default: _replace_): enable temp storage for VoD dash modes -* on: use temp storage of complete file for sidx and ssix injection -* insert: insert sidx and ssix by shifting bytes in output file -* replace: precompute pace requirements for sidx and ssix and rewrite file range at end + +- on: use temp storage of complete file for sidx and ssix injection +- insert: insert sidx and ssix by shifting bytes in output file +- replace: precompute pace requirements for sidx and ssix and rewrite file range at end __noinit__ (bool, default: _false_): do not produce initial `moov, used for DASH bitstream switching mode` __tktpl__ (enum, default: _yes_): use track box from input if any as a template to create new track -* no: disables template -* yes: clones the track (except edits and decoder config) -* udta: only loads udta + +- no: disables template +- yes: clones the track (except edits and decoder config) +- udta: only loads udta __mudta__ (enum, default: _yes_): use `udta` and other `moov` extension boxes from input if any -* no: disables import -* yes: clones all extension boxes -* udta: only loads udta + +- no: disables import +- yes: clones all extension boxes +- udta: only loads udta __mvex__ (bool, default: _false_): set `mvex` boxes after `trak` boxes __sdtp_traf__ (enum, default: _no_): use `sdtp` box in `traf` box rather than using flags in trun sample entries -* no: do not use `sdtp` -* sdtp: use `sdtp` box to indicate sample dependencies and do not write info in `trun` sample flags -* both: use `sdtp` box to indicate sample dependencies and also write info in `trun` sample flags + +- no: do not use `sdtp` +- sdtp: use `sdtp` box to indicate sample dependencies and do not write info in `trun` sample flags +- both: use `sdtp` box to indicate sample dependencies and also write info in `trun` sample flags __trackid__ (uint, default: _0_): track ID of created track for single track. Default 0 uses next available trackID __fragdur__ (bool, default: _false_): fragment based on fragment duration rather than CTS. Mostly used for `MP4Box -frag` option @@ -213,11 +236,12 @@ This will force the text stream to be used as a QT chapter track. __styp__ (str): set segment `styp` major brand (and optionally version) to the given 4CC[.version] __mediats__ (sint, default: _0_): set media timescale. A value of 0 means inherit from PID, a value of -1 means derive from samplerate or frame rate __ase__ (enum, default: _v0_): set audio sample entry mode for more than stereo layouts -* v0: use v0 signaling but channel count from stream, recommended for backward compatibility -* v0s: use v0 signaling and force channel count to 2 (stereo) if more than 2 channels -* v1: use v1 signaling, ISOBMFF style (will mux raw PCM as ISOBMFF style) -* v1qt: use v1 signaling, QTFF style -* v2qt: use v2 signaling, QTFF style (lpcm entry type) + +- v0: use v0 signaling but channel count from stream, recommended for backward compatibility +- v0s: use v0 signaling and force channel count to 2 (stereo) if more than 2 channels +- v1: use v1 signaling, ISOBMFF style (will mux raw PCM as ISOBMFF style) +- v1qt: use v1 signaling, QTFF style +- v2qt: use v2 signaling, QTFF style (lpcm entry type) __ssix__ (bool, default: _false_): create `ssix` box when `sidx` box is present, level 1 mapping I-frames byte ranges, level 0xFF mapping the rest __ccst__ (bool, default: _false_): insert coding constraint box for video tracks @@ -227,12 +251,13 @@ This will force the text stream to be used as a QT chapter track. __saio32__ (bool, default: _false_): use 32 bit offset for side data location instead of 64 bit offset __tfdt64__ (bool, default: _false_): use 64 bit tfdt and sidx even for 32 bits timestamps __compress__ (enum, default: _no_): set top-level box compression mode -* no: disable box compression -* moov: compress only moov box (uses cmov for QT) -* moof: compress only moof boxes -* sidx: compress moof and sidx boxes -* ssix: compress moof, sidx and ssix boxes -* all: compress moov, moof, sidx and ssix boxes + +- no: disable box compression +- moov: compress only moov box (uses cmov for QT) +- moof: compress only moof boxes +- sidx: compress moof and sidx boxes +- ssix: compress moof, sidx and ssix boxes +- all: compress moov, moof, sidx and ssix boxes __fcomp__ (bool, default: _false_): force using compress box even when compressed size is larger than uncompressed __otyp__ (bool, default: _false_): inject original file type when using compressed boxes @@ -245,34 +270,38 @@ This will force the text stream to be used as a QT chapter track. __forcesync__ (bool, default: _false_): force all SAP types to be considered sync samples (might produce non-compliant files) __refrag__ (bool, default: _false_): use track fragment defaults from initial file if any rather than computing them from PID properties (used when processing standalone segments/fragments) __itags__ (enum, default: _strict_): tag injection mode -* none: do not inject tags -* strict: only inject recognized itunes tags -* all: inject all possible tags + +- none: do not inject tags +- strict: only inject recognized itunes tags +- all: inject all possible tags __keep_utc__ (bool, default: _false_): force all new files and tracks to keep the source UTC creation and modification times __pps_inband__ (bool, default: _no_): when [xps_inband](#xps_inband) is set, inject PPS in each non SAP 1/2/3 sample __moovpad__ (uint, default: _0_): insert `free` box of given size after `moov` for future in-place editing __cmaf__ (enum, default: _no_): use CMAF guidelines (turns on `mvex`, `truns_first`, `strun`, `straf`, `tfdt_traf`, `chain_sidx` and restricts `subs_sidx` to -1 or 0) -* no: CMAF not enforced -* cmfc: use CMAF `cmfc` guidelines -* cmf2: use CMAF `cmf2` guidelines (turns on `nofragdef`) + +- no: CMAF not enforced +- cmfc: use CMAF `cmfc` guidelines +- cmf2: use CMAF `cmf2` guidelines (turns on `nofragdef`) __pad_sparse__ (bool, default: _true_): inject sample with no data (size 0) to keep durations in unknown sparse text and metadata tracks __force_dv__ (bool, default: _false_): force DV sample entry types even when AVC/HEVC compatibility is signaled __dvsingle__ (bool, default: _false_): ignore DolbyVision profile 8 in xps inband mode if profile 5 is already set __tsalign__ (bool, default: _true_): enable timeline realignment to 0 for first sample - if false, this will keep original timing with empty edit (possibly long) at begin) __chapm__ (enum, default: _both_): chapter storage mode -* off: disable chapters -* tk: use chapter track (QT-style) -* udta: use user-data box chapters -* both: use both chapter tracks and udta + +- off: disable chapters +- tk: use chapter track (QT-style) +- udta: use user-data box chapters +- both: use both chapter tracks and udta __patch_dts__ (bool, default: _false_): patch previous samples duration when dts do not increase monotonically __uncv__ (enum, default: _prof_): use uncv (ISO 23001-17) for raw video -* off: disabled (always the case when muxing to QT) -* gen: enabled, do not write profile -* prof: enabled and write profile if known -* tiny: enabled and write reduced version if profile known and compatible + +- off: disabled (always the case when muxing to QT) +- gen: enabled, do not write profile +- prof: enabled and write profile if known +- tiny: enabled and write reduced version if profile known and compatible __trunv1__ (bool, default: _false_): force using version 1 of trun regardless of media type or CMAF brand __rsot__ (bool, default: _false_): inject redundant sample timing information when present diff --git a/docs/Filters/nhmlw.md b/docs/Filters/nhmlw.md index ca157206..a96ad15d 100644 --- a/docs/Filters/nhmlw.md +++ b/docs/Filters/nhmlw.md @@ -17,8 +17,9 @@ NHML documentation is available at https://wiki.gpac.io/xmlformats/NHML-Format __nhmlonly__ (bool, default: _false_): only dump NHML info, not media __pckp__ (bool, default: _false_): full NHML dump __chksum__ (enum, default: _none_): insert frame checksum -* none: no checksum -* crc: CRC32 checksum -* sha1: SHA1 checksum + +- none: no checksum +- crc: CRC32 checksum +- sha1: SHA1 checksum diff --git a/docs/Filters/nvdec.md b/docs/Filters/nvdec.md index 4634a2f2..156d9eb1 100644 --- a/docs/Filters/nvdec.md +++ b/docs/Filters/nvdec.md @@ -8,26 +8,29 @@ This filter may be automatically loaded during graph resolution. This filter decodes MPEG-2, MPEG-4 Part 2, AVC|H264 and HEVC streams through NVidia decoder. It allows GPU frame dispatch or direct frame copy. If the SDK is not available, the configuration key `nvdec@disabled` will be written in configuration file to avoid future load attempts. -The absolute path to cuda lib can be set using the `cuda_lib` option in `core` or `temp` section of the config file, e.g. `-cfg=temp:cuda_lib=PATH_TO_CUDA`. -The absolute path to cuvid lib can be set using the `cuvid_lib` option in `core` or `temp` section of the config file, e.g. `-cfg=temp:cuvid_lib=PATH_TO_CUDA`. - +The absolute path to cuda lib can be set using the `cuda_lib` option in `core` or `temp` section of the config file, e.g. `-cfg=temp:cuda_lib=PATH_TO_CUDA` +The absolute path to cuvid lib can be set using the `cuvid_lib` option in `core` or `temp` section of the config file, e.g. `-cfg=temp:cuvid_lib=PATH_TO_CUDA` + # Options __num_surfaces__ (uint, default: _20_): number of hardware surfaces to allocate __unload__ (enum, default: _no_): decoder unload mode -* no: keep inactive decoder alive -* destroy: destroy inactive decoder -* reuse: detach decoder from inactive PIDs and reattach to active ones + +- no: keep inactive decoder alive +- destroy: destroy inactive decoder +- reuse: detach decoder from inactive PIDs and reattach to active ones __vmode__ (enum, default: _cuvid_): video decoder backend -* cuvid: use dedicated video engines directly -* cuda: use a CUDA-based decoder if faster than dedicated engines -* dxva: go through DXVA internally if possible (requires D3D9) + +- cuvid: use dedicated video engines directly +- cuda: use a CUDA-based decoder if faster than dedicated engines +- dxva: go through DXVA internally if possible (requires D3D9) __fmode__ (enum, default: _gl_): frame output mode -* copy: each frame is copied and dispatched -* single: frame data is only retrieved when used, single memory space for all frames (not safe if multiple consumers) -* gl: frame data is mapped to an OpenGL texture + +- copy: each frame is copied and dispatched +- single: frame data is only retrieved when used, single memory space for all frames (not safe if multiple consumers) +- gl: frame data is mapped to an OpenGL texture diff --git a/docs/Filters/ohevcdec.md b/docs/Filters/ohevcdec.md index 61a4d4f3..e941a773 100644 --- a/docs/Filters/ohevcdec.md +++ b/docs/Filters/ohevcdec.md @@ -11,9 +11,10 @@ This filter decodes HEVC and LHVC (HEVC scalable extensions) from one or more PI # Options __threading__ (enum, default: _frame_): set threading mode -* frameslice: parallel decoding of both frames and slices -* frame: parallel decoding of frames -* slice: parallel decoding of slices + +- frameslice: parallel decoding of both frames and slices +- frame: parallel decoding of frames +- slice: parallel decoding of slices __nb_threads__ (uint, default: _0_): set number of threads (if 0, uses number of cores minus one) __no_copy__ (bool, default: _false_): directly dispatch internal decoded frame without copy diff --git a/docs/Filters/pin.md b/docs/Filters/pin.md index ad1f29b4..b108c9d8 100644 --- a/docs/Filters/pin.md +++ b/docs/Filters/pin.md @@ -35,13 +35,17 @@ The filter can create the pipe if not found using [mkp](#mkp). On windows hosts, On non windows hosts, the created pipe will delete the pipe file upon filter destruction. Input pipes can be setup to run forever using [ka](#ka). In this case: + - any potential pipe close on the writing side will be ignored - pipeline flushing will be triggered upon pipe close if [sigflush](#sigflush) is set - final end of stream will be triggered upon session close. + This can be useful to pipe raw streams from different process into gpac: -* Receiver side: `gpac -i pipe://mypipe:ext=.264:mkp:ka` -* Sender side: `cat raw1.264 > mypipe && gpac -i raw2.264 -o pipe://mypipe:ext=.264` + +- Receiver side: `gpac -i pipe://mypipe:ext=.264:mkp:ka` +- Sender side: `cat raw1.264 > mypipe && gpac -i raw2.264 -o pipe://mypipe:ext=.264` + The pipeline flush is signaled as EOS while keeping the stream active. This is typically needed for mux filters waiting for EOS to flush their data. diff --git a/docs/Filters/probe.md b/docs/Filters/probe.md index 08eeac3b..91e28a96 100644 --- a/docs/Filters/probe.md +++ b/docs/Filters/probe.md @@ -14,10 +14,11 @@ It is up to the app developer to query input PIDs of the prober and take appropr # Options __log__ (str, default: _stdout_, Enum: _any|stderr|stdout|GLOG|null): set probe log filename to print number of streams -* _any: target file path and name -* stderr: dump to stderr -* stdout: dump to stdout -* GLOG: use GPAC logs `app@info` -* null: silent mode + +- _any: target file path and name +- stderr: dump to stderr +- stdout: dump to stdout +- GLOG: use GPAC logs `app@info` +- null: silent mode diff --git a/docs/Filters/reframer.md b/docs/Filters/reframer.md index d0a78723..82cc0a8d 100644 --- a/docs/Filters/reframer.md +++ b/docs/Filters/reframer.md @@ -7,11 +7,13 @@ This filter is not checked during graph resolution and needs explicit loading. Filters of this class can connect to each-other. This filter provides various tools on inputs: + - ensure reframing (1 packet = 1 Access Unit) - optionally force decoding - real-time regulation - packet filtering based on SAP types or frame numbers - time-range extraction and splitting + This filter forces input PIDs to be properly framed (1 packet = 1 Access Unit). It is typically needed to force remultiplexing in file to file operations when source and destination files use the same format. @@ -51,12 +53,14 @@ gpac -i m.mp4 reframer:rt=on -o live.mpd:dynamic The filter can perform time range extraction of the source using [xs](#xs) and [xe](#xe) options. The formats allowed for times specifiers are: -* 'T'H:M:S, 'T'M:S: specify time in hours, minutes, seconds -* 'T'H:M:S.MS, 'T'M:S.MS, 'T'S.MS: specify time in hours, minutes, seconds and milliseconds -* INT, FLOAT, NUM/DEN: specify time in seconds (number or fraction) -* 'D'INT, 'D'FLOAT, 'D'NUM/DEN: specify end time as offset to start time in seconds (number or fraction) - only valid for [xe](#xe) -* 'F'NUM: specify time as frame number, 1 being first -* XML DateTime: specify absolute UTC time + +- 'T'H:M:S, 'T'M:S: specify time in hours, minutes, seconds +- 'T'H:M:S.MS, 'T'M:S.MS, 'T'S.MS: specify time in hours, minutes, seconds and milliseconds +- INT, FLOAT, NUM/DEN: specify time in seconds (number or fraction) +- 'D'INT, 'D'FLOAT, 'D'NUM/DEN: specify end time as offset to start time in seconds (number or fraction) - only valid for [xe](#xe) +- 'F'NUM: specify time as frame number, 1 being first +- XML DateTime: specify absolute UTC time + In this mode, the timestamps are rewritten to form a continuous timeline, unless [xots](#xots) is set. When multiple ranges are given, the filter will try to seek if needed and supported by source. @@ -68,8 +72,10 @@ gpac -i m.mp4 reframer:xs=T00:00:10,T00:01:10,T00:02:00:xe=T00:00:20,T00:01:20 [ This will extract the time ranges [10s,20s], [1m10s,1m20s] and all media starting from 2m If no end range is found for a given start range: + - if a following start range is set, the end range is set to this next start - otherwise, the end range is open + Example ``` @@ -84,8 +90,10 @@ This will extract the time ranges [0s,10s], [10s,25s] and all media starting fro It is possible to signal range boundaries in output packets using [splitrange](#splitrange). This will expose on the first packet of each range in each PID the following properties: -* `FileNumber`: starting at 1 for the first range, to be used as replacement for $num$ in templates -* `FileSuffix`: corresponding to `StartRange_EndRange` or `StartRange` for open ranges, to be used as replacement for $FS$ in templates + +- `FileNumber`: starting at 1 for the first range, to be used as replacement for $num$ in templates +- `FileSuffix`: corresponding to `StartRange_EndRange` or `StartRange` for open ranges, to be used as replacement for $FS$ in templates + Example ``` @@ -103,17 +111,21 @@ Example gpac -i m.mp4 reframer:xs=0,30::props=#Period=P1,#Period=P2:#foo=bar [dst] ``` This will assign to output PIDs -* during the range [0,30]: property `Period` to `P1` -* during the range [30, end]: properties `Period` to `P2` and property `foo` to `bar` + +- during the range [0,30]: property `Period` to `P1` +- during the range [30, end]: properties `Period` to `P2` and property `foo` to `bar` + For uncompressed audio PIDs, input frame will be split to closest audio sample number. When [xround](#xround) is set to `seek`, the following applies: + - a single range shall be specified - the first I-frame preceding or matching the range start is used as split point - all packets before range start are marked as seek points - packets overlapping range start are forwarded with a `SkipBegin` property set to the amount of media to skip - packets overlapping range end are forwarded with an adjusted duration to match the range end + This mode is typically used to extract a range in a frame/sample accurate way, rather than a GOP-aligned way. When [xround](#xround) is not set to `seek`, compressed audio streams will still use seek mode. @@ -123,8 +135,10 @@ This can be avoided using [no_audio_seek](#no_audio_seek), but this will introdu # UTC-based range extraction The filter can perform range extraction based on UTC time rather than media time. In this mode, the end time must be: -* a UTC date: range extraction will stop after this date -* a time in second: range extraction will stop after the specified duration + +- a UTC date: range extraction will stop after this date +- a time in second: range extraction will stop after the specified duration + The UTC reference is specified using [utc_ref](#utc_ref). If UTC signal from media source is used, the filter will probe for [utc_probe](#utc_probe) before considering the source has no UTC signal. @@ -135,10 +149,12 @@ The properties `SenderNTP` and, if absent, `UTC` of source packets are checked f The filter can perform splitting of the source using [xs](#xs) option. The additional formats allowed for [xs](#xs) option are: -* `SAP`: split source at each SAP/RAP -* `D`VAL: split source by chunks of `VAL` seconds -* `D`NUM/DEN: split source by chunks of `NUM/DEN` seconds -* `S`VAL: split source by chunks of estimated size `VAL` bytes (can use property multipliers, e.g. `m`) + +- `SAP`: split source at each SAP/RAP +- `D`VAL: split source by chunks of `VAL` seconds +- `D`NUM/DEN: split source by chunks of `NUM/DEN` seconds +- `S`VAL: split source by chunks of estimated size `VAL` bytes (can use property multipliers, e.g. `m`) + _Note: In these modes, [splitrange](#splitrange) and [xadjust](#xadjust) are implicitly set._ @@ -147,28 +163,31 @@ _Note: In these modes, [splitrange](#splitrange) and [xadjust](#xadjust) are imp __exporter__ (bool, default: _false_): compatibility with old exporter, displays export results __rt__ (enum, default: _off_, updatable): real-time regulation mode of input -* off: disables real-time regulation -* on: enables real-time regulation, one clock per PID -* sync: enables real-time regulation one clock for all PIDs + +- off: disables real-time regulation +- on: enables real-time regulation, one clock per PID +- sync: enables real-time regulation one clock for all PIDs __saps__ (uintl, Enum: 0|1|2|3|4, updatable): list of SAP types (0,1,2,3,4) to forward, other packets are dropped (forwarding only sap 0 will break the decoding) __refs__ (bool, default: _false_, updatable): forward only frames used as reference frames, if indicated in the input stream __speed__ (dbl, default: _0.0_, updatable): speed for real-time regulation mode, a value of 0 uses speed from play commands __raw__ (enum, default: _no_): force input AV streams to be in raw format -* no: do not force decoding of inputs -* av: force decoding of audio and video inputs -* a: force decoding of audio inputs -* v: force decoding of video inputs + +- no: do not force decoding of inputs +- av: force decoding of audio and video inputs +- a: force decoding of audio inputs +- v: force decoding of video inputs __frames__ (sintl, updatable): drop all except listed frames (first being 1). A negative value `-V` keeps only first frame every `V` frames __xs__ (strl): extraction start time(s) __xe__ (strl): extraction end time(s). If less values than start times, the last time interval extracted is an open range __xround__ (enum, default: _before_): adjust start time of extraction range to I-frame -* before: use first I-frame preceding or matching range start -* seek: see filter help -* after: use first I-frame (if any) following or matching range start -* closest: use I-frame closest to range start + +- before: use first I-frame preceding or matching range start +- seek: see filter help +- after: use first I-frame (if any) following or matching range start +- closest: use I-frame closest to range start __xadjust__ (bool, default: _false_): adjust end time of extraction range to be before next I-frame __xots__ (bool, default: _false_): keep original timestamps after extraction @@ -180,16 +199,18 @@ _Note: In these modes, [splitrange](#splitrange) and [xadjust](#xadjust) are imp __no_audio_seek__ (bool, default: _false_): disable seek mode on audio streams (no change of priming duration) __probe_ref__ (bool, default: _false_): allow extracted range to be longer in case of B-frames with reference frames presented outside of range __utc_ref__ (enum, default: _any_): set reference mode for UTC range extraction -* local: use UTC of local host -* any: use UTC of media, or UTC of local host if not found in media after probing time -* media: use UTC of media (abort if none found) + +- local: use UTC of local host +- any: use UTC of media, or UTC of local host if not found in media after probing time +- media: use UTC of media (abort if none found) __utc_probe__ (uint, default: _5000_): timeout in milliseconds to try to acquire UTC reference from media __copy__ (bool, default: _false_, updatable): try copying frame interface into packets __cues__ (enum, default: _no_, updatable): cue filtering mode -* no: do no filter frames based on cue info -* segs: only forward frames marked as segment start -* frags: only forward frames marked as fragment start + +- no: do no filter frames based on cue info +- segs: only forward frames marked as segment start +- frags: only forward frames marked as fragment start __rmseek__ (bool, default: _false_, updatable): remove seek flag of all sent packets diff --git a/docs/Filters/restamp.md b/docs/Filters/restamp.md index e9a1a828..4f93b193 100644 --- a/docs/Filters/restamp.md +++ b/docs/Filters/restamp.md @@ -11,13 +11,16 @@ This filter rewrites timing (offsets and rate) of packets. The delays (global or per stream class) can be either positive (stream presented later) or negative (stream presented sooner). The specified [fps](#fps) can be either 0, positive or negative. + - if 0 or if the stream is audio, stream rate is not modified. - otherwise if negative, stream rate is multiplied by `-fps.num/fps.den`. - otherwise if positive and the stream is not video, stream rate is not modified. - otherwise (video PID), constant frame rate is assumed and: - - if [rawv=no](#rawv=no), video frame rate is changed to the specified rate (speed-up or slow-down). - - if [rawv=force](#rawv=force), input video stream is decoded and video frames are dropped/copied to match the new rate. - - if [rawv=dyn](#rawv=dyn), input video stream is decoded if not all-intra and video frames are dropped/copied to match the new rate. + + - if [rawv=no](#rawv=no), video frame rate is changed to the specified rate (speed-up or slow-down). + - if [rawv=force](#rawv=force), input video stream is decoded and video frames are dropped/copied to match the new rate. + - if [rawv=dyn](#rawv=dyn), input video stream is decoded if not all-intra and video frames are dropped/copied to match the new rate. + _Note: frames are simply copied or dropped with no motion compensation._ @@ -34,9 +37,10 @@ is set to the last computed timestamp plus the minimum packet duration for the s __delay_t__ (frac, default: _0/1_, updatable): delay to add to text streams __delay_o__ (frac, default: _0/1_, updatable): delay to add to other streams __rawv__ (enum, default: _no_): copy video frames -* no: no raw frame copy/drop -* force: force decoding all video streams -* dyn: decoding video streams if not all intra + +- no: no raw frame copy/drop +- force: force decoding all video streams +- dyn: decoding video streams if not all intra __tsinit__ (lfrac, default: _-1/1_): initial timestamp to resync to, negative values disables resync __align__ (uint, default: _0_): timestamp alignment threshold (0 disables alignment) - see filter help diff --git a/docs/Filters/rfadts.md b/docs/Filters/rfadts.md index b307f238..b3a8ebbc 100644 --- a/docs/Filters/rfadts.md +++ b/docs/Filters/rfadts.md @@ -14,14 +14,16 @@ This filter parses AAC files/data and outputs corresponding audio PID and frames __index__ (dbl, default: _1.0_): indexing window length __ovsbr__ (bool, default: _false_): force oversampling SBR (does not multiply timescales by 2) __sbr__ (enum, default: _no_): set SBR signaling -* no: no SBR signaling at all -* imp: backward-compatible SBR signaling (audio signaled as AAC-LC) -* exp: explicit SBR signaling (audio signaled as AAC-SBR) + +- no: no SBR signaling at all +- imp: backward-compatible SBR signaling (audio signaled as AAC-LC) +- exp: explicit SBR signaling (audio signaled as AAC-SBR) __ps__ (enum, default: _no_): set PS signaling -* no: no PS signaling at all -* imp: backward-compatible PS signaling (audio signaled as AAC-LC) -* exp: explicit PS signaling (audio signaled as AAC-PS) + +- no: no PS signaling at all +- imp: backward-compatible PS signaling (audio signaled as AAC-LC) +- exp: explicit PS signaling (audio signaled as AAC-PS) __expart__ (bool, default: _false_): expose pictures as a dedicated video PID __aacchcfg__ (sint, default: _0_): set AAC channel configuration to this value if missing from ADTS header, use negative value to always override diff --git a/docs/Filters/rfav1.md b/docs/Filters/rfav1.md index 84e170db..06f35595 100644 --- a/docs/Filters/rfav1.md +++ b/docs/Filters/rfav1.md @@ -17,8 +17,9 @@ This filter parses AV1 OBU, AV1 AnnexB or IVF with AV1 or VP9 files/data and out __notime__ (bool, default: _false_): ignore input timestamps, rebuild from 0 __temporal_delim__ (bool, default: _false_): keep temporal delimiters in reconstructed frames __bsdbg__ (enum, default: _off_): debug OBU parsing in `media@debug logs` -* off: not enabled -* on: enabled -* full: enable with number of bits dumped + +- off: not enabled +- on: enabled +- full: enable with number of bits dumped diff --git a/docs/Filters/rfimg.md b/docs/Filters/rfimg.md index aafea614..80dfc171 100644 --- a/docs/Filters/rfimg.md +++ b/docs/Filters/rfimg.md @@ -8,8 +8,10 @@ This filter may be automatically loaded during graph resolution. This filter parses JPG/J2K/PNG/BMP files/data and outputs corresponding visual PID and frames. The following extensions for PNG change the pixel format for RGBA images: -* pngd: use RGB+depth map pixel format -* pngds: use RGB+depth(7bits)+shape(MSB of alpha channel) pixel format + +- pngd: use RGB+depth map pixel format +- pngds: use RGB+depth(7bits)+shape(MSB of alpha channel) pixel format + No options diff --git a/docs/Filters/rfnalu.md b/docs/Filters/rfnalu.md index ec642285..db9d43c9 100644 --- a/docs/Filters/rfnalu.md +++ b/docs/Filters/rfnalu.md @@ -16,9 +16,10 @@ _Note: The filter uses negative CTS offsets: CTS is correct, but some frames may __index__ (dbl, default: _-1.0_): indexing window length. If 0, bitstream is not probed for duration. A negative value skips the indexing if the source file is larger than 20M (slows down importers) unless a play with start range > 0 is issued __explicit__ (bool, default: _false_): use explicit layered (SVC/LHVC) import __strict_poc__ (enum, default: _off_): delay frame output of an entire GOP to ensure CTS info is correct when POC suddenly changes -* off: disable GOP buffering -* on: enable GOP buffering, assuming no error in POC -* error: enable GOP buffering and try to detect lost frames + +- off: disable GOP buffering +- on: enable GOP buffering, assuming no error in POC +- error: enable GOP buffering and try to detect lost frames __nosei__ (bool, default: _false_): remove all sei messages __nosvc__ (bool, default: _false_): remove all SVC/MVC/LHVC data @@ -31,25 +32,28 @@ _Note: The filter uses negative CTS offsets: CTS is correct, but some frames may __audelim__ (bool, default: _false_): keep Access Unit delimiter in payload __notime__ (bool, default: _false_): ignore input timestamps, rebuild from 0 __dv_mode__ (enum, default: _auto_): signaling for DolbyVision -* none: never signal DV profile -* auto: signal DV profile if RPU or EL are found -* clean: do not signal and remove RPU and EL NAL units -* single: signal DV profile if RPU are found and remove EL NAL units + +- none: never signal DV profile +- auto: signal DV profile if RPU or EL are found +- clean: do not signal and remove RPU and EL NAL units +- single: signal DV profile if RPU are found and remove EL NAL units __dv_profile__ (uint, default: _0_): profile for DolbyVision (currently defined profiles are 4, 5, 7, 8, 9), 0 for auto-detect __dv_compatid__ (enum, default: _auto_): cross-compatibility ID for DolbyVision -* auto: auto-detect -* none: no cross-compatibility -* hdr10: CTA HDR10, as specified by EBU TR 03 -* bt709: SDR BT.709 -* hlg709: HLG BT.709 gamut in ITU-R BT.2020 -* hlg2100: HLG BT.2100 gamut in ITU-R BT.2020 -* bt2020: SDR BT.2020 -* brd: Ultra HD Blu-ray Disc HDR + +- auto: auto-detect +- none: no cross-compatibility +- hdr10: CTA HDR10, as specified by EBU TR 03 +- bt709: SDR BT.709 +- hlg709: HLG BT.709 gamut in ITU-R BT.2020 +- hlg2100: HLG BT.2100 gamut in ITU-R BT.2020 +- bt2020: SDR BT.2020 +- brd: Ultra HD Blu-ray Disc HDR __bsdbg__ (enum, default: _off_): debug NAL parsing in `media@debug` logs -* off: not enabled -* on: enabled -* full: enable with number of bits dumped + +- off: not enabled +- on: enabled +- full: enable with number of bits dumped diff --git a/docs/Filters/routein.md b/docs/Filters/routein.md index 1e7b6832..6d2b9c17 100644 --- a/docs/Filters/routein.md +++ b/docs/Filters/routein.md @@ -5,27 +5,33 @@ Register name used to load filter: __routein__ This filter may be automatically loaded during graph resolution. -This filter is a receiver for ROUTE sessions (ATSC 3.0 and generic ROUTE) and DVB-MABR flute sessions. +This filter is a receiver for file delivery over multicast. It currently supports ATSC 3.0, generic ROUTE and DVB-MABR flute. + - ATSC 3.0 mode is identified by the URL `atsc://`. - Generic ROUTE mode is identified by the URL `route://IP:PORT`. - DVB-MABR mode is identified by the URL `mabr://IP:PORT` pointing to the bootstrap FLUTE channel carrying the multicast gateway configuration. + The filter can work in cached mode, source mode or standalone mode. # Cached mode -The cached mode is the default filter behavior. It populates GPAC HTTP Cache with the received files, using `http://groute/serviceN/` as service root, `N being the ROUTE service ID.` +The cached mode is the default filter behavior. It populates GPAC HTTP Cache with the received files, using `http://gmcast/serviceN/` as service root, `N being the multicast service ID.` In cached mode, repeated files are always pushed to cache. The maximum number of media segment objects in cache per service is defined by [nbcached](#nbcached); this is a safety used to force object removal in case DASH client timing is wrong and some files are never requested at cache level. The cached MPD is assigned the following headers: -* `x-route`: integer value, indicates the ROUTE service ID. -* `x-route-first-seg`: string value, indicates the name of the first segment (completely or currently being) retrieved from the broadcast. -* `x-route-ll`: boolean value, if yes indicates that the indicated first segment is currently being received (low latency signaling). -* `x-route-loop`: boolean value, if yes indicates a loop (e.g. pcap replay) in the service has been detected - only checked if [cloop](#cloop) is set. + +- `x-mcast`: boolean value, if `yes` indicates the file comes from a multicast. +- `x-mcast-first-seg`: string value, indicates the name of the first segment (completely or currently being) retrieved from the broadcast. +- `x-mcast-ll`: boolean value, if yes indicates that the indicated first segment is currently being received (low latency signaling). +- `x-mcast-loop`: boolean value, if yes indicates a loop (e.g. pcap replay) in the service has been detected - only checked if [cloop](#cloop) is set. + The cached files are assigned the following headers: -* `x-route`: boolean value, if yes indicates the file comes from an ROUTE session. + +- `x-mcast`: boolean value, if `yes` indicates the file comes from a multicast. + If [max_segs](#max_segs) is set, file deletion event will be triggered in the filter chain. @@ -55,8 +61,10 @@ If [max_segs](#max_segs) is set, old files will be deleted. # File Repair In case of losses or incomplete segment reception (during tune-in), the files are patched as follows: -* MPEG-2 TS: all lost ranges are adjusted to 188-bytes boundaries, and transformed into NULL TS packets. -* ISOBMFF: all top-level boxes are scanned, and incomplete boxes are transformed in `free` boxes, except mdat kept as is if [repair](#repair) is set to simple. + +- MPEG-2 TS: all lost ranges are adjusted to 188-bytes boundaries, and transformed into NULL TS packets. +- ISOBMFF: all top-level boxes are scanned, and incomplete boxes are transformed in `free` boxes, except mdat kept as is if [repair](#repair) is set to simple. + If [kc](#kc) option is set, corrupted files will be kept. If [fullseg](#fullseg) is not set and files are only partially received, they will be kept. @@ -68,7 +76,7 @@ Example ``` route add -net 224.0.23.60/32 -interface vboxnet0 ``` -Then for each ROUTE service in the multicast: +Then for each multicast service in the multicast: Example ``` route add -net 239.255.1.4/32 -interface vboxnet0 @@ -96,11 +104,14 @@ route add -net 239.255.1.4/32 -interface vboxnet0 __rtimeout__ (uint, default: _1000_): default timeout in us to wait when gathering out-of-order packets __fullseg__ (bool, default: _false_): only dispatch full segments in cache mode (always true for other modes) __repair__ (enum, default: _simple_): repair mode for corrupted files -* no: no repair is performed -* simple: simple repair is performed (incomplete `mdat` boxes will be kept) -* strict: incomplete mdat boxes will be lost as well as preceding `moof` boxes -* full: HTTP-based repair of all lost packets + +- no: no repair is performed +- simple: simple repair is performed (incomplete `mdat` boxes will be kept) +- strict: incomplete mdat boxes will be lost as well as preceding `moof` boxes +- full: HTTP-based repair of all lost packets __repair_url__ (cstr): repair url __max_sess__ (uint, default: _1_): max number of concurrent HTTP repair sessions +__llmode__ (bool, default: _true_): enable low-latency access +__dynsel__ (bool, default: _true_): dynamically enable and disable multicast groups based on their selection state diff --git a/docs/Filters/routeout.md b/docs/Filters/routeout.md index 20519614..57bb7871 100644 --- a/docs/Filters/routeout.md +++ b/docs/Filters/routeout.md @@ -9,19 +9,25 @@ The ROUTE output filter is used to distribute a live file-based session using RO The filter supports DASH and HLS inputs, ATSC3.0 signaling and generic ROUTE or DVB-MABR signaling. The filter is identified using the following URL schemes: -* `atsc://`: session is a full ATSC 3.0 session -* `route://IP:port`: session is a ROUTE session running on given multicast IP and port -* `mabr://IP:port`: session is a DVB-MABR session using FLUTE running on given multicast IP and port + +- `atsc://`: session is a full ATSC 3.0 session +- `route://IP:port`: session is a ROUTE session running on given multicast IP and port +- `mabr://IP:port`: session is a DVB-MABR session using FLUTE running on given multicast IP and port + The filter only accepts input PIDs of type `FILE`. + - HAS Manifests files are detected by file extension and/or MIME types, and sent as part of the signaling bundle or as LCT object files for HLS child playlists. - HAS Media segments are detected using the `OrigStreamType` property, and send as LCT object files using the DASH template string. - A PID without `OrigStreamType` property set is delivered as a regular LCT object file (called `raw` hereafter). + For `raw` file PIDs, the filter will look for the following properties: -* `ROUTEName`: set resource name. If not found, uses basename of URL -* `ROUTECarousel`: set repeat period. If not found, uses [carousel](#carousel). If 0, the file is only sent once -* `ROUTEUpload`: set resource upload time. If not found, uses [carousel](#carousel). If 0, the file will be sent as fast as possible. + +- `ROUTEName`: set resource name. If not found, uses basename of URL +- `ROUTECarousel`: set repeat period. If not found, uses [carousel](#carousel). If 0, the file is only sent once +- `ROUTEUpload`: set resource upload time. If not found, uses [carousel](#carousel). If 0, the file will be sent as fast as possible. + When DASHing for ROUTE, DVB-MABR or single service ATSC, a file extension, either in [dst](#dst) or in [ext](#ext), may be used to identify the HAS session type (DASH or HLS). Example @@ -45,9 +51,11 @@ __Warning: When forwarding an existing DASH/HLS session, do NOT set any extensio By default, all streams in a service are assigned to a single multicast session, and differentiated by TSI (see [splitlct](#splitlct)). TSI are assigned as follows: + - signaling TSI is always 0 for ROUTE, 1 for DVB+Flute - raw files are assigned TSI 1 and increasing number of TOI - otherwise, the first PID found is assigned TSI 10, the second TSI 20 etc ... + Init segments and HLS child playlists are sent before each new segment, independently of [carousel](#carousel). @@ -58,13 +66,15 @@ By default, a single multicast IP is used for route sessions, each service will The filter will look for `ROUTEIP` and `ROUTEPort` properties on the incoming PID. If not found, the default [ip](#ip) and [port](#port) will be used. ATSC 3.0 attributes set by using the following PID properties: -* ATSC3ShortServiceName: set the short service name, maxiumu of 7 characters. If not found, `ServiceName` is checked, otherwise default to `GPAC`. -* ATSC3MajorChannel: set major channel number of service. Default to 2. This really should be set and should not use the default. -* ATSC3MinorChannel: set minor channel number of service. Default of 1. -* ATSC3ServiceCat: set service category, default to 1 if not found. 1=Linear a/v service. 2=Linear audio only service. 3=App-based service. 4=ESg service. 5=EA service. 6=DRM service. -* ATSC3hidden: set if service is hidden. Boolean true or false. Default of false. -* ATSC3hideInGuide: set if service is hidden in ESG. Boolean true or false. Default of false. -* ATSC3configuration: set service configuration. Choices are Broadcast or Broadband. Default of Broadcast + +- ATSC3ShortServiceName: set the short service name, maxiumu of 7 characters. If not found, `ServiceName` is checked, otherwise default to `GPAC`. +- ATSC3MajorChannel: set major channel number of service. Default to 2. This really should be set and should not use the default. +- ATSC3MinorChannel: set minor channel number of service. Default of 1. +- ATSC3ServiceCat: set service category, default to 1 if not found. 1=Linear a/v service. 2=Linear audio only service. 3=App-based service. 4=ESg service. 5=EA service. 6=DRM service. +- ATSC3hidden: set if service is hidden. Boolean true or false. Default of false. +- ATSC3hideInGuide: set if service is hidden in ESG. Boolean true or false. Default of false. +- ATSC3configuration: set service configuration. Choices are Broadcast or Broadband. Default of Broadcast + # ROUTE mode @@ -84,17 +94,22 @@ The FLUTE session always uses a symbol length of [mtu](#mtu) minus 44 bytes. # Low latency mode -When using low-latency mode, the input media segments are not re-assembled in a single packet but are instead sent as they are received. +When using low-latency mode (-llmode)(), the input media segments are not re-assembled in a single packet but are instead sent as they are received. In order for the real-time scheduling of data chunks to work, each fragment of the segment should have a CTS and timestamp describing its timing. If this is not the case (typically when used with an existing DASH session in file mode), the scheduler will estimate CTS and duration based on the stream bitrate and segment duration. The indicated bitrate is increased by [brinc](#brinc) percent for safety. If this fails, the filter will trigger warnings and send as fast as possible. _Note: The LCT objects are sent with no length (TOL header) assigned until the final segment size is known, potentially leading to a final 0-size LCT fragment signaling only the final size._ +In this mode, init segments and manifests are sent at the frequency given by property `ROUTECarousel` of the source PID if set or by (-carousel)[] option. +Indicating `ROUTECarousel=0` will disable mid-segment repeating of manifests and init segments. + # Examples Since the ROUTE filter only consumes files, it is required to insert: + - the dash demultiplexer in file forwarding mode when loading a DASH session - the dash multiplexer when creating a DASH session + Multiplexing an existing DASH session in route: Example @@ -141,6 +156,15 @@ gpac -i source.mpd dasher -o route://225.1.1.0:6000/manifest.mpd ``` These will demultiplex the input, re-dash it and send the output of the dasher to ROUTE +# Error simulation + +It is possible to simulate errors with (-errsim)(). In this mode the LCT network sender implements a 2-state Markov chain: +Example +``` +gpac -i source.mpd dasher -o route://225.1.1.0:6000/:errsim=1.0x98.0 +``` +for a 1.0 percent chance to transition to error (not sending data over the network) and 98.0 to transition from error back to OK. + # Options @@ -155,9 +179,10 @@ These will demultiplex the input, re-dash it and send the output of the dasher t __bsid__ (uint, default: _800_): ID for ATSC broadcast stream __mtu__ (uint, default: _1472_): size of LCT MTU in bytes __splitlct__ (enum, default: _off_): split mode for LCT channels -* off: all streams are in the same LCT channel -* type: each new stream type results in a new LCT channel -* all: all streams are in dedicated LCT channel, the first stream being used for STSID signaling + +- off: all streams are in the same LCT channel +- type: each new stream type results in a new LCT channel +- all: all streams are in dedicated LCT channel, the first stream being used for STSID signaling __korean__ (bool, default: _false_): use Korean version of ATSC 3.0 spec instead of US __llmode__ (bool, default: _false_): use low-latency mode @@ -166,9 +191,13 @@ These will demultiplex the input, re-dash it and send the output of the dasher t __runfor__ (uint, default: _0_): run for the given time in ms __nozip__ (bool, default: _false_): do not zip signaling package (STSID+manifest) __furl__ (bool, default: _false_): inject full URLs of source service in the signaling instead of stripped server path +__flute__ (bool, default: _true_): use flute for DVB-MABR object delivery __csum__ (enum, default: _meta_): send MD5 checksum for DVB flute -* no: do not send checksum -* meta: only send checksum for configuration files, manifests and init segments -* all: send checksum for everything + +- no: do not send checksum +- meta: only send checksum for configuration files, manifests and init segments +- all: send checksum for everything +__recv_obj_timeout__ (uint, default: _50_): timeout period in ms before resorting to unicast repair +__errsim__ (v2d, default: _0.0x100.0_): simulate errors using a 2-state Markov chain. Value are percentages diff --git a/docs/Filters/rtpin.md b/docs/Filters/rtpin.md index 171b06fa..78ba81a4 100644 --- a/docs/Filters/rtpin.md +++ b/docs/Filters/rtpin.md @@ -6,15 +6,19 @@ Register name used to load filter: __rtpin__ This filter may be automatically loaded during graph resolution. This filter handles SDP/RTSP/RTP input reading. It supports: + - SDP file reading - RTP direct url through `rtp://` protocol scheme - RTSP session processing through `rtsp://` and `satip://` protocol schemes + The filter produces either PIDs with media frames, or file PIDs with multiplexed data (e.g. MPEG-2 TS). The filter will use: + - RTSP over HTTP tunnel if server port is 80 or 8080 or if protocol scheme is `rtsph://`. - RTSP over TLS if server port is 322 or if protocol scheme is `rtsps://`. - RTSP over HTTPS tunnel if server port is 443 and if protocol scheme is `rtsph://`. + The filter will attempt reconnecting in TLS mode after two consecutive initial connection failures. @@ -36,9 +40,10 @@ The filter will attempt reconnecting in TLS mode after two consecutive initial c __default_port__ (uint, default: _554_, minmax: 0-65535): set default RTSP port __satip_port__ (uint, default: _1400_, minmax: 0-65535): set default port for SATIP __transport__ (enum, default: _auto_): set RTP over RTSP -* auto: set interleave on if HTTP tunnel is used, off otherwise and retry in interleaved mode if UDP timeout -* tcp: enable RTP over RTSP -* udp: disable RTP over RTSP + +- auto: set interleave on if HTTP tunnel is used, off otherwise and retry in interleaved mode if UDP timeout +- tcp: enable RTP over RTSP +- udp: disable RTP over RTSP __udp_timeout__ (uint, default: _10000_): default timeout before considering UDP is down __rtcp_timeout__ (uint, default: _5000_): default timeout for RTCP traffic in ms. After this timeout, playback will start out of sync. If 0 always wait for RTCP @@ -49,6 +54,7 @@ The filter will attempt reconnecting in TLS mode after two consecutive initial c __languages__ (str, default: _$GLANG_): user languages, by default solved from GPAC preferences __stats__ (uint, default: _500_): update statistics to the user every given MS (0 disables reporting) __max_sleep__ (sint, default: _1000_): set max sleep in milliseconds: + - a negative value `-N` means to always sleep for `N` ms - a positive value `N` means to sleep at most `N` ms but will sleep less if frame duration is shorter diff --git a/docs/Filters/rtpout.md b/docs/Filters/rtpout.md index b0f6da8e..53279f02 100644 --- a/docs/Filters/rtpout.md +++ b/docs/Filters/rtpout.md @@ -25,11 +25,15 @@ This will indicate that the RTP streamer expects a MPEG-2 TS mux as an input. The RTP packets produced have a maximum payload set by the [mtu](#mtu) option (IP packet will be MTU + 40 bytes of IP+UDP+RTP headers). The real-time scheduling algorithm works as follows: + - first initialize the clock by: - - computing the smallest timestamp for all input PIDs - - mapping this media time to the system clock + + - computing the smallest timestamp for all input PIDs + - mapping this media time to the system clock + - determine the earliest packet to send next on each input PID, adding [delay](#delay) if any - finally compare the packet mapped timestamp _TS_ to the system clock _SC_. When _TS_ - _SC_ is less than [tt](#tt), the RTP packets for the source packet are sent + The filter does not check for RTCP timeout and will run until all input PIDs reach end of stream. diff --git a/docs/Filters/rtspout.md b/docs/Filters/rtspout.md index e3c74c3a..84cc7fe3 100644 --- a/docs/Filters/rtspout.md +++ b/docs/Filters/rtspout.md @@ -36,9 +36,11 @@ gpac rtspout:mounts=mydir1,mydir2 In this case, content `RES` from any of the specified directory is exposed as `rtsp://SERVER/RES` The [mounts](#mounts) option can also specify access rule file(s), see `gpac -h creds`. When rules are used: + - if a directory has a `name` rule, it will be used in the URL - otherwise, the directory is directly available under server root `/` - only read access and multicast rights are checked + Example ``` [foodir] @@ -109,16 +111,18 @@ The tunnel conforms to QT specification, and only HTTP 1.0 and 1.1 tunnels are s __loop__ (bool, default: _true_): loop all streams in session (not always possible depending on source type) __dynurl__ (bool, default: _false_): allow dynamic service assembly __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 + +- 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 __quit__ (bool, default: _false_): exit server once first session is over (for test purposes) __htun__ (bool, default: _true_): enable RTSP over HTTP tunnel __trp__ (enum, default: _both_): transport mode -* both: allow TCP or UDP traffic -* udp: only allow UDP traffic -* tcp: only allow TCP traffic + +- both: allow TCP or UDP traffic +- udp: only allow UDP traffic +- tcp: only allow TCP traffic __cert__ (str): certificate file in PEM format to use for TLS mode __pkey__ (str): private key file in PEM format to use for TLS mode diff --git a/docs/Filters/scte35dec.md b/docs/Filters/scte35dec.md index 3708fcfb..7b9103c2 100644 --- a/docs/Filters/scte35dec.md +++ b/docs/Filters/scte35dec.md @@ -12,5 +12,10 @@ following segmentation as hinted by the graph. # Options +__mode__ (enum, default: _23001-18_): mode to operate in + +- 23001-18: extract SCTE-35 markers as emib/emeb boxes for Event Tracks +- passthrough: pass-through mode adding cue start property on splice points + __segdur__ (frac, default: _1/1_): segmentation duration in seconds. 0/0 flushes immediately for each input packet (beware of the bitrate overhead) diff --git a/docs/Filters/sockin.md b/docs/Filters/sockin.md index bdc1a47c..98b13f04 100644 --- a/docs/Filters/sockin.md +++ b/docs/Filters/sockin.md @@ -9,18 +9,26 @@ This filter handles generic TCP and UDP input sockets. It can also probe for MPE Data format can be specified by setting either [ext](#ext) or [mime](#mime) options. If not set, the format will be guessed by probing the first data packet + - UDP sockets are used for source URLs formatted as `udp://NAME` - TCP sockets are used for source URLs formatted as `tcp://NAME` - UDP unix domain sockets are used for source URLs formatted as `udpu://NAME` - TCP unix domain sockets are used for source URLs formatted as `tcpu://NAME` + When ports are specified in the URL and the default option separators are used (see `gpac -h doc`), the URL must either: + - have a trailing '/', e.g. `udp://localhost:1234/[:opts]` - use `gpac` separator, e.g. `udp://localhost:1234[:gpac:opts]` + When the socket is listening in keep-alive [ka](#ka) mode: + - a single connection is allowed and a single output PID will be produced - each connection close event will triger a pipeline flush + + +On OSX with VM packet replay you will need to force multicast routing, e.g. `route add -net 239.255.1.4/32 -interface vboxnet0` # Options diff --git a/docs/Filters/sockout.md b/docs/Filters/sockout.md index 401fba74..38e3af5b 100644 --- a/docs/Filters/sockout.md +++ b/docs/Filters/sockout.md @@ -11,14 +11,18 @@ In server mode, the filter can be instructed to keep running at the end of the s In server mode, the default behavior is to keep input packets when no more clients are connected; this can be adjusted though the [kp](#kp) option, however there is no realtime regulation of how fast packets are dropped. If your sources are not real time, consider adding a real-time scheduler in the chain (cf reframer filter), or set the send [rate](#rate) option. + - UDP sockets are used for destinations URLs formatted as `udp://NAME` - TCP sockets are used for destinations URLs formatted as `tcp://NAME` - UDP unix domain sockets are used for destinations URLs formatted as `udpu://NAME` - TCP unix domain sockets are used for destinations URLs formatted as `tcpu://NAME` + When ports are specified in the URL and the default option separators are used (see `gpac -h doc`), the URL must either: + - have a trailing '/', e.g. `udp://localhost:1234/[:opts]` - use `gpac` escape, e.g. `udp://localhost:1234[:gpac:opts]` + The socket output can be configured to drop or revert packet order for test purposes. A window size in packets is specified as the drop/revert fraction denominator, and the index of the packet to drop/revert is given as the numerator/ diff --git a/docs/Filters/thumbs.md b/docs/Filters/thumbs.md index 4441f925..10c2f0e1 100644 --- a/docs/Filters/thumbs.md +++ b/docs/Filters/thumbs.md @@ -3,7 +3,7 @@ # Thumbnail collection generator Register name used to load filter: __thumbs__ -This is a JavaScript filter, not checked during graph resolution and needs explicit loading. +This is a JavaScript filter. It is not checked during graph resolution and needs explicit loading. Author: GPAC team This filter generates screenshots from a video stream. @@ -21,16 +21,18 @@ If a single image per output frame is used, the default value for [snap](#snap) Otherwise, the default value for [snap](#snap) is 1 second and for [scale](#scale) is 10. A single line of text can be inserted over each frame. Predefined keywords can be used in input text, identified as `$KEYWORD$`: -* ts: replaced by packet timestamp -* timescale: replaced by PID timescale -* time: replaced by packet time as HH:MM:SS.ms -* cpu: replaced by current CPU usage of process -* mem: replaced by current memory usage of process -* version: replaced by GPAC version -* fversion: replaced by GPAC full version -* mae: replaced by Mean Absolute Error with previous frame -* mse: replaced by Mean Square Error with previous frame -* P4CC, PropName: replaced by corresponding PID property + +- ts: replaced by packet timestamp +- timescale: replaced by PID timescale +- time: replaced by packet time as HH:MM:SS.ms +- cpu: replaced by current CPU usage of process +- mem: replaced by current memory usage of process +- version: replaced by GPAC version +- fversion: replaced by GPAC full version +- mae: replaced by Mean Absolute Error with previous frame +- mse: replaced by Mean Square Error with previous frame +- P4CC, PropName: replaced by corresponding PID property + Example ``` @@ -63,8 +65,10 @@ If both [mae](#mae) and [mse](#mse) thresholds are not 0, the frame is added if For both metrics, a value of 0 means all pixels are the same, a value of 100 means all pixels have 100% intensity difference (e.g. black versus white). The scene detection is performed after the [snap](#snap) filtering and uses: + - the previous frame in the stream, whether it was added or not, if [scref](#scref) is not set, - the last added frame otherwise. + Typical thresholds for scene cut detection are 14 to 20 for [mae](#mae) and 5 to 7 for [mse](#mse). diff --git a/docs/Filters/tilesplit.md b/docs/Filters/tilesplit.md index 5fab36c7..96131460 100644 --- a/docs/Filters/tilesplit.md +++ b/docs/Filters/tilesplit.md @@ -10,8 +10,10 @@ The filter will move to passthrough mode if the bitstream is not tiled. If the `Bitrate` property is set on the input PID, the output tile PIDs will have a bitrate set to `(Bitrate - 10k)/nb_opids`, 10 kbps being reserved for the base. Each tile PID will be assigned the following properties: -* `ID`: equal to the base PID ID (same as input) plus the 1-based index of the tile in raster scan order. -* `TileID`: equal to the 1-based index of the tile in raster scan order. + +- `ID`: equal to the base PID ID (same as input) plus the 1-based index of the tile in raster scan order. +- `TileID`: equal to the 1-based index of the tile in raster scan order. + __Warning: The filter does not check if tiles are independently-coded (MCTS) !__ diff --git a/docs/Filters/ttmldec.md b/docs/Filters/ttmldec.md index a531f92f..e79ad11b 100644 --- a/docs/Filters/ttmldec.md +++ b/docs/Filters/ttmldec.md @@ -10,9 +10,11 @@ The scene graph creation is done through JavaScript. The filter options are used to override the JS global variables of the TTML renderer. In stand-alone rendering (no associated video), the filter will use: + - `Width` and `Height` properties of input pid if any - otherwise, `osize` option of compositor if set - otherwise, [txtw](#txtw) and [txth](#txth) + # Options @@ -22,9 +24,10 @@ In stand-alone rendering (no associated video), the filter will use: __fontSize__ (flt, default: _20_, updatable): font size __color__ (str, default: _white_, updatable): text color __valign__ (enum, default: _bottom_, updatable): vertical alignment -* bottom: align text at bottom of text area -* center: align text at center of text area -* top: align text at top of text area + +- bottom: align text at bottom of text area +- center: align text at center of text area +- top: align text at top of text area __lineSpacing__ (flt, default: _1.0_, updatable): line spacing as scaling factor to font size __txtw__ (uint, default: _400_): default width in standalone rendering diff --git a/docs/Filters/ttmlmerge.md b/docs/Filters/ttmlmerge.md new file mode 100644 index 00000000..7686aefe --- /dev/null +++ b/docs/Filters/ttmlmerge.md @@ -0,0 +1,11 @@ + + +# TTML sample merger + +Register name used to load filter: __ttmlmerge__ +This filter may be automatically loaded during graph resolution. + +Merge input samples into a single TTML sample. Merging restarts at the start of DASH segments. + +No options + diff --git a/docs/Filters/ttxtdec.md b/docs/Filters/ttxtdec.md index 7e905b40..5b37f61d 100644 --- a/docs/Filters/ttxtdec.md +++ b/docs/Filters/ttxtdec.md @@ -9,9 +9,11 @@ This filter decodes TTXT/TX3G streams into a BIFS scene graph of the compositor The TTXT documentation is available at https://wiki.gpac.io/xmlformats/TTXT-Format-Documentation In stand-alone rendering (no associated video), the filter will use: + - `Width` and `Height` properties of input pid if any - otherwise, `osize` option of compositor if set - otherwise, [txtw](#txtw) and [txth](#txth) + # Options diff --git a/docs/Filters/txtin.md b/docs/Filters/txtin.md index 12d0497e..9bb51b75 100644 --- a/docs/Filters/txtin.md +++ b/docs/Filters/txtin.md @@ -7,18 +7,23 @@ This filter may be automatically loaded during graph resolution. This filter reads subtitle data from input PID to produce subtitle frames on a single PID. The filter supports the following formats: -* SRT: https://en.wikipedia.org/wiki/SubRip -* WebVTT: https://www.w3.org/TR/webvtt1/ -* TTXT: https://wiki.gpac.io/xmlformats/TTXT-Format-Documentation -* QT 3GPP Text XML (TexML): Apple QT6, likely deprecated -* TTML: https://www.w3.org/TR/ttml2/ -* SUB: one subtitle per line formatted as `{start_frame}{end_frame}text` -* SSA (Substation Alpha): basic parsing support for common files + +- SRT: https://en.wikipedia.org/wiki/SubRip +- WebVTT: https://www.w3.org/TR/webvtt1/ +- TTXT: https://wiki.gpac.io/xmlformats/TTXT-Format-Documentation +- QT 3GPP Text XML (TexML): Apple QT6, likely deprecated +- TTML: https://www.w3.org/TR/ttml2/ +- SUB: one subtitle per line formatted as `{start_frame}{end_frame}text` +- SSA (Substation Alpha): basic parsing support for common files + Input files must be in UTF-8 or UTF-16 format, with or without BOM. The internal frame format is: -* WebVTT (and srt if desired): ISO/IEC 14496-30 VTT cues -* TTML: ISO/IEC 14496-30 XML subtitles -* Others: 3GPP/QT Timed Text + +- WebVTT (and srt if desired): ISO/IEC 14496-30 VTT cues +- TTML: ISO/IEC 14496-30 XML subtitles +- stxt and sbtt: ISO/IEC 14496-30 text stream and text subtitles +- Others: 3GPP/QT Timed Text + # TTML Support @@ -26,17 +31,21 @@ If [ttml_split](#ttml_split) option is set, the TTML document is split in indepe Empty periods in TTML will result in empty TTML documents or will be skipped if [no_empty](#no_empty) option is set. The first sample has a CTS assigned as indicated by [ttml_cts](#ttml_cts): + - a numerator of -2 indicates the first CTS is 0 - a numerator of -1 indicates the first CTS is the first active time in document - a numerator >= 0 indicates the CTS to use for first sample + When TTML splitting is disabled, the duration of the TTML sample is given by [ttml_dur](#ttml_dur) if not 0, or set to the document duration By default, media resources are kept as declared in TTML2 documents. [ttml_embed](#ttml_embed) can be used to embed inside the TTML sample the resources in `` or ``: + - for ``, ``, `