package ffmpeg-avfilter

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

This module provides an API to AVfilter.

type config
type valued_arg = [
  1. | `String of string
  2. | `Int of int
  3. | `Int64 of int64
  4. | `Float of float
  5. | `Rational of Avutil.rational
]
type args = [
  1. | `Flag of string
  2. | `Pair of string * valued_arg
]
type ('a, 'b) av = {
  1. audio : 'a;
  2. video : 'b;
}
type ('a, 'b) io = {
  1. inputs : 'a;
  2. outputs : 'b;
}
type ('a, 'b, 'c) pad

(attached/unattached, audio/video, input/output) pad

type ('a, 'b) pads = (('a, [ `Audio ], 'b) pad list, ('a, [ `Video ], 'b) pad list) av
type flag = [
  1. | `Dynamic_inputs
  2. | `Dynamic_outputs
  3. | `Slice_threads
  4. | `Support_timeline_generic
  5. | `Support_timeline_internal
]
type 'a filter = {
  1. name : string;
  2. description : string;
  3. options : Avutil.Options.t;
  4. flags : flag list;
  5. io : (('a, [ `Input ]) pads, ('a, [ `Output ]) pads) io;
}
type 'a input = [ `Frame of 'a Avutil.frame | `Flush ] -> unit
type 'a context
type 'a output = {
  1. context : 'a context;
  2. handler : unit -> 'a Avutil.frame;
}
type 'a entries = (string * 'a) list
type inputs = ([ `Audio ] input entries, [ `Video ] input entries) av
type outputs = ([ `Audio ] output entries, [ `Video ] output entries) av
type t = (inputs, outputs) io
val time_base : _ context -> Avutil.rational
val frame_rate : [ `Video ] context -> Avutil.rational
val width : [ `Video ] context -> int
val height : [ `Video ] context -> int
val pixel_aspect : [ `Video ] context -> Avutil.rational option
val pixel_format : [ `Video ] context -> Avutil.Pixel_format.t
val channels : [ `Audio ] context -> int
val channel_layout : [ `Audio ] context -> Avutil.Channel_layout.t
val sample_rate : [ `Audio ] context -> int
val sample_format : [ `Audio ] context -> Avutil.Sample_format.t
val set_frame_size : [ `Audio ] context -> int -> unit
exception Exists
val filters : [ `Unattached ] filter list

Filter list.

val find : string -> [ `Unattached ] filter
val find_opt : string -> [ `Unattached ] filter option
val abuffer : [ `Unattached ] filter

Buffers (input).

val buffer : [ `Unattached ] filter
val abuffersink : [ `Unattached ] filter

Sinks (output).

val buffersink : [ `Unattached ] filter
val pad_name : (_, _, _) pad -> string

Pad name.

val init : unit -> config

Initiate a filter graph configuration.

val attach : ?args:args list -> name:string -> [ `Unattached ] filter -> config -> [ `Attached ] filter

Attach a filter to a filter graph configuration. Raises Exists if there is already a filter by that name in the graph. Number of inputs or outputs can change from the filter's specifications, in particular if the filter has the `Dynamic_input or `Dynamic_output flag set.

Link two filter pads.

type command_flag = [
  1. | `Fast
]
val process_command : ?flags:command_flag list -> cmd:string -> ?arg:string -> [ `Attached ] filter -> string

Send a command to a attached filter pad.

type ('a, 'b, 'c) parse_node = {
  1. node_name : string;
  2. node_args : args list option;
  3. node_pad : ('a, 'b, 'c) pad;
}

Parse a graph described by a string and attach outputs/inputs to it.

type ('a, 'b) parse_av = (('a, [ `Audio ], 'b) parse_node list, ('a, [ `Video ], 'b) parse_node list) av
type 'a parse_io = (('a, [ `Input ]) parse_av, ('a, [ `Output ]) parse_av) io
val parse : [ `Unattached ] parse_io -> string -> config -> [ `Attached ] parse_io
val launch : config -> t

Check validity and configure all the links and formats in the graph and return its outputs and outputs.

module Utils : sig ... end