FFmpeg.wasm 설치
import { FFmpeg } from "@ffmpeg/ffmpeg";
import { fetchFile } from "@ffmpeg/util";
const ffmpeg = new FFmpeg();
await ffmpeg.load();동영상 변환
// MP4 → GIF 변환
await ffmpeg.writeFile("input.mp4", await fetchFile(videoFile));
await ffmpeg.exec([
"-i", "input.mp4",
"-vf", "fps=10,scale=320:-1",
"-t", "5",
"output.gif"
]);
const data = await ffmpeg.readFile("output.gif");
const url = URL.createObjectURL(new Blob([data]));활용
- 썸네일 추출
- 포맷 변환
- 트리밍/자르기
댓글 0