@omnimedia/omnitool
Version:
open source video processing tools
37 lines • 1.42 kB
JavaScript
import { Application, Sprite, Texture } from "pixi.js";
import { makeTransition } from "../../features/transition/transition.js";
export async function setupTransitionsTest(driver, source) {
const app = new Application();
await app.init({ width: 300, height: 300, preference: "webgl" });
const preview = new Sprite({ width: 300, height: 300 });
app.stage.addChild(preview);
document.body.appendChild(app.canvas);
const transition = makeTransition({ name: "circle", renderer: app.renderer });
async function run() {
const video = driver.decodeVideo({
source,
async onFrame(frame) {
const texture = Texture.from(frame);
const transitionTexture = transition.render({
from: texture,
to: texture,
progress: 0.7,
width: app.canvas.width,
height: app.canvas.height
});
preview.texture = transitionTexture;
texture.destroy(false);
return frame;
}
});
driver.encode({
video: video.readable,
config: {
audio: { codec: "opus", bitrate: 128000 },
video: { codec: "vp9", bitrate: 1000000 }
}
});
}
return { run };
}
//# sourceMappingURL=transitions-test.js.map