Skip to main content

FFmpeg Builder

The FFmpeg Builder is part of the Video plugin.

This lets the user break down a complex FFmpeg command into easy to configure nodes and will build up a command that can be executed at once.

This allows the user to for example convert video to HEVC, add an AC3 audio track, copy all subtitles and normalize the audio.

The FFmpeg builder will parse the Video File and build a list of all streams in a file. If a stream has not been explicitly set to delete, or a codec conversion has been set, that stream will by default be copied to the new file.

So that means, if you have not done anything with subtitles, for example, all the subtitles from the original file will be copied to the output file.


FFmpeg Builder: Start

FFmpeg Builder: Start

The FFmpeg Build must first begin with the "FFmpeg Builder: Start" node. This flow element is what constructs the builder and parses the video information for the builder.


FFmpeg Builder: Executor

FFmpeg Builder: Executor

The final part of the FFmpeg Builder is the "FFmpeg Builder: Executor" this is what takes the FFmpeg Builder, constructs into into a command for FFmpeg and executes it. If will not execute, output 2, if nothing has been detected as needing to be executed. If will return an output of -1 if the execution fails and the flow will exit.

Hardware Decoding

ModeDescription
OffNo hardware decoder will be used
OnHardware decoders will be tested and the first one tht passes will be used, if not CPU will be used
AutomaticIf the Bit value is the same, eg 8bit to 8bit or 10bit 10bit then hardware decoding will be used, otherwise CPU will be used

Strictness

Allows you to customize the strictness of FFmpeg. This should be left on Experimental for most users.

Probe Size

The size of the data to analyze to get stream information. A higher value will enable detecting more information in case it is dispersed into the stream, but will increase latency.

Default is 5MB


Variables

VariableDescriptionTypeExample
NoNvidiaThe disables NVIDIA hardware encoding/decodingbooleantrue
NoQSVThe disables Intel Quicksync Video hardware encoding/decodingbooleantrue
NoAMDThe disables AMD/AMF hardware encoding/decodingbooleantrue
NoVAAPIThe disables VAAPI hardware encoding/decodingbooleantrue
FfmpegBuilderModelThe FFmpeg Builder modelobjectsee below

FfmpegBuilderModel Object

This object is the what the FFmpeg Builder uses to process a video.

It has Video, Audio and Subtitle streams available to it.

// The video streams of the file
VideoStreams:FfmpegVideoStream[]
// The audio streams of the file
AudioStreams:FfmpegAudioStream[]
// The subtitle streams of the file
SubtitleStreams:FfmpegSubtitleStream[]
// Any metadata parameters to process
MetadataParameters:string[]
// The extension of the output file
Extension:string
// The input files
InputFiles:string[]
// Any custom parameters to add to the executor
CustomParameters:string[]
// If this should be forced encoded even if no changes are detected
ForceEncode:bool
// if attachments should be removed from the output file
RemoveAttachments:bool
// the original VideoInfo the FFmpeg Builder Start used to construct this model
VideoInfo:VideoInfo

class VideoInfo
{
    FileName: string;
    Bitrate: number;
    VideoStreams: VideoStream[];
    AudioStreams: AudioStream[];
    SubtitleStreams: SubtitleStream[];
    Chapters: Chapter[];
}

class VideoFileStream
{
    // overall index of this stream
    Index: number;
    // the index relative to the stream type
    TypeIndex: number;
    // the title of hte video
    Title: string;
    // the video bitrate
    Bitrate: number;
    // the codec used
    Codec: string;
    // if this stream is an image stream
    IsImage: boolean;
    // the formated index as a FFmpeg string
    IndexString: string;
    // the index of the input file
    InputFileIndex: number;
}

class VideoStream extends VideoFileStream
{
    // if this is HDR or not
    HDR: boolean;
    // if this is dolby vision or not
    DolbyVision: boolean;
    // the width in pixels
    Width: number;
    // the height in pixels
    Height: number;
    // the number of frames per second
    FramesPerSecond: number;
    // the duration of the video in seconds
    Duration: number;
    // the bits of the video if detected, 0 if undetected
    Bits: number;
}

class AudioStream extends VideoFileStream
{
    Language: string;
    Channels: number;
    Duration: number;
    SampleRate: number;
}

class SubtitleStream extends VideoFileStream
{
    Language: string;
    Forced: boolean;
}

class Chapter
{
    Title: string;
    Start: number;
    End: number;
}

FFmpegStream

This is the common base class for each stream type

// If this stream should be removed from the output
Deleted: bool
// The overall index of the stream
Index: number
// The title of the stream
Title: string
// The language of the stream
Language: string
// If true this stream changes will be forced
ForcedChange: bool
// If this stream is the default stream or not
IsDefault: bool

FfmpegVideoStream : FfmpegStream

This is a Video stream of the FfmpegBuilderModel, subclass of FfmpegStream

// The original VideoStream from VideoInfo 
Stream:VideoStream
// Any filters to be applied to the video, if set will force a change
Filters:string[]
// Any optional filters that should only be applied if a change is detected
OptionalFilter:string[]
// The encoding parameters of the video
EncodingParameters:string[]
// Any optional encoding parameters tha will only be used if there is encoding parameters etc
OptionalEncodingParameters:string[]
// Any additional parameters to be applied to this stream
AdditionalParameters:string[]

FfmpegAudioStream : FfmpegStream

This is a audio stream of the FfmpegBuilderModel, subclass of FfmpegStream

// The original AudioStream from VideoInfo 
Stream:AudioStream
// Any filters to be applied to the audio, if set will force a change
Filters:string[]
// The encoding parameters of the audio
EncodingParameters:string[]

FfmpegSubtitleStream : FfmpegStream

This is a subtitle stream of the FfmpegBuilderModel, subclass of FfmpegStream

// The original AudioStream from VideoInfo 
Stream:SubtitleStream