Read this plugin's mode, what the player does now and why each mode cannot work.
The state. The first call of any plugin looks for the GPU (no device is created, so no GPU is woken).
Choose this plugin's motion smoothing mode.
off, double or display.
The new state.
The mode stays this plugin's request until it changes it or stops; the
player applies it whenever it can work (a rate, size, format, doubling, other-engine, upscaling,
failed or overload reason can pass with the next video). off
takes the converter out at once unless another plugin asks for it. The
mode is a request of the whole plugin, not of a Scope.
unsupported (rejects) A mode that cannot work in this run:
platform, no-gpu, runtime, filter, and rendering for
display once GPU rendering is not just starting; message is the
reason. Nothing changes. off is always accepted.
The plugin asks for Match Display and tells the user when it waits (the video's rate, AI upscaling) or cannot work in this run.
try {
const state = await plugin.video.motion("amd").set("display");
// Kept, but waiting for a reason that can pass.
if (state.active === "off" && state.display)
await plugin.osd.show("Motion smoothing waits: {}", [state.display.message]);
} catch (error) {
// Cannot work in this run: nothing changed.
if ((error as PluginError).code !== "unsupported") throw error;
await plugin.osd.show("Motion smoothing: {}", [(error as PluginError).message]);
}
Call listener with the new state whenever it changes while some
plugin asks for motion smoothing: what is active, the reasons, the
search mode, the rates.
Receives the new state.
Stops listening; also when the scope that added it is disposed.
The player looks twice a second while a mode is asked for and sends a
change only when something differs (the measured output rate in
tenths); after the last plugin turns it off one more change says so.
Nothing is sent before the first state() or set() of any plugin.
mode is this plugin's own request, as in state().
A listener keeps the plugin running, as VideoUpscaling.onChange's does: listen only while a window or panel shows the state.
The plugin listens only while its panel shows, since the listener keeps the plugin running.
const watch = plugin.video.motion("amd").onChange((state) => {
console.log(`${state.sourceFps ?? "?"} → ${state.outputFps ?? "off"} fps on ${state.gpu ?? "no GPU"}`);
});
// When the panel hides:
await watch.dispose();
plugin.video.motion(engine): motion smoothing, the video's frame rate doubled by a GPU vendor's frame-rate converter (AMD AMF's or NVIDIA'sfruc_vulkan, on Windows). Read whether it works here and why not; choose a mode for this plugin.Remarks
The converter makes real in-between frames (motion estimation, not blending). While some plugin asks for a mode that can work, the player puts the converter last in the video filter chain, decodes with copy-back (the converter needs the frames in memory) and, for
display, has the GPU renderer interpolate the doubled frames to the display. The strongest mode any plugin asked for applies; a stopped plugin's request is revoked.The player watches the converter while the video plays: when its output falls behind the doubled rate or many frames are dropped, it first switches to a faster motion search on downscaled frames, then turns the converter off for this video with an
overloadreason. The next video starts afresh.Motion smoothing and AI upscaling exclude each other (the upscaler needs the frames on the GPU, the converter in memory): while upscaling is on, every mode waits with
upscaling. Doubling makes film look like video (the "soap-opera effect"): offer it off by default.Windows:
amd: an AMD Radeon GPU with the AMD driver (AMF);nvidia: an NVIDIA GeForce RTX 30 or newer GPU with driver 573.38 or newer (the converter gets a Vulkan device of its own while it runs, the renderer is not involved; it starts on slow optical flow on a 4-pixel grid, fast above 1440p). On a laptop with two GPUs the converter runs on the engine's GPU, whichever GPU renders. One engine's converter at a time: the other's modes wait withother-engine. macOS, Linux: every mode reportsplatform.Example: Offer the three modes as radio commands
Each command chooses one mode; one the player cannot run here is refused with
unsupported, and the state is read again for its reason.Player
0.8.1
Since
1.7.19