Preset Manager
data-variant=info
data-slots=text
Since: 27.0
The PresetManager object gives access to the export presets that Media Encoder knows about: the system presets that come with Media Encoder and the custom presets that users created. Use it to list the available export formats, to find presets by format, display name, or ID, and to load a preset from an .epr file. Each preset is returned as a Preset object.
All PresetManager members are class members. Call them on app.PresetManager:
const app = require("mediaencoder");
const formatNames = app.PresetManager.getFormatNameList(); // ["H.264", "QuickTime", ...]
const presets = app.PresetManager.getPresetsForFormat("H.264");
To render with a preset, pass its file path to a RenderQueue method:
const app = require("mediaencoder");
const [preset] = app.PresetManager.findPresetsByName("My H.264 Preset");
await app.RenderQueue.renderFile("path/to/source.mov", preset.getFilePath(), "path/to/out.mp4");
Properties
userPresetsLocation
The file system path to the folder where Media Encoder stores user presets.
Type: string (readonly, class)
Since: 27.0
const app = require("mediaencoder");
const userPresetsFolder = app.PresetManager.userPresetsLocation;
Methods
getFormatNameList
Returns the names of all available export formats.
Since: 27.0
Parameters
none
Returns
"H.264" or "QuickTime"const app = require("mediaencoder");
const formatNames = app.PresetManager.getFormatNameList();
getPresetsForFormat
Returns all presets of an export format, first the system presets, then the custom presets. To tell them apart, call getPresetType on each preset.
Since: 27.0
Parameters
Returns
const app = require("mediaencoder");
const customPresets = app.PresetManager.getPresetsForFormat("H.264").filter(
(preset) => preset.getPresetType() === "custom",
);
findPresetByID
Finds a preset by its unique ID (GUID).
Since: 27.0
Parameters
Returns
Preset, or null if no preset has this ID.
const app = require("mediaencoder");
const preset = app.PresetManager.findPresetByID(presetId);
if (preset) {
console.log(preset.getDisplayName());
}
findPresetsByName
Finds presets by display name. The name must match exactly. Presets of different formats can have the same name, so the result can contain several presets.
Since: 27.0
Parameters
Returns
const app = require("mediaencoder");
const presets = app.PresetManager.findPresetsByName("My H.264 Preset");
presets.forEach((preset) => console.log(preset.getFormatName(), preset.getID()));
loadPresetFromFile
Loads a preset from a preset (.epr) file. If the file isn't found at the given path, the path is also tried relative to the Media Encoder application folder, where the system presets are installed.
Since: 27.0
Parameters
.epr) fileReturns
Preset, or null if the file doesn't exist or can't be read. getPresetType returns "custom" for a preset loaded from a file.
const app = require("mediaencoder");
const preset = app.PresetManager.loadPresetFromFile("path/to/preset.epr");
if (preset) {
console.log(preset.getDisplayName(), preset.getFormatName());
}