Source / Output
ffmpeg.filter.audio_video.output
Return a source with audio and video from a filter's output.
Type:
(?id : string?, ffmpeg.filter.graph, 'b
.{tracks : () -> 'a.{audio : ffmpeg.filter.audio}}, 'd
.{tracks : () -> 'c.{video : ffmpeg.filter.video}}) ->
source(audio=ffmpeg.audio.raw('e), video=ffmpeg.video.raw('f))
Arguments
id(of typestring?, which defaults tonull)(unlabeled)(of typeffmpeg.filter.graph): Force the value of the source ID.(unlabeled)(of type'b.{tracks : () -> 'a.{audio : ffmpeg.filter.audio}})(unlabeled)(of type'd.{tracks : () -> 'c.{video : ffmpeg.filter.video}})
Methods
buffered(of type() -> [string * float]): Length of buffered data.clock(of typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): Indicate if a source may fail, i.e. may not be ready to stream.generate_frame(of type() -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such ason_frame!id(of type() -> string): Identifier of the source.insert_metadata(of type(?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata ifnew_trackistrue.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.http.is_ready(of type() -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.is_up(of type() -> bool): Indicate that the source can be asked to produce some data at any time. This istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.last_metadata(of type() -> [string * string]?): Return the last metadata from the source.log(of type{level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from1to5.register_command(of type(?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.remaining(of type() -> float): Estimation of remaining time in the current track.reset_last_metadata_on_track(of type(() -> bool).{set : (bool) -> unit}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.seek(of type(float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).self_sync(of type() -> bool): Is the source currently controlling its own real-time loop.self_sync_description(of type() -> string):skip(of type() -> unit): Skip to the next track.time(of type() -> float): Get a source's time, based on its assigned clock.
Callbacks
on_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_frame_checksum(of type(?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).on_metadata(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_wake_up(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready
output
Output a stream using the default operator. The input source does not need to be infallible, blank will just be played during failures.
Type:
(?id : string?, ?fallible : bool, ?start : bool, source(audio=pcm('A))) ->
unit
Synchronization:
This output uses the PulseAudio clock as synchronization source when self_sync=true and the stream is open.Arguments
id (of type string?, which defaults to null): Force the value of the source ID.fallible (of type bool, which defaults to true): Allow the child source to fail, in which case the output will be (temporarily) stopped.start (of type bool, which defaults to true): Automatically start outputting whenever possible. If true, an infallible (normal) output will start as soon as it is created, and a fallible output will (re)start as soon as its source becomes available for streaming.(unlabeled) (of type source(audio=pcm('A))): Source to play.Methods
buffered (of type () -> [string * float]): Length of buffered data.clock (of type clock): The source's clockduration (of type () -> float): Estimation of the duration of the current track.elapsed (of type () -> float): Elapsed time in the current track.fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!id (of type () -> string): Identifier of the source.insert_metadata (of type (?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true.is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.is_started (of type () -> bool): true if the output or source is started.is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.last_metadata (of type () -> [string * string]?): Return the last metadata from the source.log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.remaining (of type () -> float): Estimation of remaining time in the current track.reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.self_sync_description (of type () -> string): This output uses the PulseAudio clock as synchronization source when self_sync=true and the stream is open.shutdown (of type () -> unit): Shutdown the output.skip (of type () -> unit): Skip to the next track.start (of type () -> unit): Ask the source or output to start.stop (of type () -> unit): Ask the source or output to stop.time (of type () -> float): Get a source's time, based on its assigned clock.Callbacks
on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwiseon_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadataon_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executedon_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_start (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler when output startson_stop (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler when output stopson_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready
output.alsa
Output the source's stream to an ALSA output device.
Type:
(?id : string?, ?buffer_size : float?, ?device : string, ?fallible : bool,
?register_telnet : bool, ?self_sync : bool, ?start : bool,
source(audio=pcm('a), 'b)) -> unit
Synchronization:
This output uses the ALSA hardware clock as synchronization source when self_sync=true and the device is open.Arguments
id (of type string?, which defaults to null): Force the value of the source ID.buffer_size (of type float?, which defaults to null): ALSA buffer size in seconds. Defaults to frame duration when null.device (of type string, which defaults to "default"): Alsa device to usefallible (of type bool, which defaults to false): Allow the child source to fail, in which case the output will be stopped until the source is available again.register_telnet (of type bool, which defaults to true): Register telnet commands for this output.self_sync (of type bool, which defaults to true): Mark the source as being synchronized by the ALSA driver.start (of type bool, which defaults to true): Start output as soon as it is available.(unlabeled) (of type source(audio=pcm('a), 'b))Methods
buffered (of type () -> [string * float]): Length of buffered data.clock (of type clock): The source's clockduration (of type () -> float): Estimation of the duration of the current track.elapsed (of type () -> float): Elapsed time in the current track.fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!id (of type () -> string): Identifier of the source.insert_metadata (of type (?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true.is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.is_started (of type () -> bool): true if the output or source is started.is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.last_metadata (of type () -> [string * string]?): Return the last metadata from the source.log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.remaining (of type () -> float): Estimation of remaining time in the current track.reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.self_sync_description (of type () -> string): This output uses the ALSA hardware clock as synchronization source when self_sync=true and the device is open.shutdown (of type () -> unit): Shutdown the output.skip (of type () -> unit): Skip to the next track.start (of type () -> unit): Ask the source or output to start.stop (of type () -> unit): Ask the source or output to stop.time (of type () -> float): Get a source's time, based on its assigned clock.Callbacks
on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwiseon_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadataon_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executedon_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_start (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler when output startson_stop (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler when output stopson_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready
output.ao
Output stream to local sound card using libao.
Type:
(?id : string?, ?channels_matrix : string, ?driver : string,
?fallible : bool, ?options : [string * string], ?register_telnet : bool,
?self_sync : bool, ?start : bool, source(audio=pcm('a), 'b)) -> unit
Synchronization:
This output uses the AO device clock as synchronization source when self_sync=true and the device is open.Arguments
id (of type string?, which defaults to null): Force the value of the source ID.channels_matrix (of type string, which defaults to ""): Output channels matrix, "" for AO's default.driver (of type string, which defaults to ""): Driver to be used, "" for AO's default.fallible (of type bool, which defaults to false): Allow the child source to fail, in which case the output will be stopped until the source is available again.options (of type [string * string], which defaults to []): List of parameters, depends on the driver.register_telnet (of type bool, which defaults to true): Register telnet commands for this output.self_sync (of type bool, which defaults to true): Use the dedicated AO clock.start (of type bool, which defaults to true): Start output as soon as it is available.(unlabeled) (of type source(audio=pcm('a), 'b))Methods
buffered (of type () -> [string * float]): Length of buffered data.clock (of type clock): The source's clockduration (of type () -> float): Estimation of the duration of the current track.elapsed (of type () -> float): Elapsed time in the current track.fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!id (of type () -> string): Identifier of the source.insert_metadata (of type (?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true.is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.is_started (of type () -> bool): true if the output or source is started.is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.last_metadata (of type () -> [string * string]?): Return the last metadata from the source.log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.remaining (of type () -> float): Estimation of remaining time in the current track.reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.self_sync_description (of type () -> string): This output uses the AO device clock as synchronization source when self_sync=true and the device is open.shutdown (of type () -> unit): Shutdown the output.skip (of type () -> unit): Skip to the next track.start (of type () -> unit): Ask the source or output to start.stop (of type () -> unit): Ask the source or output to stop.time (of type () -> float): Get a source's time, based on its assigned clock.Callbacks
on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwiseon_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadataon_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executedon_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_start (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler when output startson_stop (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler when output stopson_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready
output.audio_video
Output a stream with audio and video using the default operator. The input source does not need to be infallible, blank will just be played during failures.
Type:
(?id : string?, ?fallible : bool, ?start : bool, source(audio=pcm('A),
video=canvas('a), 'b)) -> unit
Arguments
id(of typestring?, which defaults tonull): Force the value of the source ID.fallible(of typebool, which defaults totrue): Allow the child source to fail, in which case the output will be (temporarily) stopped.start(of typebool, which defaults totrue): Automatically start outputting whenever possible. Iftrue, an infallible (normal) output will start outputting as soon as it is created, and a fallible output will (re)start as soon as its source becomes available for streaming.(unlabeled)(of typesource(audio=pcm('A), video=canvas('a), 'b)): Source to play.
output.dummy
Dummy output: computes the stream, without actually using it.
Type:
(?id : string?, ?fallible : bool, ?register_telnet : bool, ?start : bool,
source('a)) -> unit
Arguments
id(of typestring?, which defaults tonull): Force the value of the source ID.fallible(of typebool, which defaults tofalse): Allow the child source to fail, in which case the output will be stopped until the source is available again.register_telnet(of typebool, which defaults totrue): Register telnet commands for this output.start(of typebool, which defaults totrue): Start output as soon as it is available.(unlabeled)(of typesource('a))
Methods
buffered(of type() -> [string * float]): Length of buffered data.clock(of typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): Indicate if a source may fail, i.e. may not be ready to stream.generate_frame(of type() -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such ason_frame!id(of type() -> string): Identifier of the source.insert_metadata(of type(?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata ifnew_trackistrue.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.http.is_ready(of type() -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.is_started(of type() -> bool):trueif the output or source is started.is_up(of type() -> bool): Indicate that the source can be asked to produce some data at any time. This istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.last_metadata(of type() -> [string * string]?): Return the last metadata from the source.log(of type{level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from1to5.register_command(of type(?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.remaining(of type() -> float): Estimation of remaining time in the current track.reset_last_metadata_on_track(of type(() -> bool).{set : (bool) -> unit}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.seek(of type(float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).self_sync(of type() -> bool): Is the source currently controlling its own real-time loop.self_sync_description(of type() -> string)shutdown(of type() -> unit): Shutdown the output.skip(of type() -> unit): Skip to the next track.start(of type() -> unit): Ask the source or output to start.stop(of type() -> unit): Ask the source or output to stop.time(of type() -> float): Get a source's time, based on its assigned clock.
Callbacks
on_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_frame_checksum(of type(?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).on_metadata(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_start(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when output startson_stop(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when output stopson_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_wake_up(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready
output.external
Send the stream to a process' standard input.
Type:
(?id : string?, ?export_cover_metadata : bool, ?fallible : bool,
?flush : bool, ?register_telnet : bool, ?reopen_delay : {float},
?reopen_on_error : ((error?) -> float?),
?reopen_on_metadata : (([string * string]) -> bool),
?reopen_when : (() -> bool), ?self_sync : bool, ?start : bool, format('a),
{string}, source('a)) -> unit
Arguments
id(of typestring?, which defaults tonull): Force the value of the source ID.export_cover_metadata(of typebool, which defaults totrue): Export cover metadata.fallible(of typebool, which defaults tofalse): Allow the child source to fail, in which case the output will be stopped until the source is available again.flush(of typebool, which defaults tofalse): Perform a flush after each write.register_telnet(of typebool, which defaults totrue): Register telnet commands for this output.reopen_delay(of type{float}, which defaults to120.0): Prevent re-opening within that delay, in seconds. Only applies toreopen_when.reopen_on_error(of type(error?) -> float?, which defaults tofun (_) -> null): Callback called when there is an error. Error is raised when returningnull. Otherwise, the file is reopened after the returned value, in seconds.reopen_on_metadata(of type([string * string]) -> bool, which defaults tofun (_) -> false): Callback called on metadata. If returned value istrue, the file is reopened.reopen_when(of type() -> bool, which defaults to{false}): Callback called on each frame. If returned value istrue, the file is reopened.self_sync(of typebool, which defaults tofalse): Set totrueif the process is expected to control the output's latency. Typical example:ffmpegwith the-recommand-line option.start(of typebool, which defaults totrue): Start output as soon as it is available.(unlabeled)(of typeformat('a)): Process to pipe data to.(unlabeled)(of type{string}): Encoding format.(unlabeled)(of typesource('a))
Methods
buffered(of type() -> [string * float]): Length of buffered data.clock(of typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): Indicate if a source may fail, i.e. may not be ready to stream.generate_frame(of type() -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such ason_frame!id(of type() -> string): Identifier of the source.insert_metadata(of type(?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata ifnew_trackistrue.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.http.is_ready(of type() -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.is_started(of type() -> bool):trueif the output or source is started.is_up(of type() -> bool): Indicate that the source can be asked to produce some data at any time. This istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.last_metadata(of type() -> [string * string]?): Return the last metadata from the source.log(of type{level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from1to5.register_command(of type(?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.remaining(of type() -> float): Estimation of remaining time in the current track.reopen(of type() -> unit): Reopen the output pipe. The actual reopening happens the next time the output has some data to output.reset_last_metadata_on_track(of type(() -> bool).{set : (bool) -> unit}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.seek(of type(float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).self_sync(of type() -> bool): Is the source currently controlling its own real-time loop.self_sync_description(of type() -> string):shutdown(of type() -> unit): Shutdown the output.skip(of type() -> unit): Skip to the next track.start(of type() -> unit): Ask the source or output to start.stop(of type() -> unit): Ask the source or output to stop.time(of type() -> float): Get a source's time, based on its assigned clock.
Callbacks
on_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_frame_checksum(of type(?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).on_metadata(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_reopen(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when the output is reopened.on_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_wake_up(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready
output.file
Output the source stream to a file.
Type:
(?id : string?, ?append : bool, ?dir_perm : int,
?export_cover_metadata : bool, ?fallible : bool, ?flush : bool,
?on_close : ((string) -> unit), ?perm : int, ?register_telnet : bool,
?reopen_delay : {float}, ?reopen_on_error : ((error?) -> float?),
?reopen_on_metadata : (([string * string]) -> bool),
?reopen_when : (() -> bool), ?start : bool, format('a), {string},
source('a)) -> unit
Arguments
id(of typestring?, which defaults tonull): Force the value of the source ID.append(of typebool, which defaults tofalse): Do not truncate but append in the file if it exists.dir_perm(of typeint, which defaults to511): Permission of the directories if some have to be created, up to umask. Although you can enter values in octal notation (0oXXX) they will be displayed in decimal (for instance, 0o777 = 7×8^2 + 7×8 + 7 = 511).export_cover_metadata(of typebool, which defaults totrue): Export cover metadata.fallible(of typebool, which defaults tofalse): Allow the child source to fail, in which case the output will be stopped until the source is available again.flush(of typebool, which defaults tofalse): Perform a flush after each write.on_close(of type(string) -> unit, which defaults tofun (_) -> ()): This function will be called for each file, after that it is finished and closed. The filename will be passed as argument.perm(of typeint, which defaults to438): Permission of the file if it has to be created, up to umask. You can and should write this number in octal notation: 0oXXX. The default value is however displayed in decimal (0o666 = 6×8^2 + 6×8 + 6 = 438).register_telnet(of typebool, which defaults totrue): Register telnet commands for this output.reopen_delay(of type{float}, which defaults to120.0): Prevent re-opening within that delay, in seconds. Only applies toreopen_when.reopen_on_error(of type(error?) -> float?, which defaults tofun (_) -> null): Callback called when there is an error. Error is raised when returningnull. Otherwise, the file is reopened after the returned value, in seconds.reopen_on_metadata(of type([string * string]) -> bool, which defaults tofun (_) -> false): Callback called on metadata. If returned value istrue, the file is reopened.reopen_when(of type() -> bool, which defaults to{false}): Callback called on each frame. If returned value istrue, the file is reopened.start(of typebool, which defaults totrue): Start output as soon as it is available.(unlabeled)(of typeformat('a)): Encoding format.(unlabeled)(of type{string}): Filename where to output the stream.(unlabeled)(of typesource('a))
Methods
buffered(of type() -> [string * float]): Length of buffered data.clock(of typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): Indicate if a source may fail, i.e. may not be ready to stream.generate_frame(of type() -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such ason_frame!id(of type() -> string): Identifier of the source.insert_metadata(of type(?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata ifnew_trackistrue.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.http.is_ready(of type() -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.is_started(of type() -> bool):trueif the output or source is started.is_up(of type() -> bool): Indicate that the source can be asked to produce some data at any time. This istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.last_metadata(of type() -> [string * string]?): Return the last metadata from the source.log(of type{level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from1to5.register_command(of type(?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.remaining(of type() -> float): Estimation of remaining time in the current track.reopen(of type() -> unit): Reopen the output pipe. The actual reopening happens the next time the output has some data to output.reset_last_metadata_on_track(of type(() -> bool).{set : (bool) -> unit}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.seek(of type(float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).self_sync(of type() -> bool): Is the source currently controlling its own real-time loop.self_sync_description(of type() -> string)shutdown(of type() -> unit): Shutdown the output.skip(of type() -> unit): Skip to the next track.start(of type() -> unit): Ask the source or output to start.stop(of type() -> unit): Ask the source or output to stop.time(of type() -> float): Get a source's time, based on its assigned clock.
Callbacks
on_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_frame_checksum(of type(?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).on_metadata(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_reopen(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when the output is reopened.on_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_start(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when output startson_stop(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when output stopson_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_wake_up(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready
output.file.hls
Output the source stream to an HTTP live stream served from a local directory.
Type:
(?id : string?, ?dir_perm : int, ?extra_tags : [string], ?fallible : bool,
?perm : int, ?persist_at : string?, ?playlist : string, ?prefix : string,
?register_telnet : bool, ?segment_duration : float,
?segment_name : ((
{
duration : float,
extname : string,
position : int,
stream_name : string,
ticks : int
}) -> string),
?segments : int, ?segments_overhead : int?, ?start : bool,
?strict_persist : bool, ?temp_dir : string?,
?main_playlist_writer : ((extra_tags : [string], prefix : string,
version : int,
[string
.{
bandwidth : int,
codecs : string,
video_size? : int * int
}]) -> string?)?,
string,
[string * format('a)
.{
bandwidth? : int,
codecs? : string,
extname? : string,
extra_tags? : [string],
id3? : bool,
id3_version? : int,
replay_id3? : bool,
video_size? : int * int
}],
source('a)) -> unit
Arguments
id(of typestring?, which defaults tonull): Force the value of the source ID.dir_perm(of typeint, which defaults to511): Permission of the directories if some have to be created, up to umask.extra_tags(of type[string], which defaults to[]): Extra tags to insert into the main playlist.fallible(of typebool, which defaults tofalse): Allow the child source to fail, in which case the output will be stopped until the source is available again.perm(of typeint, which defaults to438): Permission of the created files, up to umask.persist_at(of typestring?, which defaults tonull): Location of the configuration file used to restart the output. Relative paths are assumed to be with regard to the directory for generated file.playlist(of typestring, which defaults to"stream.m3u8"): Playlist name (m3u8 extension is recommended).prefix(of typestring, which defaults to""): Prefix for each files in playlists.register_telnet(of typebool, which defaults totrue): Register telnet commands for this output.segment_duration(of typefloat, which defaults to10.0): Segment duration (in seconds).segment_name(of type( { duration : float, extname : string, position : int, stream_name : string, ticks : int }) -> string, which defaults to<fun>): Segment name. Default:fun (metadata) -> "#{metadata.stream_name}_#{metadata.position}.#{metadata.extname}"segments(of typeint, which defaults to10): Number of segments per playlist.segments_overhead(of typeint?, which defaults to5): Number of segments to keep after they have been featured in the live playlist. Set tonullto disable.start(of typebool, which defaults totrue): Start output as soon as it is available.strict_persist(of typebool, which defaults tofalse): Fail if an invalid saved state exists.temp_dir(of typestring?, which defaults tonull): Temporary directory used for writing files. This should be in the same partition or device as the final directory to guarantee atomic file operations. Use the same directory as the HLS files ifnull.main_playlist_writer(of type((extra_tags : [string], prefix : string, version : int, [string.{bandwidth : int, codecs : string, video_size? : int * int}]) -> string?)?, which defaults to<fun>): Main playlist writer. Main playlist writing is disabled whennullor when returningnull.(unlabeled)(of typestring): List of specifications for each stream: (name, format).(unlabeled)(of type[string * format('a) .{ bandwidth? : int, codecs? : string, extname? : string, extra_tags? : [string], id3? : bool, id3_version? : int, replay_id3? : bool, video_size? : int * int }]): Directory for generated files.(unlabeled)(of typesource('a))
Methods
buffered(of type() -> [string * float]): Length of buffered data.clock(of typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): Indicate if a source may fail, i.e. may not be ready to stream.generate_frame(of type() -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such ason_frame!id(of type() -> string): Identifier of the source.insert_metadata(of type(?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata ifnew_trackistrue.insert_tag(of type(string) -> unit): Insert the same tag into all the streamsis_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.http.is_ready(of type() -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.is_started(of type() -> bool):trueif the output or source is started.is_up(of type() -> bool): Indicate that the source can be asked to produce some data at any time. This istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.last_metadata(of type() -> [string * string]?): Return the last metadata from the source.log(of type{level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from1to5.register_command(of type(?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.remaining(of type() -> float): Estimation of remaining time in the current track.reset_last_metadata_on_track(of type(() -> bool).{set : (bool) -> unit}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.seek(of type(float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).self_sync(of type() -> bool): Is the source currently controlling its own real-time loop.self_sync_description(of type() -> string):shutdown(of type() -> unit): Shutdown the output.skip(of type() -> unit): Skip to the next track.start(of type() -> unit): Ask the source or output to start.stop(of type() -> unit): Ask the source or output to stop.streams(of type() -> [ { bandwidth : int, codecs : string, discontinuity_count : int, encoder : format('A), extname : string, extra_tags : [string], id3_enabled : bool, insert_tag : (string) -> unit, name : string, replay_id3 : bool, video_size : {height : int, width : int }? }]): Output streamstime(of type() -> float): Get a source's time, based on its assigned clock.
Callbacks
on_file_change(of type(synchronous : bool, (({path : string, state : string}) -> unit)) -> unit): Call a given handler when a file changes.stateis one of:"created","updated"or"deleted",pathis the full file path. Typical use: sync file with a CDNon_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_frame_checksum(of type(?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).on_metadata(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_start(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when output startson_stop(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when output stopson_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_wake_up(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready
output.harbor
Encode and output the stream using the harbor server.
Type:
(?id : string?, ?auth : ((address : string, string, string) -> bool)?,
?buffer : int, ?burst : int, ?chunk : int, ?dumpfile : string?,
?encoding : string, ?fallible : bool, ?format : string,
?headers : [string * string], ?metaint : int, mount : string,
?password : string?, ?port : int, ?register_telnet : bool, ?start : bool,
?timeout : float, ?transport : http_transport, ?url : string?,
?user : string?, format('a), source('a)) -> unit
Arguments
id(of typestring?, which defaults tonull): Force the value of the source ID.auth(of type((address : string, string, string) -> bool)?, which defaults tonull): Authentication function.f(~address,login,password)returnstrueif the user should be granted access for this login. When defined,userandpasswordarguments are not taken in account.buffer(of typeint, which defaults to327675): Maximum buffer per-client.burst(of typeint, which defaults to65534): Initial burst of data sent to the client.chunk(of typeint, which defaults to1024): Send data to clients using chunks of at least this length.dumpfile(of typestring?, which defaults tonull): Dump stream to file, for debugging purpose. Disabled if null.encoding(of typestring, which defaults to""): Encoding used to send metadata. If empty, defaults to "UTF-8"fallible(of typebool, which defaults tofalse): Allow the child source to fail, in which case the output will be stopped until the source is available again.format(of typestring, which defaults to""): Format, e.g. "audio/ogg". When empty, the encoder is used to guess.headers(of type[string * string], which defaults to[]): Additional headers.metaint(of typeint, which defaults to8192): Interval used to send ICY metadatamount(of typestring)password(of typestring?, which defaults tonull): Password for client connection. Ausermust also be set. We check for this password is checked unless anauthfunction is defined, which is used in this case.port(of typeint, which defaults to8000)register_telnet(of typebool, which defaults totrue): Register telnet commands for this output.start(of typebool, which defaults totrue): Start output as soon as it is available.timeout(of typefloat, which defaults to30.0): Timeout for network operations (in seconds).transport(of typehttp_transport, which defaults to<unix_transport>): Http transport. Usehttp.transport.sslorhttp.transport.secure_transport, when available, to enable HTTPS outputurl(of typestring?, which defaults tonull)user(of typestring?, which defaults tonull): User for client connection. You also need to setup apassword.(unlabeled)(of typeformat('a)): Encoding format.(unlabeled)(of typesource('a))
Methods
buffered(of type() -> [string * float]): Length of buffered data.clock(of typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): Indicate if a source may fail, i.e. may not be ready to stream.generate_frame(of type() -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such ason_frame!id(of type() -> string): Identifier of the source.insert_metadata(of type(?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata ifnew_trackistrue.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.http.is_ready(of type() -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.is_started(of type() -> bool):trueif the output or source is started.is_up(of type() -> bool): Indicate that the source can be asked to produce some data at any time. This istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.last_metadata(of type() -> [string * string]?): Return the last metadata from the source.log(of type{level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from1to5.register_command(of type(?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.remaining(of type() -> float): Estimation of remaining time in the current track.reset_last_metadata_on_track(of type(() -> bool).{set : (bool) -> unit}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.seek(of type(float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).self_sync(of type() -> bool): Is the source currently controlling its own real-time loop.self_sync_description(of type() -> string)shutdown(of type() -> unit): Shutdown the output.skip(of type() -> unit): Skip to the next track.start(of type() -> unit): Ask the source or output to start.stop(of type() -> unit): Ask the source or output to stop.time(of type() -> float): Get a source's time, based on its assigned clock.
Callbacks
on_connect(of type(synchronous : bool, (({headers : [string * string], ip : string, protocol : string, uri : string }) -> unit)) -> unit): Call a given handler when connection is established (takes headers, connection uri, protocol and client's IP as arguments).on_disconnect(of type(synchronous : bool, ((string) -> unit)) -> unit): Call a given handler when a source is disconnected.on_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_frame_checksum(of type(?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).on_metadata(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_start(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when output startson_stop(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when output stopson_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_wake_up(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready
output.harbor.hls
Output the source stream to an HTTP live stream served from the harbor HTTP server.
Type:
(?id : string?, ?dir_perm : int, ?extra_tags : [string], ?fallible : bool,
?perm : int, ?persist_at : string?, ?playlist : string, ?prefix : string,
?register_telnet : bool, ?segment_duration : float, ?segments : int,
?segments_overhead : int?, ?start : bool, ?strict_persist : bool,
?temp_dir : string?,
?main_playlist_writer : ((extra_tags : [string], prefix : string,
version : int,
[string
.{
bandwidth : int,
codecs : string,
video_size? : int * int
}]) -> string?)?,
?segment_name : ((
{
duration : float,
extname : string,
position : int,
stream_name : string,
ticks : int
}) -> string),
?headers : [string * string], ?port : int, ?path : string,
?tmpdir : string?, ?transport : http_transport
.{default_port : int, name : string, protocol : string},
[string * format('a)], source('a)) -> unit
Arguments
id(of typestring?, which defaults tonull): Force the value of the source ID.dir_perm(of typeint, which defaults to511): Permission of the directories if some have to be created, up to umask.extra_tags(of type[string], which defaults to[]): Extra tags to insert into the main playlist.fallible(of typebool, which defaults tofalse): Allow the child source to fail, in which case the output will be stopped until the source is available again.perm(of typeint, which defaults to438): Permission of the created files, up to umask.persist_at(of typestring?, which defaults tonull): Location of the configuration file used to restart the output. Relative paths are assumed to be with regard to the directory for generated file.playlist(of typestring, which defaults to"stream.m3u8"): Playlist name (m3u8 extension is recommended).prefix(of typestring, which defaults to""): Prefix for each files in playlists.register_telnet(of typebool, which defaults totrue): Register telnet commands for this output.segment_duration(of typefloat, which defaults to10.0): Segment duration (in seconds).segments(of typeint, which defaults to10): Number of segments per playlist.segments_overhead(of typeint?, which defaults to5): Number of segments to keep after they have been featured in the live playlist. Set tonullto disable.start(of typebool, which defaults totrue): Start output as soon as it is available.strict_persist(of typebool, which defaults tofalse): Fail if an invalid saved state exists.temp_dir(of typestring?, which defaults tonull): Temporary directory used for writing files. This should be in the same partition or device as the final directory to guarantee atomic file operations. Use the same directory as the HLS files ifnull.main_playlist_writer(of type((extra_tags : [string], prefix : string, version : int, [string.{bandwidth : int, codecs : string, video_size? : int * int}]) -> string?)?, which defaults to<fun>): Main playlist writer. Main playlist writing is disabled whennullor when returningnull.segment_name(of type( { duration : float, extname : string, position : int, stream_name : string, ticks : int }) -> string, which defaults to<fun>): Segment name. Default:fun (metadata) -> "#{metadata.stream_name}_#{metadata.position}.#{metadata.extname}"headers(of type[string * string], which defaults to[("Access-Control-Allow-Origin", "*")]): Default response headers.port(of typeint, which defaults to8000): Port for incoming harbor (http) connections.path(of typestring, which defaults to"/"): Base path for hls URIs.tmpdir(of typestring?, which defaults tonull): Directory for generated files.transport(of typehttp_transport.{default_port : int, name : string, protocol : string}, which defaults to<unix_transport>.{default_port=80, protocol="http", name="unix"}): Http transport. Usehttp.transport.sslorhttp.transport.secure_transport, when available, to enable HTTPS output(unlabeled)(of type[string * format('a)]): List of specifications for each stream: (name, format).(unlabeled)(of typesource('a))
Methods
buffered(of type() -> [string * float]): Length of buffered data.clock(of typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): Indicate if a source may fail, i.e. may not be ready to stream.generate_frame(of type() -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such ason_frame!id(of type() -> string): Identifier of the source.insert_metadata(of type(?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata ifnew_trackistrue.insert_tag(of type(string) -> unit): Insert the same tag into all the streamsis_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.http.is_ready(of type() -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.is_started(of type() -> bool):trueif the output or source is started.is_up(of type() -> bool): Indicate that the source can be asked to produce some data at any time. This istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.last_metadata(of type() -> [string * string]?): Return the last metadata from the source.log(of type{level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from1to5.register_command(of type(?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.remaining(of type() -> float): Estimation of remaining time in the current track.reset_last_metadata_on_track(of type(() -> bool).{set : (bool) -> unit}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.seek(of type(float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).self_sync(of type() -> bool): Is the source currently controlling its own real-time loop.self_sync_description(of type() -> string):shutdown(of type() -> unit): Shutdown the output.skip(of type() -> unit): Skip to the next track.start(of type() -> unit): Ask the source or output to start.stop(of type() -> unit): Ask the source or output to stop.streams(of type() -> [ { bandwidth : int, codecs : string, discontinuity_count : int, encoder : format('A), extname : string, extra_tags : [string], id3_enabled : bool, insert_tag : (string) -> unit, name : string, replay_id3 : bool, video_size : {height : int, width : int }? }]): Output streamstime(of type() -> float): Get a source's time, based on its assigned clock.
Callbacks
on_file_change(of type(synchronous : bool, (({path : string, state : string}) -> unit)) -> unit): Call a given handler when a file changes.stateis one of:"created","updated"or"deleted",pathis the full file path. Typical use: sync file with a CDNon_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_frame_checksum(of type(?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).on_metadata(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_start(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when output startson_stop(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when output stopson_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_wake_up(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready
output.icecast
Encode and output the stream to an icecast server.
Type:
(?id : string?, ?chunked : bool, ?connection_timeout : float,
?description : string?, ?dumpfile : string?, ?encoding : string?,
?fallible : bool, ?format : string, ?genre : string?,
?headers : [string * string], ?host : string, ?icy_metadata : [string],
?icy_song : (([string * string]) -> string?), ?method : string,
mount : string, ?name : string?, ?password : string, ?port : int,
?prefer_address : string?, ?public : bool, ?register_telnet : bool,
?send_icy_metadata : bool?, ?send_last_metadata_on_connect : bool,
?start : bool, ?timeout : float, ?transport : http_transport,
?url : string?, ?user : string?, format('a), source('a)) -> unit
Arguments
id(of typestring?, which defaults tonull): Force the value of the source ID.chunked(of typebool, which defaults tofalse): Used chunked transfer with the 'http(s)' protocol.connection_timeout(of typefloat, which defaults to5.0): Timeout for establishing network connections (disabled is negative).description(of typestring?, which defaults tonull)dumpfile(of typestring?, which defaults tonull): Dump stream to file, for debugging purpose. Disabled if null.encoding(of typestring?, which defaults tonull): Encoding used to send metadata and stream info (name, genre and description). If null, defaults to "UTF-8".fallible(of typebool, which defaults tofalse): Allow the child source to fail, in which case the output will be stopped until the source is available again.format(of typestring, which defaults to""): Format, e.g. "audio/ogg". When empty, the encoder is used to guess.genre(of typestring?, which defaults tonull)headers(of type[string * string], which defaults to[("User-Agent", "Liquidsoap/2.4.6 (Unix; OCaml 4.14.2)")]): Additional headers.host(of typestring, which defaults to"localhost")icy_metadata(of type[string], which defaults to["song", "title", "artist", "genre", "date", "album", "tracknum", "comment", "dj", "next"]): List of metadata to send with ICY metadata updateicy_song(of type([string * string]) -> string?, which defaults to<fun>): Function used to generate the default icy "song" metadata. Metadata is not added when returningnull. Default:$(artist) - $(title)if both are defined, otherwiseartistortitleif either is defined ornull.method(of typestring, which defaults to"source"): Method to use with the 'http(s)' protocol. One of: 'source', 'put' or 'post'.mount(of typestring): Source mount point.name(of typestring?, which defaults tonull)password(of typestring, which defaults to"hackme")port(of typeint, which defaults to8000)prefer_address(of typestring?, which defaults tonull): Preferred address type when resolving hostnames. One of:"system","ipv4"or"ipv6". Defaults tosettings.icecast.prefer_addresswhennull.public(of typebool, which defaults totrue)register_telnet(of typebool, which defaults totrue): Register telnet commands for this output.send_icy_metadata(of typebool?, which defaults tonull): Send new metadata using the ICY protocol. Guessed whennullsend_last_metadata_on_connect(of typebool, which defaults totrue): Send the source's last metadata when connecting to the remote icecast server.start(of typebool, which defaults totrue): Start output as soon as it is available.timeout(of typefloat, which defaults to30.0): Timeout for network read and write.transport(of typehttp_transport, which defaults to<unix_transport>): Http transport. Usehttp.transport.sslorhttp.transport.secure_transport, when available, to enable HTTPS outputurl(of typestring?, which defaults tonull)user(of typestring?, which defaults tonull): User for shout source connection. Defaults to "source" for icecast connections. Useful only in special cases, like with per-mountpoint users.(unlabeled)(of typeformat('a)): Encoding format.(unlabeled)(of typesource('a)): The source to output
Methods
buffered(of type() -> [string * float]): Length of buffered data.clock(of typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): Indicate if a source may fail, i.e. may not be ready to stream.generate_frame(of type() -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such ason_frame!id(of type() -> string): Identifier of the source.insert_metadata(of type(?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata ifnew_trackistrue.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.http.is_ready(of type() -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.is_started(of type() -> bool):trueif the output or source is started.is_up(of type() -> bool): Indicate that the source can be asked to produce some data at any time. This istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.last_metadata(of type() -> [string * string]?): Return the last metadata from the source.log(of type{level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from1to5.register_command(of type(?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.remaining(of type() -> float): Estimation of remaining time in the current track.reset_last_metadata_on_track(of type(() -> bool).{set : (bool) -> unit}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.seek(of type(float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).self_sync(of type() -> bool): Is the source currently controlling its own real-time loop.self_sync_description(of type() -> string):shutdown(of type() -> unit): Shutdown the output.skip(of type() -> unit): Skip to the next track.start(of type() -> unit): Ask the source or output to start.stop(of type() -> unit): Ask the source or output to stop.time(of type() -> float): Get a source's time, based on its assigned clock.
Callbacks
on_connect(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when connection is established.on_disconnect(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when connection stops.on_error(of type(synchronous : bool, ((restart_in : ((float?) -> unit), error) -> unit)) -> unit): Call a given handler when an error happens. The callback receives the error that occurred and a restart callback. If restart callback is executed with a positive float value, connection will be tried again after this amount of time (in seconds). If executed with a negative value, an error is raised. If executed withnull, connection is not attempted again and no errors are raised. There can only be one single callback registered for this at a time. Every secondary registration replaces the previous one.on_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_frame_checksum(of type(?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).on_metadata(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_start(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when output startson_stop(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when output stopson_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_wake_up(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready
output.jack
Output stream to jack.
Type:
(?id : string?, ?fallible : bool, ?register_telnet : bool, ?server : string,
?start : bool, source(audio=pcm('a), 'b)) -> unit
Arguments
id(of typestring?, which defaults tonull): Force the value of the source ID.fallible(of typebool, which defaults tofalse): Allow the child source to fail, in which case the output will be stopped until the source is available again.register_telnet(of typebool, which defaults totrue): Register telnet commands for this output.server(of typestring, which defaults to""): Jack server to connect to.start(of typebool, which defaults totrue): Start output as soon as it is available.(unlabeled)(of typesource(audio=pcm('a), 'b))
Methods
buffered(of type() -> [string * float]): Length of buffered data.clock(of typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): Indicate if a source may fail, i.e. may not be ready to stream.generate_frame(of type() -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such ason_frame!id(of type() -> string): Identifier of the source.insert_metadata(of type(?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata ifnew_trackistrue.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.http.is_ready(of type() -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.is_started(of type() -> bool):trueif the output or source is started.is_up(of type() -> bool): Indicate that the source can be asked to produce some data at any time. This istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.last_metadata(of type() -> [string * string]?): Return the last metadata from the source.log(of type{level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from1to5.register_command(of type(?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.remaining(of type() -> float): Estimation of remaining time in the current track.reset_last_metadata_on_track(of type(() -> bool).{set : (bool) -> unit}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.seek(of type(float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).self_sync(of type() -> bool): Is the source currently controlling its own real-time loop.self_sync_description(of type() -> string)shutdown(of type() -> unit): Shutdown the output.skip(of type() -> unit): Skip to the next track.start(of type() -> unit): Ask the source or output to start.stop(of type() -> unit): Ask the source or output to stop.time(of type() -> float): Get a source's time, based on its assigned clock.
Callbacks
on_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_frame_checksum(of type(?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).on_metadata(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_start(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when output startson_stop(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when output stopson_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_wake_up(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready
output.ndi
Output stream to NDI
Type:
(?id : string?, ?fallible : bool, ?groups : string?, library_file : string,
?name : string?, ?register_telnet : bool, ?self_sync : bool, ?start : bool,
format('a), source('a)) -> unit
Synchronization:
This output uses the NDI sender clock as synchronization source when self_sync=true and the sender is active.Arguments
id (of type string?, which defaults to null): Force the value of the source ID.fallible (of type bool, which defaults to false): Allow the child source to fail, in which case the output will be stopped until the source is available again.groups (of type string?, which defaults to null): NDI sender groupslibrary_file (of type string): Path to the shared library file.name (of type string?, which defaults to null): NDI sender nameregister_telnet (of type bool, which defaults to true): Register telnet commands for this output.self_sync (of type bool, which defaults to false): Use the dedicated NDI clock.start (of type bool, which defaults to true): Start output as soon as it is available.(unlabeled) (of type format('a)): Encoding format. Only the %ndi encoder is allowed here!(unlabeled) (of type source('a))Methods
buffered (of type () -> [string * float]): Length of buffered data.clock (of type clock): The source's clockduration (of type () -> float): Estimation of the duration of the current track.elapsed (of type () -> float): Elapsed time in the current track.fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!id (of type () -> string): Identifier of the source.insert_metadata (of type (?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true.is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.is_started (of type () -> bool): true if the output or source is started.is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.last_metadata (of type () -> [string * string]?): Return the last metadata from the source.log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.remaining (of type () -> float): Estimation of remaining time in the current track.reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.self_sync_description (of type () -> string): This output uses the NDI sender clock as synchronization source when self_sync=true and the sender is active.shutdown (of type () -> unit): Shutdown the output.skip (of type () -> unit): Skip to the next track.start (of type () -> unit): Ask the source or output to start.stop (of type () -> unit): Ask the source or output to stop.time (of type () -> float): Get a source's time, based on its assigned clock.Callbacks
on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwiseon_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadataon_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executedon_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_start (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler when output startson_stop (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler when output stopson_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready
This function is experimental.
output.oss
Output the source's stream to an OSS output device.
Type:
(?id : string?, ?device : string, ?fallible : bool, ?register_telnet : bool,
?self_sync : bool, ?start : bool, source(audio=pcm('a), 'b)) -> unit
Synchronization:
This output uses the OSS hardware clock as synchronization source when self_sync=true and the device is open.Arguments
id (of type string?, which defaults to null): Force the value of the source ID.device (of type string, which defaults to "/dev/dsp"): OSS device to use.fallible (of type bool, which defaults to false): Allow the child source to fail, in which case the output will be stopped until the source is available again.register_telnet (of type bool, which defaults to true): Register telnet commands for this output.self_sync (of type bool, which defaults to true): Mark the source as being synchronized by the OSS driver.start (of type bool, which defaults to true): Start output as soon as it is available.(unlabeled) (of type source(audio=pcm('a), 'b))Methods
buffered (of type () -> [string * float]): Length of buffered data.clock (of type clock): The source's clockduration (of type () -> float): Estimation of the duration of the current track.elapsed (of type () -> float): Elapsed time in the current track.fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!id (of type () -> string): Identifier of the source.insert_metadata (of type (?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true.is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.is_started (of type () -> bool): true if the output or source is started.is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.last_metadata (of type () -> [string * string]?): Return the last metadata from the source.log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.remaining (of type () -> float): Estimation of remaining time in the current track.reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.self_sync_description (of type () -> string): This output uses the OSS hardware clock as synchronization source when self_sync=true and the device is open.shutdown (of type () -> unit): Shutdown the output.skip (of type () -> unit): Skip to the next track.start (of type () -> unit): Ask the source or output to start.stop (of type () -> unit): Ask the source or output to stop.time (of type () -> float): Get a source's time, based on its assigned clock.Callbacks
on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwiseon_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadataon_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executedon_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_start (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler when output startson_stop (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler when output stopson_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready
output.portaudio
Output the source's stream to a portaudio output device.
Type:
(?id : string?, ?buflen : int, ?device_id : int?, ?device_name : string?,
?fallible : bool, ?latency : float?, ?register_telnet : bool,
?self_sync : bool, ?start : bool, source(audio=pcm('a), 'b)) -> unit
Synchronization:
This output uses the PortAudio clock as synchronization source when self_sync=true and the stream is open.Arguments
id (of type string?, which defaults to null): Force the value of the source ID.buflen (of type int, which defaults to 256): Length of a buffer in samples.device_id (of type int?, which defaults to null): Device ID. Uses default device if null.device_name (of type string?, which defaults to null): Device name.fallible (of type bool, which defaults to false): Allow the child source to fail, in which case the output will be stopped until the source is available again.latency (of type float?, which defaults to null): Device latency. Only used when specifying device ID.register_telnet (of type bool, which defaults to true): Register telnet commands for this output.self_sync (of type bool, which defaults to true): Mark the source as being synchronized by the portaudio driver.start (of type bool, which defaults to true): Start output as soon as it is available.(unlabeled) (of type source(audio=pcm('a), 'b))Methods
buffered (of type () -> [string * float]): Length of buffered data.clock (of type clock): The source's clockduration (of type () -> float): Estimation of the duration of the current track.elapsed (of type () -> float): Elapsed time in the current track.fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!id (of type () -> string): Identifier of the source.insert_metadata (of type (?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true.is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.is_started (of type () -> bool): true if the output or source is started.is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.last_metadata (of type () -> [string * string]?): Return the last metadata from the source.log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.remaining (of type () -> float): Estimation of remaining time in the current track.reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.self_sync_description (of type () -> string): This output uses the PortAudio clock as synchronization source when self_sync=true and the stream is open.shutdown (of type () -> unit): Shutdown the output.skip (of type () -> unit): Skip to the next track.start (of type () -> unit): Ask the source or output to start.stop (of type () -> unit): Ask the source or output to stop.time (of type () -> float): Get a source's time, based on its assigned clock.Callbacks
on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwiseon_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadataon_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executedon_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_start (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler when output startson_stop (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler when output stopson_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready
output.pulseaudio
Output the source's stream to a pulseaudio output device.
Type:
(?id : string?, ?client : string, ?device : string?, ?fallible : bool,
?on_error : ((string) -> unit), ?register_telnet : bool,
?retry_delay : float, ?self_sync : bool, ?start : bool,
source(audio=pcm('a), 'b)) -> unit
Synchronization:
This output uses the PulseAudio clock as synchronization source when self_sync=true and the stream is open.Arguments
id (of type string?, which defaults to null): Force the value of the source ID.client (of type string, which defaults to "liquidsoap")device (of type string?, which defaults to null): Device to use. Uses default if set to null.fallible (of type bool, which defaults to false): Allow the child source to fail, in which case the output will be stopped until the source is available again.on_error (of type (string) -> unit, which defaults to fun (_) -> ()): Function executed when an operation with the pulseaudio server returns an error.register_telnet (of type bool, which defaults to true): Register telnet commands for this output.retry_delay (of type float, which defaults to 1.0): When fallible, time to wait before trying to connect again.self_sync (of type bool, which defaults to true): Mark the source as being synchronized by the pulseaudio driver.start (of type bool, which defaults to true): Start output as soon as it is available.(unlabeled) (of type source(audio=pcm('a), 'b))Methods
buffered (of type () -> [string * float]): Length of buffered data.clock (of type clock): The source's clockduration (of type () -> float): Estimation of the duration of the current track.elapsed (of type () -> float): Elapsed time in the current track.fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!id (of type () -> string): Identifier of the source.insert_metadata (of type (?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true.is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.is_started (of type () -> bool): true if the output or source is started.is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.last_metadata (of type () -> [string * string]?): Return the last metadata from the source.log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.remaining (of type () -> float): Estimation of remaining time in the current track.reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.self_sync_description (of type () -> string): This output uses the PulseAudio clock as synchronization source when self_sync=true and the stream is open.shutdown (of type () -> unit): Shutdown the output.skip (of type () -> unit): Skip to the next track.start (of type () -> unit): Ask the source or output to start.stop (of type () -> unit): Ask the source or output to stop.time (of type () -> float): Get a source's time, based on its assigned clock.Callbacks
on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwiseon_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadataon_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executedon_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_start (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler when output startson_stop (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler when output stopson_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready
output.sdl
Display a video using SDL.
Type:
(?id : string?, ?fallible : bool, ?register_telnet : bool, ?start : bool,
source(video=canvas('a), 'b)) -> unit
Arguments
id(of typestring?, which defaults tonull): Force the value of the source ID.fallible(of typebool, which defaults tofalse): Allow the child source to fail, in which case the output will be stopped until the source is available again.register_telnet(of typebool, which defaults totrue): Register telnet commands for this output.start(of typebool, which defaults totrue): Start output as soon as it is available.(unlabeled)(of typesource(video=canvas('a), 'b))
Methods
buffered(of type() -> [string * float]): Length of buffered data.clock(of typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): Indicate if a source may fail, i.e. may not be ready to stream.generate_frame(of type() -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such ason_frame!id(of type() -> string): Identifier of the source.insert_metadata(of type(?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata ifnew_trackistrue.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.http.is_ready(of type() -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.is_started(of type() -> bool):trueif the output or source is started.is_up(of type() -> bool): Indicate that the source can be asked to produce some data at any time. This istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.last_metadata(of type() -> [string * string]?): Return the last metadata from the source.log(of type{level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from1to5.register_command(of type(?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.remaining(of type() -> float): Estimation of remaining time in the current track.reset_last_metadata_on_track(of type(() -> bool).{set : (bool) -> unit}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.seek(of type(float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).self_sync(of type() -> bool): Is the source currently controlling its own real-time loop.self_sync_description(of type() -> string)shutdown(of type() -> unit): Shutdown the output.skip(of type() -> unit): Skip to the next track.start(of type() -> unit): Ask the source or output to start.stop(of type() -> unit): Ask the source or output to stop.time(of type() -> float): Get a source's time, based on its assigned clock.
Callbacks
on_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_frame_checksum(of type(?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).on_metadata(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_start(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when output startson_stop(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when output stopson_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_wake_up(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready
output.sdl.has_video
Check whether video output is available with SDL.
Type:
() -> bool
output.shoutcast
Encode and output the stream to a shoutcast server.
Type:
(?id : string?, ?chunked : bool, ?connection_timeout : float,
?dumpfile : string?, ?encoding : string?, ?fallible : bool,
?format : string, ?genre : string?, ?headers : [string * string],
?host : string, ?icy_id : int, ?icy_metadata : [string],
?icy_song : (([string * string]) -> string?), ?name : string?,
?password : string, ?port : int, ?prefer_address : string?, ?public : bool,
?register_telnet : bool, ?send_icy_metadata : bool?,
?send_last_metadata_on_connect : bool, ?start : bool, ?timeout : float,
?transport : http_transport, ?url : string?, ?user : string?,
?icy_reset : bool, ?dj : {string}, ?aim : string, ?icq : string,
?irc : string, format('a), source('a)) -> unit
where 'a is a set of tracks to be muxed into a source
Arguments
id(of typestring?, which defaults tonull): Force the value of the source ID.chunked(of typebool, which defaults tofalse): Used chunked transfer with the 'http(s)' protocol.connection_timeout(of typefloat, which defaults to5.0): Timeout for establishing network connections (disabled is negative).dumpfile(of typestring?, which defaults tonull): Dump stream to file, for debugging purpose. Disabled if null.encoding(of typestring?, which defaults tonull): Encoding used to send metadata and stream info (name, genre and description). If null, defaults to "UTF-8".fallible(of typebool, which defaults tofalse): Allow the child source to fail, in which case the output will be stopped until the source is available again.format(of typestring, which defaults to""): Format, e.g. "audio/ogg". When empty, the encoder is used to guess.genre(of typestring?, which defaults tonull)headers(of type[string * string], which defaults to[("User-Agent", "Liquidsoap/2.4.6 (Unix; OCaml 4.14.2)")]): Additional headers.host(of typestring, which defaults to"localhost")icy_id(of typeint, which defaults to1): Shoutcast source ID.icy_metadata(of type[string], which defaults to["song", "title", "artist", "genre", "date", "album", "tracknum", "comment", "dj", "next"]): List of metadata to send with ICY metadata updateicy_song(of type([string * string]) -> string?, which defaults to<fun>): Function used to generate the default icy "song" metadata. Metadata is not added when returningnull. Default:$(artist) - $(title)if both are defined, otherwiseartistortitleif either is defined ornull.name(of typestring?, which defaults tonull)password(of typestring, which defaults to"hackme")port(of typeint, which defaults to8000)prefer_address(of typestring?, which defaults tonull): Preferred address type when resolving hostnames. One of:"system","ipv4"or"ipv6". Defaults tosettings.icecast.prefer_addresswhennull.public(of typebool, which defaults totrue)register_telnet(of typebool, which defaults totrue): Register telnet commands for this output.send_icy_metadata(of typebool?, which defaults tonull): Send new metadata using the ICY protocol. Guessed whennullsend_last_metadata_on_connect(of typebool, which defaults totrue): Send the source's last metadata when connecting to the remote icecast server.start(of typebool, which defaults totrue): Start output as soon as it is available.timeout(of typefloat, which defaults to30.0): Timeout for network read and write.transport(of typehttp_transport, which defaults to<unix_transport>): Http transport. Usehttp.transport.sslorhttp.transport.secure_transport, when available, to enable HTTPS outputurl(of typestring?, which defaults tonull)user(of typestring?, which defaults tonull): User for shout source connection. Defaults to "source" for icecast connections. Useful only in special cases, like with per-mountpoint users.icy_reset(of typebool, which defaults totrue): Reset shoutcast source buffer upon connecting (necessary for NSV).dj(of type{string}, which defaults to""): Set DJ name.aim(of typestring, which defaults to"")icq(of typestring, which defaults to"")irc(of typestring, which defaults to"")(unlabeled)(of typeformat('a) where 'a is a set of tracks to be muxed into a source): Encoding format. Should be mp3 or AAC(+).(unlabeled)(of typesource('a) where 'a is a set of tracks to be muxed into a source): The source to output
Methods
buffered(of type() -> [string * float]): Length of buffered data.clock(of typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): Indicate if a source may fail, i.e. may not be ready to stream.generate_frame(of type() -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such ason_frame!id(of type() -> string): Identifier of the source.insert_metadata(of type(?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata ifnew_trackistrue.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.http.is_ready(of type() -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.is_started(of type() -> bool):trueif the output or source is started.is_up(of type() -> bool): Indicate that the source can be asked to produce some data at any time. This istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.last_metadata(of type() -> [string * string]?): Return the last metadata from the source.log(of type{level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from1to5.register_command(of type(?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.remaining(of type() -> float): Estimation of remaining time in the current track.reset_last_metadata_on_track(of type(() -> bool).{set : (bool) -> unit}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.seek(of type(float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).self_sync(of type() -> bool): Is the source currently controlling its own real-time loop.self_sync_description(of type() -> string):shutdown(of type() -> unit): Shutdown the output.skip(of type() -> unit): Skip to the next track.start(of type() -> unit): Ask the source or output to start.stop(of type() -> unit): Ask the source or output to stop.time(of type() -> float): Get a source's time, based on its assigned clock.
Callbacks
on_connect(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when connection is established.on_disconnect(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when connection stops.on_error(of type(synchronous : bool, ((restart_in : ((float?) -> unit), error) -> unit)) -> unit): Call a given handler when an error happens. The callback receives the error that occurred and a restart callback. If restart callback is executed with a positive float value, connection will be tried again after this amount of time (in seconds). If executed with a negative value, an error is raised. If executed withnull, connection is not attempted again and no errors are raised. There can only be one single callback registered for this at a time. Every secondary registration replaces the previous one.on_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_frame_checksum(of type(?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).on_metadata(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_start(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when output startson_stop(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when output stopson_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_wake_up(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready
output.srt
Send a SRT stream to a distant agent.
Type:
(?id : string?, ?bind_address : string, ?connection_timeout : float?,
?enforced_encryption : bool?, ?fallible : bool, ?host : string,
?ipv6only : bool?,
?listen_callback : ((hs_version : int, peeraddr : string,
streamid : string?, srt_socket) -> bool)?,
?max_clients : int?, ?messageapi : bool, ?mode : string,
?passphrase : string?, ?payload_size : int, ?pbkeylen : int?,
?polling_delay : float, ?port : int, ?prefer_address : string?,
?read_timeout : float?, ?register_telnet : bool, ?start : bool,
?streamid : string?, ?write_timeout : float?, format('a), source('a)) ->
unit
Arguments
id(of typestring?, which defaults tonull): Force the value of the source ID.bind_address(of typestring, which defaults to"0.0.0.0"): Address to bind on the local machine. Used only in listener modeconnection_timeout(of typefloat?, which defaults tonull): Timeout, in seconds, after which initial connection operations are aborted if no data was received. Uses library's default ifnull. Used only inclientmode.enforced_encryption(of typebool?, which defaults tonull): Enforces that both connection parties have the same passphrase set, or both do not set the passphrase, otherwise the connection is rejected.fallible(of typebool, which defaults tofalse): Allow the child source to fail, in which case the output will be stopped until the source is available again.host(of typestring, which defaults to"localhost"): Address to connect to. Used only in caller mode.ipv6only(of typebool?, which defaults tonull): Iftrueandmodeis set tolisten, only ipv6 connections are accepted. Whennull, defaults totruewhen thebind_addressis a ipv6 address and system defaults otherwise.listen_callback(of type((hs_version : int, peeraddr : string, streamid : string?, srt_socket) -> bool)?, which defaults tonull): Callback used to decide whether to accept new incoming connections. Used in listener mode only.max_clients(of typeint?, which defaults tonull): Max number of connected clients (listener mode only)messageapi(of typebool, which defaults totrue): Use message apimode(of typestring, which defaults to"caller"): Mode to operate on. One of:"listener"(waits for connection to come in) or"caller"(initiate connection to a remote server)passphrase(of typestring?, which defaults tonull): When set to a non-empty string, this option enables encryption and sets the passphrase for it. Seelibsrtdocumentation for more details.payload_size(of typeint, which defaults to1316): Payload size.pbkeylen(of typeint?, which defaults tonull): Set encryption key length. Seelibsrtdocumentation for more details.polling_delay(of typefloat, which defaults to2.0): Delay between connection attempts. Used only in caller mode.port(of typeint, which defaults to8000): Port to bind on the local machine (listener mode) or to connect to (caller mode). The termportas used in SRT is occasionally identical to the termUDP port. However SRT offers more flexibility than UDP because it manages ports as its own resources. For example, one port may be shared between various services.prefer_address(of typestring?, which defaults tonull): Preferred address type when resolving hostnames. One of:"system","ipv4"or"ipv6". Defaults to globalsrt.prefer_connectionsettings whennull.read_timeout(of typefloat?, which defaults to1.0): Timeout, in seconds, after which read operations are aborted if no data was received, indefinite ifnull.register_telnet(of typebool, which defaults totrue): Register telnet commands for this output.start(of typebool, which defaults totrue): Start output as soon as it is available.streamid(of typestring?, which defaults tonull): Setstreamid. This value can be retrieved by the listener side when connecting to it. Used in caller mode only.write_timeout(of typefloat?, which defaults to1.0): Timeout, in seconds, after which write operations are aborted if no data was received, indefinite ifnull.(unlabeled)(of typeformat('a)): Encoding format.(unlabeled)(of typesource('a))
Methods
buffered(of type() -> [string * float]): Length of buffered data.clock(of typeclock): The source's clockconnect(of type() -> unit): In sender mode, connect to remote server. In listener mode, setup listening socket.disconnect(of type() -> unit): Disconnect all connected socket.duration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): Indicate if a source may fail, i.e. may not be ready to stream.generate_frame(of type() -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such ason_frame!id(of type() -> string): Identifier of the source.insert_metadata(of type(?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata ifnew_trackistrue.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.http.is_ready(of type() -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.is_started(of type() -> bool):trueif the output or source is started.is_up(of type() -> bool): Indicate that the source can be asked to produce some data at any time. This istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.last_metadata(of type() -> [string * string]?): Return the last metadata from the source.log(of type{level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from1to5.register_command(of type(?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.remaining(of type() -> float): Estimation of remaining time in the current track.reset_last_metadata_on_track(of type(() -> bool).{set : (bool) -> unit}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.seek(of type(float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).self_sync(of type() -> bool): Is the source currently controlling its own real-time loop.self_sync_description(of type() -> string)shutdown(of type() -> unit): Shutdown the output.skip(of type() -> unit): Skip to the next track.sockets(of type() -> [string * srt_socket]): List of(connected_address, connected_socket)start(of type() -> unit): Ask the source or output to start.stop(of type() -> unit): Ask the source or output to stop.time(of type() -> float): Get a source's time, based on its assigned clock.
Callbacks
on_connect(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when connected.on_disconnect(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when disconnected.on_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_frame_checksum(of type(?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).on_metadata(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_socket(of type(synchronous : bool, ((mode : string, srt_socket) -> unit)) -> unit): Call a given handler when a new SRT socket is created to set additional options, add monitoring, etc.modeshould be one of:"connect"(socket created before connecting to a remote address),"listen"(socket created before binding for receiving new incoming connections),"incoming"(socket received as incoming connection) or"close"(socket is about to closed).on_start(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when output startson_stop(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when output stopson_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_wake_up(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready
output.stereotool
Output an audio source using stereotool
Type:
(?id : string?, library_file : string, ?license_key : string?,
?preset : string?, ?load_type : string, ?fallible : bool,
?register_telnet : bool, ?start : bool, source(audio=pcm('a), 'b)) -> unit
Arguments
id(of typestring?, which defaults to"output.stereotool"): Force the value of the track ID.library_file(of typestring): Path to the shared library file.license_key(of typestring?, which defaults tonull)preset(of typestring?, which defaults tonull): Path to a preset file to load when initializing the operator.load_type(of typestring, which defaults to"totalinit"): Load type for preset. One of: "totalinit", "all_settings", "audiofm", "audio", "processing", "repair", "repair_no_pnr" or "sublevel_pnr".fallible(of typebool, which defaults tofalse): Allow the child source to fail, in which case the output will be stopped until the source is available again.register_telnet(of typebool, which defaults totrue): Register telnet commands for this output.start(of typebool, which defaults totrue): Start output as soon as it is available.(unlabeled)(of typesource(audio=pcm('a), 'b))
Methods
api_version(of type() -> int): API version.buffered(of type() -> [string * float]): Length of buffered data.clock(of typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): Indicate if a source may fail, i.e. may not be ready to stream.generate_frame(of type() -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such ason_frame!id(of type() -> string): Identifier of the source.insert_metadata(of type(?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata ifnew_trackistrue.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.http.is_ready(of type() -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.is_started(of type() -> bool):trueif the output or source is started.is_up(of type() -> bool): Indicate that the source can be asked to produce some data at any time. This istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.last_metadata(of type() -> [string * string]?): Return the last metadata from the source.latency(of type() -> float): Get the operator's latency.log(of type{level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from1to5.register_command(of type(?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.remaining(of type() -> float): Estimation of remaining time in the current track.reset_last_metadata_on_track(of type(() -> bool).{set : (bool) -> unit}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.seek(of type(float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).self_sync(of type() -> bool): Is the source currently controlling its own real-time loop.self_sync_description(of type() -> string):shutdown(of type() -> unit): Shutdown the output.skip(of type() -> unit): Skip to the next track.software_version(of type() -> int): Software version.start(of type() -> unit): Ask the source or output to start.stop(of type() -> unit): Ask the source or output to stop.time(of type() -> float): Get a source's time, based on its assigned clock.unlincensed_used_features(of type() -> string?): Check if the license is valid for the current settings.valid_license(of type() -> bool): Check if the license is valid for the current settings.
Callbacks
on_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_frame_checksum(of type(?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).on_metadata(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_start(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when output startson_stop(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when output stopson_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_wake_up(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready
output.url
Encode and let encoder handle data output. Useful with encoder with no expected output or to encode to files that need full control from the encoder, e.g. %ffmpeg with rtmp output.
Type:
(?id : string?, ?export_cover_metadata : bool, ?fallible : bool,
?register_telnet : bool, ?restart_delay : float?, ?self_sync : bool,
?start : bool, url : string, format('a), source('a)) -> unit
Arguments
id(of typestring?, which defaults tonull): Force the value of the source ID.export_cover_metadata(of typebool, which defaults totrue): Export cover metadata.fallible(of typebool, which defaults tofalse): Allow the child source to fail, in which case the output will be stopped until the source is available again.register_telnet(of typebool, which defaults totrue): Register telnet commands for this output.restart_delay(of typefloat?, which defaults to2.0): If notnull, restart output on errors after the given delay.self_sync(of typebool, which defaults tofalse): Should the source control its own synchronization? Set totruefor output to e.g.rtmpoutput using%ffmpegand etc.start(of typebool, which defaults totrue): Start output as soon as it is available.url(of typestring): Url to output to.(unlabeled)(of typeformat('a)): Encoding format.(unlabeled)(of typesource('a))
Methods
buffered(of type() -> [string * float]): Length of buffered data.clock(of typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): Indicate if a source may fail, i.e. may not be ready to stream.generate_frame(of type() -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such ason_frame!id(of type() -> string): Identifier of the source.insert_metadata(of type(?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata ifnew_trackistrue.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.http.is_ready(of type() -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.is_started(of type() -> bool):trueif the output or source is started.is_up(of type() -> bool): Indicate that the source can be asked to produce some data at any time. This istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.last_metadata(of type() -> [string * string]?): Return the last metadata from the source.log(of type{level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from1to5.register_command(of type(?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.remaining(of type() -> float): Estimation of remaining time in the current track.reset_last_metadata_on_track(of type(() -> bool).{set : (bool) -> unit}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.seek(of type(float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).self_sync(of type() -> bool): Is the source currently controlling its own real-time loop.self_sync_description(of type() -> string)shutdown(of type() -> unit): Shutdown the output.skip(of type() -> unit): Skip to the next track.start(of type() -> unit): Ask the source or output to start.stop(of type() -> unit): Ask the source or output to stop.time(of type() -> float): Get a source's time, based on its assigned clock.
Callbacks
on_error(of type(synchronous : bool, ((error) -> unit)) -> unit): Call a given handler when an error occurs.on_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_frame_checksum(of type(?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).on_metadata(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_start(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when output startson_stop(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when output stopson_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_wake_up(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready
output.video
Output a video stream using the default operator. The input source does not need to be infallible, blank will just be played during failures.
Type:
(?id : string?, ?fallible : bool, ?start : bool, source(video=canvas('a),
'b)) -> unit
Arguments
id(of typestring?, which defaults tonull): Force the value of the source ID.fallible(of typebool, which defaults totrue): Allow the child source to fail, in which case the output will be (temporarily) stopped.start(of typebool, which defaults totrue): Automatically start outputting whenever possible. Iftrue, an infallible (normal) output will start outputting as soon as it is created, and a fallible output will (re)start as soon as its source becomes available for streaming.(unlabeled)(of typesource(video=canvas('a), 'b)): Source to play.
output.youtube.live.hls
Stream to youtube using HLS.
Type:
(?id : string?, ?fallible : bool, ?segment_duration : float, ?segments : int,
?segments_overhead : int, ?start : bool, ?url : string, key : string,
encoder : format('a)
.{
bandwidth? : int,
codecs? : string,
extname? : string,
extra_tags? : [string],
id3? : bool,
id3_version? : int,
replay_id3? : bool,
video_size? : int * int
}, source('a)) -> unit
Arguments
id(of typestring?, which defaults tonull): Force the value of the source ID.fallible(of typebool, which defaults tofalse): Allow the child source to fail, in which case the output will be (temporarily) stopped.segment_duration(of typefloat, which defaults to2.0): Segment duration (in seconds).segments(of typeint, which defaults to4): Number of segments per playlist.segments_overhead(of typeint, which defaults to4): Number of segments to keep after they have been featured in the live playlist.start(of typebool, which defaults totrue): Automatically start outputting whenever possible. If true, an infallible (normal) output will start outputting as soon as it is created, and a fallible output will (re)start as soon as its source becomes available for streaming.url(of typestring, which defaults to"https://a.upload.youtube.com/http_upload_hls"): HLS URL to stream tokey(of typestring): Your secret youtube keyencoder(of typeformat('a) .{ bandwidth? : int, codecs? : string, extname? : string, extra_tags? : [string], id3? : bool, id3_version? : int, replay_id3? : bool, video_size? : int * int }): Encoder to use (most likely a%ffmpegencoder)(unlabeled)(of typesource('a))
Methods
buffered(of type() -> [string * float]): Length of buffered data.clock(of typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): Indicate if a source may fail, i.e. may not be ready to stream.generate_frame(of type() -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such ason_frame!id(of type() -> string): Identifier of the source.insert_metadata(of type(?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata ifnew_trackistrue.insert_tag(of type(string) -> unit): Insert the same tag into all the streamsis_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.http.is_ready(of type() -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.is_started(of type() -> bool):trueif the output or source is started.is_up(of type() -> bool): Indicate that the source can be asked to produce some data at any time. This istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.last_metadata(of type() -> [string * string]?): Return the last metadata from the source.log(of type{level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from1to5.register_command(of type(?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.remaining(of type() -> float): Estimation of remaining time in the current track.reset_last_metadata_on_track(of type(() -> bool).{set : (bool) -> unit}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.seek(of type(float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).self_sync(of type() -> bool): Is the source currently controlling its own real-time loop.self_sync_description(of type() -> string):shutdown(of type() -> unit): Shutdown the output.skip(of type() -> unit): Skip to the next track.start(of type() -> unit): Ask the source or output to start.stop(of type() -> unit): Ask the source or output to stop.streams(of type() -> [ { bandwidth : int, codecs : string, discontinuity_count : int, encoder : format('A), extname : string, extra_tags : [string], id3_enabled : bool, insert_tag : (string) -> unit, name : string, replay_id3 : bool, video_size : {height : int, width : int }? }]): Output streamstime(of type() -> float): Get a source's time, based on its assigned clock.
Callbacks
on_file_change(of type(synchronous : bool, (({path : string, state : string}) -> unit)) -> unit): Call a given handler when a file changes.stateis one of:"created","updated"or"deleted",pathis the full file path. Typical use: sync file with a CDNon_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_frame_checksum(of type(?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).on_metadata(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_start(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when output startson_stop(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when output stopson_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_wake_up(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready
output.youtube.live.rtmp
Stream to youtube using RTMP.
Type:
(?id : string?, ?fallible : bool, ?start : bool, ?url : string, key : string,
encoder : format('a), source('a)) -> unit
Arguments
id(of typestring?, which defaults tonull): Force the value of the source ID.fallible(of typebool, which defaults tofalse): Allow the child source to fail, in which case the output will be (temporarily) stopped.start(of typebool, which defaults totrue): Automatically start outputting whenever possible. If true, an infallible (normal) output will start outputting as soon as it is created, and a fallible output will (re)start as soon as its source becomes available for streaming.url(of typestring, which defaults to"rtmp://a.rtmp.youtube.com/live2"): RTMP URL to stream tokey(of typestring): Your secret youtube keyencoder(of typeformat('a)): Encoder to use (most likely a%ffmpegencoder)(unlabeled)(of typesource('a))
Methods
buffered(of type() -> [string * float]): Length of buffered data.clock(of typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): Indicate if a source may fail, i.e. may not be ready to stream.generate_frame(of type() -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such ason_frame!id(of type() -> string): Identifier of the source.insert_metadata(of type(?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata ifnew_trackistrue.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.http.is_ready(of type() -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.is_started(of type() -> bool):trueif the output or source is started.is_up(of type() -> bool): Indicate that the source can be asked to produce some data at any time. This istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.last_metadata(of type() -> [string * string]?): Return the last metadata from the source.log(of type{level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from1to5.register_command(of type(?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.remaining(of type() -> float): Estimation of remaining time in the current track.reset_last_metadata_on_track(of type(() -> bool).{set : (bool) -> unit}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.seek(of type(float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).self_sync(of type() -> bool): Is the source currently controlling its own real-time loop.self_sync_description(of type() -> string):shutdown(of type() -> unit): Shutdown the output.skip(of type() -> unit): Skip to the next track.start(of type() -> unit): Ask the source or output to start.stop(of type() -> unit): Ask the source or output to stop.time(of type() -> float): Get a source's time, based on its assigned clock.
Callbacks
on_error(of type(synchronous : bool, ((error) -> unit)) -> unit): Call a given handler when an error occurs.on_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_frame_checksum(of type(?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).on_metadata(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_start(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when output startson_stop(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when output stopson_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_wake_up(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready