Documentation ¶
Index ¶
- Variables
- func AssertType(hasType, expectType string, action string)
- func ConvertKwargsToCmdLineArgs(kwargs KwArgs) []string
- func DebugNodes(node []DagNode)
- func DebugOutGoingMap(node []DagNode, m map[int]map[Label][]NodeInfo)
- func Probe(fileName string, kwargs ...KwArgs) (string, error)
- func ProbeReader(r io.Reader, kwargs ...KwArgs) (string, error)
- func ProbeReaderWithTimeout(r io.Reader, timeOut time.Duration, kwargs KwArgs) (string, error)
- func ProbeReaderWithTimeoutExec(r io.Reader, timeOut time.Duration, kwargs KwArgs) (string, error)
- func ProbeWithTimeout(fileName string, timeOut time.Duration, kwargs KwArgs) (string, error)
- func ProbeWithTimeoutExec(fileName string, timeOut time.Duration, kwargs KwArgs) (string, error)
- type Args
- type CommandOption
- type CompilationOption
- type DagEdge
- type DagNode
- type Graph
- type GraphNode
- type GraphOptions
- type KwArgs
- func (a KwArgs) Copy() KwArgs
- func (a KwArgs) EscapeWith(chars string) KwArgs
- func (a KwArgs) GetDefault(k string, defaultV interface{}) interface{}
- func (a KwArgs) GetString(k string) string
- func (a KwArgs) HasKey(k string) bool
- func (a KwArgs) PopDefault(k string, defaultV interface{}) interface{}
- func (a KwArgs) PopString(k string) string
- func (a KwArgs) SortedKeys() []string
- type Label
- type Node
- func FilterMultiOutput(streamSpec []*Stream, filterName string, args Args, kwArgs ...KwArgs) *Node
- func NewFilterNode(name string, streamSpec []*Stream, maxInput int, args []string, kwargs KwArgs) *Node
- func NewGlobalNode(name string, streamSpec []*Stream, args []string, kwargs KwArgs) *Node
- func NewInputNode(name string, args []string, kwargs KwArgs) *Node
- func NewMergeOutputsNode(name string, streamSpec []*Stream) *Node
- func NewNode(streamSpec []*Stream, name string, incomingStreamTypes sets.String, ...) *Node
- func NewOutputNode(name string, streamSpec []*Stream, args []string, kwargs KwArgs) *Node
- func (n *Node) Equal(other DagNode) bool
- func (n *Node) Get(a string) *Stream
- func (n *Node) GetFilter(outgoingEdges []DagEdge) string
- func (n *Node) GetInComingEdges() []DagEdge
- func (n *Node) Hash() int
- func (n *Node) IncomingEdgeMap() map[Label]NodeInfo
- func (n *Node) ShortRepr() string
- func (n *Node) Stream(label Label, selector Selector) *Stream
- func (n *Node) String() string
- type NodeInfo
- type RunHook
- type Selector
- type Stream
- func Concat(streams []*Stream, kwargs ...KwArgs) *Stream
- func Filter(streamSpec []*Stream, filterName string, args Args, kwArgs ...KwArgs) *Stream
- func Input(filename string, kwargs ...KwArgs) *Stream
- func MergeOutputs(streams ...*Stream) *Stream
- func NewStream(node *Node, streamType string, label Label, selector Selector) *Stream
- func Output(streams []*Stream, fileName string, kwargs ...KwArgs) *Stream
- func OutputContext(ctx context.Context, streams []*Stream, fileName string, kwargs ...KwArgs) *Stream
- func (s *Stream) ASplit() *Node
- func (s *Stream) Audio() *Stream
- func (s *Stream) ColorChannelMixer(kwargs ...KwArgs) *Stream
- func (s *Stream) Compile(options ...CompilationOption) *exec.Cmd
- func (s *Stream) Concat(streams []*Stream, kwargs ...KwArgs) *Stream
- func (s *Stream) Crop(x, y, w, h int, kwargs ...KwArgs) *Stream
- func (s *Stream) DrawBox(x, y, w, h int, color string, thickness int, kwargs ...KwArgs) *Stream
- func (s *Stream) Drawtext(text string, x, y int, escape bool, kwargs ...KwArgs) *Stream
- func (s *Stream) Equal(other Stream) bool
- func (s *Stream) ErrorToStdOut() *Stream
- func (s *Stream) Filter(filterName string, args Args, kwArgs ...KwArgs) *Stream
- func (s *Stream) Get(index string) *Stream
- func (s *Stream) GetArgs() []string
- func (s *Stream) GlobalArgs(args ...string) *Stream
- func (s *Stream) HFlip(kwargs ...KwArgs) *Stream
- func (s *Stream) Hash() int
- func (s *Stream) Hue(kwargs ...KwArgs) *Stream
- func (s *Stream) Output(fileName string, kwargs ...KwArgs) *Stream
- func (s *Stream) OverWriteOutput() *Stream
- func (s *Stream) Overlay(overlayParentNode *Stream, eofAction string, kwargs ...KwArgs) *Stream
- func (s *Stream) OverwriteOutput(stream *Stream) *Stream
- func (s *Stream) Run(options ...CompilationOption) error
- func (s *Stream) RunLinux() error
- func (s *Stream) RunWithResource(cpuRequest, cpuLimit float32) error
- func (s *Stream) SetFfmpegPath(path string) *Stream
- func (s *Stream) SetPts(expr string) *Node
- func (s *Stream) Silent(isSilent bool) *Stream
- func (s *Stream) Split() *Node
- func (s *Stream) String() string
- func (s *Stream) Trim(kwargs ...KwArgs) *Stream
- func (s *Stream) VFlip(kwargs ...KwArgs) *Stream
- func (s *Stream) Video() *Stream
- func (s *Stream) View(viewType ViewType) (string, error)
- func (s *Stream) WithCpuCoreLimit(n float32) *Stream
- func (s *Stream) WithCpuCoreRequest(n float32) *Stream
- func (s *Stream) WithCpuSet(n string) *Stream
- func (s *Stream) WithErrorOutput(out io.Writer) *Stream
- func (s *Stream) WithInput(reader io.Reader) *Stream
- func (s *Stream) WithMemSet(n string) *Stream
- func (s *Stream) WithOutput(out ...io.Writer) *Stream
- func (s *Stream) WithTimeout(timeOut time.Duration) *Stream
- func (s *Stream) ZoomPan(kwargs ...KwArgs) *Stream
- type ViewType
Constants ¶
This section is empty.
Variables ¶
var GlobalCommandOptions = make([]CommandOption, 0)
var LogCompiledCommand bool = true
Functions ¶
func AssertType ¶
func DebugNodes ¶
func DebugNodes(node []DagNode)
func Probe ¶
Probe Run ffprobe on the specified file and return a JSON representation of the output.
func ProbeReader ¶
ProbeReader runs ffprobe passing given reader via stdin and return a JSON representation of the output.
func ProbeReaderWithTimeout ¶
func ProbeWithTimeout ¶
Types ¶
type CommandOption ¶
type CompilationOption ¶
func SeparateProcessGroup ¶
func SeparateProcessGroup() CompilationOption
SeparateProcessGroup ensures that the command is run in a separate process group. This is useful to enable handling of signals such as SIGINT without propagating them to the ffmpeg process.
type DagEdge ¶
type DagEdge struct { DownStreamNode DagNode DownStreamLabel Label UpStreamNode DagNode UpStreamLabel Label UpStreamSelector Selector }
func GetInComingEdges ¶
type DagNode ¶
type DagNode interface { Hash() int // Compare two nodes Equal(other DagNode) bool // Return a full string representation of the node. String() string // Return a partial/concise representation of the node ShortRepr() string // Provides information about all incoming edges that connect to this node. // // The edge map is a dictionary that maps an “incoming_label“ to “(outgoing_node, outgoing_label)“. Note that // implicity, “incoming_node“ is “self“. See "Edges" section above. IncomingEdgeMap() map[Label]NodeInfo }
Node in a directed-acyclic graph (DAG).
Edges: DagNodes are connected by edges. An edge connects two nodes with a label for each side: - “upstream_node“: upstream/parent node - “upstream_label“: label on the outgoing side of the upstream node - “downstream_node“: downstream/child node - “downstream_label“: label on the incoming side of the downstream node
For example, DagNode A may be connected to DagNode B with an edge labelled "foo" on A's side, and "bar" on B's side:
_____ _____ | | | | | A >[foo]---[bar]> B | |_____| |_____|
Edge labels may be integers or strings, and nodes cannot have more than one incoming edge with the same label.
DagNodes may have any number of incoming edges and any number of outgoing edges. DagNodes keep track only of their incoming edges, but the entire graph structure can be inferred by looking at the furthest downstream nodes and working backwards.
Hashing: DagNodes must be hashable, and two nodes are considered to be equivalent if they have the same hash value.
Nodes are immutable, and the hash should remain constant as a result. If a node with new contents is required, create a new node and throw the old one away.
String representation: In order for graph visualization tools to show useful information, nodes must be representable as strings. The “String“ operator should provide a more or less "full" representation of the node, and the “ShortRepr“ property should be a shortened, concise representation.
Again, because nodes are immutable, the string representations should remain constant.
type Graph ¶
type Graph struct { OutputStream string `json:"output_stream"` GraphOptions GraphOptions `json:"graph_options"` Nodes []GraphNode `json:"nodes"` }
type GraphOptions ¶
type KwArgs ¶
type KwArgs map[string]interface{}
func MergeKwArgs ¶
func (KwArgs) EscapeWith ¶
func (KwArgs) GetDefault ¶
func (KwArgs) PopDefault ¶
func (KwArgs) SortedKeys ¶
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
func FilterMultiOutput ¶
func NewFilterNode ¶
func NewGlobalNode ¶
func NewMergeOutputsNode ¶
func NewOutputNode ¶
func (*Node) GetInComingEdges ¶
func (*Node) IncomingEdgeMap ¶
type Stream ¶
type Stream struct { Node *Node Label Label Selector Selector Type string FfmpegPath string Context context.Context }
func Input ¶
Input file URL (ffmpeg “-i“ option)
Any supplied kwargs are passed to ffmpeg verbatim (e.g. “t=20“, “f='mp4'“, “acodec='pcm'“, etc.).
To tell ffmpeg to read from stdin, use “pipe:“ as the filename.
Official documentation: `Main options <https://ffmpeg.org/ffmpeg.html#Main-options>`__
func MergeOutputs ¶
Include all given outputs in one ffmpeg command line
func Output ¶
Output file URL
Syntax: `ffmpeg.Output([]*Stream{stream1, stream2, stream3...}, filename, kwargs)` Any supplied keyword arguments are passed to ffmpeg verbatim (e.g. ``t=20``, ``f='mp4'``, ``acodec='pcm'``, ``vcodec='rawvideo'``, etc.). Some keyword-arguments are handled specially, as shown below. Args: video_bitrate: parameter for ``-b:v``, e.g. ``video_bitrate=1000``. audio_bitrate: parameter for ``-b:a``, e.g. ``audio_bitrate=200``. format: alias for ``-f`` parameter, e.g. ``format='mp4'`` (equivalent to ``f='mp4'``). If multiple streams are provided, they are mapped to the same output. To tell ffmpeg to write to stdout, use ``pipe:`` as the filename. Official documentation: `Synopsis <https://ffmpeg.org/ffmpeg.html#Synopsis>`__ """
func OutputContext ¶
func OutputContext(ctx context.Context, streams []*Stream, fileName string, kwargs ...KwArgs) *Stream
Output file URL
Syntax: `ffmpeg.Output(ctx, []*Stream{stream1, stream2, stream3...}, filename, kwargs)` Any supplied keyword arguments are passed to ffmpeg verbatim (e.g. ``t=20``, ``f='mp4'``, ``acodec='pcm'``, ``vcodec='rawvideo'``, etc.). Some keyword-arguments are handled specially, as shown below. Args: video_bitrate: parameter for ``-b:v``, e.g. ``video_bitrate=1000``. audio_bitrate: parameter for ``-b:a``, e.g. ``audio_bitrate=200``. format: alias for ``-f`` parameter, e.g. ``format='mp4'`` (equivalent to ``f='mp4'``). If multiple streams are provided, they are mapped to the same output. To tell ffmpeg to write to stdout, use ``pipe:`` as the filename. Official documentation: `Synopsis <https://ffmpeg.org/ffmpeg.html#Synopsis>`__ """
func (*Stream) ColorChannelMixer ¶
todo fix this
func (*Stream) ErrorToStdOut ¶
func (*Stream) GlobalArgs ¶
Add extra global command-line argument(s), e.g. “-progress“.
func (*Stream) OverWriteOutput ¶
func (*Stream) OverwriteOutput ¶
Overwrite output files without asking (ffmpeg “-y“ option)
Official documentation: `Main options <https://ffmpeg.org/ffmpeg.html#Main-options>`_
func (*Stream) Run ¶
func (s *Stream) Run(options ...CompilationOption) error
func (*Stream) RunWithResource ¶
func (*Stream) SetFfmpegPath ¶
func (*Stream) WithCpuCoreLimit ¶
func (*Stream) WithCpuCoreRequest ¶
func (*Stream) WithCpuSet ¶
func (*Stream) WithMemSet ¶
type ViewType ¶
type ViewType string
const ( // FlowChart the diagram type for output in flowchart style (https://mermaid-js.github.io/mermaid/#/flowchart) (including current state ViewTypeFlowChart ViewType = "flowChart" // StateDiagram the diagram type for output in stateDiagram style (https://mermaid-js.github.io/mermaid/#/stateDiagram) ViewTypeStateDiagram ViewType = "stateDiagram" )