On this page:

6 Core Library

 (require video/core) package: video

The structs given to the render function are found here. Examples are found in private/examples.rkt.


(struct video (mlt-object tags))

  mlt-object : any/c
  tags : (set/c any/c)
The basic video object.

mlt-object contains the compiled mlt-object, or #f if it has not yet been compiled. This bit of the library is particularly unstable, and may change if it stops using MLT as a backend.


(struct link video (source target index))

  source : video?
  target : video?
  index : exact-nonnegative-integer?
A link object which connects a producer to a consumer. Links can also connect to and from filters. The most basic and common connection connects a video producer, to a built in consumer. The preview and render functions handle the linking for you.

As such, this is only required if you plan to use convert-to-mlt! directly.

source contains the producer that is linked together.

target contains the consumer that receives the produced video.


(struct properties video (prop))

  prop : (hash/c string? any/c)
Contains properties attached to video objects. These are currently only used as to interact with the MLT layer. Such as to set a consumers resolution, or set a producers length.

prop contains the actual properties table.


(properties-ref dict key default-type)  any/c

  dict : properties?
  key : string?
  default-type : (or/c 'string 'int 'int64 'mlt-position 'double)
A function to get the properties out of a video object. If the property associated with key does not exist in the table, it will search the MLT object’s properties for the given key if it has already been compiled.

dict is the video object to search.

The key identifies which property to search for.

default-type indicates the assumed type used when requesting the object from MLT. This is required because MLT does not store this information and internally represents everything as a string.


(struct anim-property video (value position length))

  value : any/c
  position : number?
  length : number?
Used for anim-properties in MLT.

value is the actual property.

position and length are extra field when setting the anim property.


(struct frame properties ())

A struct containing a frame object. This currently has no additional data apart from properties.


(struct service properties (filters))

  filters : (listof filter)
A service is the basic type of video object that actually handles data. Services come in four types:

A service can additionally have filters attached to it, stored in filters.


(struct filter service (type source))

  type : (or/c symbol? #f)
  source : (or/c string? #f)
Filters alter the behavior of a service in some way. They can be used in one of three ways:

Many filters apply to only one producer. For example, the grayscale filter turns a producer to grayscale.

Other filters, however, become relevant only when multiple tracks are used in a tractor. For example, a filter can be used to shrink a video and overlay it on top of another one.

type stores the type of filter. This presumes that the needed plugin is installed for MLT. #f is the default type, which is generally 'loader.

source is the source for the filter. This can be used to set some default properties that MLT uses when setting default values.


(struct transition service (type source length))

  type : (or/c symbol? #f)
  source : (or/c string? #f)
  length : integer?
Transitions are used for combining two videos, generally used in conjunction with a playlist.

type indicates the type of the transition.

source indicates the source for the transition if the type requires it. This generally remains #f.

length indicates the length of the transition. Generally the playlist associated with this transition will be shorted by length frames.


(struct consumer service (type target))

  type : (or/c symbol? #f)
  target : (or/c string? #f)
Consumers output a video that is produced by the producer that they are linked to.

type stores what the consumer outputs. Some common types used are:

The target field indicates the file to create, or a different parameter that the specific plugin uses. It is frequently #f for the default consumer.


(struct producer service (type source start end speed seek))

  type : (or/c symbol? #f)
  source : (or/c string? #f)
  start : exact-nonnegative-integer?
  end : exact-nonnegative-integer?
  speed : number?
  seek : exact-nonnegative-integer?
A producer feeds data to consumers or filters. A producer can be a video, or an image, or an audio clip.

type stores the type of video being inputted. Unlike with consumers, this should typically be left as the default #f or 'loader.

Yes, yes, I know, this is really kludgy. It is currently this way to deal with MLT bugs.

source is a URI for producer’s source. Some example values are:
  • "color:blue"

  • "hold:picture.png"

  • "video.mp4"

  • "xml:mltxml.xml

The start and end of the producer is given, or is the length of the producer when it is #f. Note that some producers, such as still images, do not have a natural start or end, and will fill up as much time as needed.

The speed of the producer sets the speed the producer feeds frames into its consumer. A speed of 1 is regular playing speed. 0 is paused and will continuously output the same frame. Values greater than 1 play faster than the producers speed, and values less than 0 rewind the producer. Finally, values between 0 and 1 play at a slower than normal rate.

seek can be combined with speed to alter the way the video is played. seek determines the point where the producer begins to play. Normally this is the same position as start, but could be set to the middle of the clip and speed set to a negative value, to simulate a rewinding clip.


(struct playlist producer (elements))

  elements : (listof (or/c producer transition blank playlist-producer))
A playlist is a list of producers that play one after the other.

Transitions can also be put in a playlist and are used to combine two clips, such as to fade from one video to another. A transition shortens its two surrounding clips and producers a new clip for the transition. Note that a playlist with transitions in it will be shortened by the length of the transition.

elements is the list of producers and transitions in the video.


(struct playlist-producer video (producer start end))

  producer : producer?
  start : exact-nonnegative-integer?
  end : exact-nonnegative-integer?
Don’t use this for now. I’m still not entirely sure how its supposed to work.


(struct blank video (length))

  length : exact-nonnegative-integer?
Similar to a producer, but is blank. These can be inserted into playlists.


(struct multitrack producer (tracks field))

  tracks : (listof producer)
  field : (listof field-element?)


(struct field-element video (element track track-2))

  element : (or/c transition? filter? #f)
  track : (or/c exact-nonnegative-integer? #f)
  track-2 : (or/c exact-nonnegative-integer? #f)