Polyfill for WebCodecs, powered by ffmpeg.wasm
Helpful for newbies like me who don't use browserify, and didn't realise it was as easy as including a script tag (until I saw the codepen examples). |
||
|---|---|---|
| .github | ||
| docs | ||
| examples | ||
| scripts | ||
| src | ||
| tests | ||
| _config.yml | ||
| .eslintrc | ||
| .gitattributes | ||
| .gitignore | ||
| .gitpod.Dockerfile | ||
| .gitpod.yml | ||
| .npmignore | ||
| CODE_OF_CONDUCT.md | ||
| CONTRIBUTING.md | ||
| LICENSE | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
ffmpeg.js
Use FFmpeg directly in your browser without any backend services!!
Transcode
Examples:
| Name | Demo | Source Code |
|---|---|---|
| Webcam | ![]() |
Link |
ffmpeg.js provides simple to use APIs, to transcode a video you only need few lines of code:
const fs = require('fs');
const { createWorker } = require('@ffmpeg/ffmpeg');
const worker = createWorker();
(async () => {
await worker.load();
await worker.write('test.avi', './test.avi');
await worker.transcode('test.avi', 'test.mp4');
const { data } = await worker.read('test.mp4');
fs.writeFileSync('./test.mp4', data);
})();
Installation
$ npm install @ffmpeg/ffmpeg
As we use
worker_threadswhich was introduced in Node.js v10.5.0, please remember to add--experimental-workerif you are using Node.js v10, and you don't have to add anything if you are using Node.js v12
Or, using a script tag in the browser:
<script src="https://unpkg.com/@ffmpeg/ffmpeg@0.6.0/dist/ffmpeg.min.js"></script>
<script>
const { createWorker } = FFmpeg;
...
</script>
Documentation
Tutorials
Learn how to build ffmpeg.js from stories: