Skip to content

Custom Encoder Specifications

DepFA edited this page Jan 14, 2023 · 2 revisions

The folder customEnoderSpecs allows users to specify their own series of flags to be sent to ffmpeg at encode time.

The general structure of the file should contain headers for name, extension, multi-pass-encode and some collection of commandBlocks

{
	"name":"VP9 10bpp",
	"baseEncoder":"",
	"extension":"webm",
	"multi-pass-encode":true,
	"commandBlocks":[...]
}

The properties name, extension are combined to create the name of the encoder in the gui, in the format extension:name, for example this encoder will appear as webm:VP9 10bpp

The listing of command blocks defines an ordered list of blocks of commands that are appended to the ffmpeg command before it's run, they can either be a straight list of commands like :

...
"commandBlocks":[
    {"cmds":["-shortest", "-copyts", "-start_at_zero", "-c:v","libvpx-vp9"]}
]
...

Which will always append -shortest -copyts -start_at_zero -c:v libvpx-vp9.

Or conditional blocks like:

...
"commandBlocks":[
    {
     "conditions":[["passPhase","equals","1"]],
     "cmds":[],
     "altCmds":["-speed", "1"]	
    }
]
...

Which will check if the condition passphrase equals 1 is true, if it evaluates to true the list of commands inside the cmds list is appended to the ffmpeg command line, if it's false the list of commands inside the altCmds is used instead - in this case in pass 1 of a multi-pass encode nothing is added, but in pass 2 -speed 1 is appended.

The first value in a condition should be a property exposed by the WmG encoder api, currently these are:

  • audioChannels - one of Copy, Stereo, Mono, No audio
  • forceBestDeadline - if the force Best Deadline option is set in the encode run.
  • br - the currently calculated bitrate.
  • passPhase - the multi stage encoding pass number 1 or 2 for multi-stage or 0 for single stage encodes.
  • metadata_title - a cleaned version of the filename for use in metadata embedding.
  • encoderStageThreads - the number of threads set to use in the WmG options.
  • maximumSize, maximumSize - the minimimum and maximum file size requested as output in Mb.
  • sizeLimitMax, sizeLimitMin - the minimimum and maximum file size requested as output in bytes.
  • minimumPSNR - the minimum requested PSNR for the output file quality.

All of these can also be used as merge values inside the commands when wrapped inside {braces}, such as using the calculated bitrate based on requested filesize:

...
"commandBlocks":[
    {"cmds":["-b:v", "{br}"]}
]
...

A tool for cutting, filtering and joining video clips, supports webm, mp4 and high quality gif outputs.

Clone this wiki locally