36 lines
703 B
TypeScript
36 lines
703 B
TypeScript
import { execa } from "execa";
|
|
import ffmpegPath from "ffmpeg-static";
|
|
import path from "node:path";
|
|
|
|
export async function encodeFrames({
|
|
inputPattern,
|
|
output,
|
|
fps = 30,
|
|
}: {
|
|
inputPattern: string;
|
|
output: string;
|
|
fps?: number;
|
|
}) {
|
|
console.log("kleje filmik");
|
|
await execa(ffmpegPath!, [
|
|
"-y",
|
|
"-pattern_type", "glob",
|
|
"-framerate", fps.toString(),
|
|
"-i", inputPattern,
|
|
|
|
"-i", path.resolve("./music.mp3"),
|
|
|
|
"-c:v", "libx264",
|
|
"-pix_fmt", "yuv420p",
|
|
|
|
|
|
"-c:a", "mp3",
|
|
|
|
"-shortest",
|
|
// "-preset", "medium",
|
|
// "-crf", "18",
|
|
output,
|
|
]);
|
|
console.log("filmik sklejony");
|
|
}
|