Preset
data-variant=info
data-slots=text
Since: 27.0
A Preset represents an export preset: a named set of encoding settings for an export format. Use it to read the identity, format, and settings of a preset, and to get the file path that the RenderQueue methods expect as presetFilePath.
A Preset is returned by the PresetManager methods, rather than constructed directly. All Preset members are instance methods.
const app = require("mediaencoder");
const [preset] = app.PresetManager.getPresetsForFormat("H.264");
preset.getDisplayName();
await app.RenderQueue.renderFile("path/to/source.mov", preset.getFilePath(), "path/to/out.mp4");
Methods
getDisplayName
Returns the display name of the preset, localized to the language of the Media Encoder user interface.
Since: 27.0
Parameters
none
Returns
const app = require("mediaencoder");
const [preset] = app.PresetManager.getPresetsForFormat("H.264");
preset.getDisplayName();
getMatchName
Returns the match name of the preset, which identifies the preset in code.
Since: 27.0
Parameters
none
Returns
const app = require("mediaencoder");
const [preset] = app.PresetManager.getPresetsForFormat("H.264");
preset.getMatchName();
getID
Returns the unique ID (GUID) of the preset. Pass it to PresetManager.findPresetByID to find the preset again later.
Since: 27.0
Parameters
none
Returns
const app = require("mediaencoder");
const [preset] = app.PresetManager.getPresetsForFormat("H.264");
const presetId = preset.getID();
app.PresetManager.findPresetByID(presetId);
getFolderDisplayPath
Returns the folder path under which the preset is organized in the Media Encoder user interface.
Since: 27.0
Parameters
none
Returns
const app = require("mediaencoder");
const [preset] = app.PresetManager.getPresetsForFormat("H.264");
preset.getFolderDisplayPath();
getFilePath
Returns the full path to the preset file on disk. Pass it as presetFilePath to RenderQueue.renderFile, RenderQueue.enqueueFile, or the other render methods.
Since: 27.0
Parameters
none
Returns
const app = require("mediaencoder");
const [preset] = app.PresetManager.getPresetsForFormat("H.264");
await app.RenderQueue.enqueueFile("path/to/source.mov", preset.getFilePath(), "path/to/out.mp4");
getFormatName
Returns the name of the export format of the preset.
Since: 27.0
Parameters
none
Returns
"H.264" or "QuickTime"const app = require("mediaencoder");
const preset = app.PresetManager.loadPresetFromFile("path/to/preset.epr");
preset.getFormatName(); // "H.264"
getPresetType
Returns where the preset comes from: "system" for a preset that comes with Media Encoder, or "custom" for a preset that a user created. Presets loaded with PresetManager.loadPresetFromFile are "custom".
Since: 27.0
Parameters
none
Returns
"system" or "custom"const app = require("mediaencoder");
const systemPresets = app.PresetManager.getPresetsForFormat("H.264").filter(
(preset) => preset.getPresetType() === "system",
);
isIngestPreset
Returns whether the preset is an ingest preset. Ingest presets can't be used for watch folder outputs, see WatchFolder.addOutput.
Since: 27.0
Parameters
none
Returns
true if the preset is an ingest presetconst app = require("mediaencoder");
const preset = app.PresetManager.loadPresetFromFile("path/to/preset.epr");
preset.isIngestPreset(); // false
getComments
Returns the comments of the preset, localized to the language of the Media Encoder user interface.
Since: 27.0
Parameters
none
Returns
const app = require("mediaencoder");
const preset = app.PresetManager.loadPresetFromFile("path/to/preset.epr");
preset.getComments();
getSummaryJSON
Returns a summary of all settings of the preset, including the video, audio, and encoding parameters, as a JSON string.
Since: 27.0
Parameters
none
Returns
const app = require("mediaencoder");
const preset = app.PresetManager.loadPresetFromFile("path/to/preset.epr");
const summary = JSON.parse(preset.getSummaryJSON());