Skip to main content
Version: 2.5.x (dev)

Track / Track processing

track.audio.defer​

Defer an audio track by a given amount of time. Track will be available when the given delay has been fully buffered. Use this operator instead of buffer when buffering large amount of data as initial delay.

Type:

(?id : string?, delay : float, ?overhead : float?, pcm_s16('a)) ->
pcm_s16('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • delay (of type float): Duration of the delay, in seconds.
  • overhead (of type float?, which defaults to null): Duration of the delay overhead, in seconds. Defaults to frame size.
  • (unlabeled) (of type pcm_s16('a)): Track to delay.

track.ffmpeg.raw.side_data​

Edit the side data of a raw video track: set its display rotation, remove kinds of side data. With an infallible input, a persistent data fault is a hard error: use mksafe or fallback to keep streaming through it.

Type:

(?id : string?, ?rotation : {float?}, ?remove : [string],
ffmpeg.video.raw('a)) -> ffmpeg.video.raw('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • rotation (of type {float?}, which defaults to null): A non-null value sets the stream's display rotation, in degrees counter-clockwise.
  • remove (of type [string], which defaults to []): Kinds of side data to remove, by FFmpeg's frame side-data name.
  • (unlabeled) (of type ffmpeg.video.raw('a))

Methods:

  • rotation (of type () -> float?): Rotation of the current source's display matrix, in degrees counter-clockwise.
  • side_data (of type () -> [{data : string, kind : string}]): Stream-wide side data of the current source.

track.ffmpeg.side_data​

Edit the side data of a copied track: set its display rotation, remove kinds of side data. With an infallible input, a persistent data fault is a hard error: use mksafe or fallback to keep streaming through it.

Type:

(?id : string?, ?rotation : {float?}, ?remove : [string], ffmpeg.copy('a)) ->
ffmpeg.copy('b)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • rotation (of type {float?}, which defaults to null): A non-null value sets the stream's display rotation, in degrees counter-clockwise.
  • remove (of type [string], which defaults to []): Kinds of side data to remove, by FFmpeg's packet side-data name.
  • (unlabeled) (of type ffmpeg.copy('a))

Methods:

  • rotation (of type () -> float?): Rotation of the current source's display matrix, in degrees counter-clockwise.
  • side_data (of type () -> [{data : string, kind : string}]): Stream-wide side data of the current source.

track.metadata​

Return the metadata associated with the given track

Type:

(?id : string?, 'a) -> metadata where 'a is a track

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • (unlabeled) (of type anything that is a track)

track.metadata.map​

Rewrite metadata on the fly using a function.

Type:

(?id : string?, (([string * string]) -> [string * string]), ?update : bool,
?strip : bool?, ?insert_missing : bool?, metadata) -> metadata

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • (unlabeled) (of type ([string * string]) -> [string * string]): A function that returns new metadata.
  • update (of type bool, which defaults to true): Update metadata. If false, existing metadata are cleared and only returned values are set as new metadata.
  • strip (of type bool?, which defaults to null): Completely remove empty metadata. Operates on both empty values and empty metadata chunk. Defaults to settings.metadata.map.strip when null.
  • insert_missing (of type bool?, which defaults to null): Treat track beginnings without metadata as having empty ones. The operational order is: create empty if needed, map and strip if enabled. Defaults to settings.metadata.map.insert_missing when null.
  • (unlabeled) (of type metadata)

track.metadata.merge​

Merge metadata from all given tracks. If two sources have metadata with the same label at the same time, the one from the last source in the list takes precedence.

Type:

(?id : string?, [metadata]) -> metadata

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • (unlabeled) (of type [metadata])

track.on_subtitle​

Call a callback on each subtitle in the track.

Type:

(?id : string?,
((
{
absolute_end_time : float,
absolute_start_time : float,
end_time : int,
forced : bool,
format : string,
position : int,
start_time : int,
text : string
}) -> unit),
subtitles) -> subtitles

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • (unlabeled) (of type ( { absolute_end_time : float, absolute_start_time : float, end_time : int, forced : bool, format : string, position : int, start_time : int, text : string }) -> unit): Callback function called on each subtitle.
  • (unlabeled) (of type subtitles)

track.subtitles.insert​

Allow inserting subtitles into the track. Returns the track with an insert_subtitle method.

Type:

(?id : string?, ?subtitles?) -> subtitles

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • (unlabeled) (of type subtitles?, which defaults to null)

Methods:

  • insert_subtitle (of type ({duration : float, forced : bool, format : string, text : string}) -> unit): Insert a subtitle at the current position.

track.subtitles.map​

Map a function over each subtitle in the track.

Type:

(?id : string?,
((
{
absolute_end_time : float,
absolute_start_time : float,
end_time : int,
forced : bool,
format : string,
position : int,
start_time : int,
text : string
}) -> {forced? : bool, format? : string, text? : string}?),
subtitles) -> subtitles

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • (unlabeled) (of type ( { absolute_end_time : float, absolute_start_time : float, end_time : int, forced : bool, format : string, position : int, start_time : int, text : string }) -> {forced? : bool, format? : string, text? : string}?): Callback function called on each subtitle. Returns a record with optional fields to update (text, format, forced), or null to remove the subtitle.
  • (unlabeled) (of type subtitles)

track.track_marks​

Return the track marks associated with the given track

Type:

(?id : string?, 'a) -> track_marks where 'a is a track

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • (unlabeled) (of type anything that is a track)