All Projects → ffmpegwasm → Ffmpeg.wasm

ffmpegwasm / Ffmpeg.wasm

Licence: mit
FFmpeg for browser and node, powered by WebAssembly

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to Ffmpeg.wasm

Modfy.video
A video transcoder and converter built using Web Assembly and FFMPEG to transcode and convert videos right in your browser while protecting your privacy
Stars: ✭ 283 (-95.69%)
Mutual labels:  ffmpeg, wasm
Ffmpy
Pythonic interface for FFmpeg/FFprobe command line
Stars: ✭ 360 (-94.52%)
Mutual labels:  ffmpeg
Desktopsharing
桌面共享, 支持RTSP转发, RTSP推流, RTMP推流。
Stars: ✭ 337 (-94.87%)
Mutual labels:  ffmpeg
Coderyi.github.io
Don't fork! coderyi's blog,about iOS ,CS and my code life.
Stars: ✭ 349 (-94.68%)
Mutual labels:  ffmpeg
Aaxaudioconverter
Convert Audible aax files to mp3 and m4a/m4b
Stars: ✭ 336 (-94.88%)
Mutual labels:  ffmpeg
React Wasm
Declarative WebAssembly instantiation for React
Stars: ✭ 349 (-94.68%)
Mutual labels:  wasm
Cicadaplayer
CicadaPlayer is the player core of AliPlayer, which support multiple platform Android, iOS, macOS, Windows, Linux, and WebAssembly for now. The goal is providing a player core which support multi platform, hardware accelerator, customizable and extensible features. Which support WideVine drm and LHLS.
Stars: ✭ 334 (-94.91%)
Mutual labels:  ffmpeg
Lys
⚜︎ A language that compiles to WebAssembly
Stars: ✭ 375 (-94.29%)
Mutual labels:  wasm
Awesome Yew
😎 A curated list of awesome things related to Yew / WebAssembly.
Stars: ✭ 353 (-94.62%)
Mutual labels:  wasm
Dms
A UPnP DLNA Digital Media Server that includes basic video transcoding. Tested on a Panasonic Viera television, several Android UPnP apps, and Chromecast.
Stars: ✭ 347 (-94.72%)
Mutual labels:  ffmpeg
Handbrake Js
Video encoding / transcoding / converting for node.js
Stars: ✭ 345 (-94.75%)
Mutual labels:  ffmpeg
Giraffeplayer2
out of the box android video player(support lazy load, ListView/RecyclerView and hight performance)
Stars: ✭ 344 (-94.76%)
Mutual labels:  ffmpeg
Php Practice
🌹 一天一点点,积少成多...
Stars: ✭ 351 (-94.65%)
Mutual labels:  ffmpeg
Unrust
unrust - A pure rust based (webgl 2.0 / native) game engine
Stars: ✭ 341 (-94.81%)
Mutual labels:  wasm
Wac
WebAssembly interpreter in C
Stars: ✭ 372 (-94.33%)
Mutual labels:  wasm
Restream
Stream your reMarkable screen over SSH.
Stars: ✭ 335 (-94.9%)
Mutual labels:  ffmpeg
Tifig
A fast HEIF image converter aimed at thumbnailing
Stars: ✭ 345 (-94.75%)
Mutual labels:  ffmpeg
Mpv thumbnail script
A Lua script to show preview thumbnails in mpv's OSC seekbar, sans external dependencies
Stars: ✭ 350 (-94.67%)
Mutual labels:  ffmpeg
Lucet
Lucet, the Sandboxing WebAssembly Compiler.
Stars: ✭ 4,006 (-38.99%)
Mutual labels:  wasm
Piper
piper - a distributed workflow engine
Stars: ✭ 374 (-94.3%)
Mutual labels:  ffmpeg

ffmpeg.wasm

ffmpeg.wasm

Node Version Actions Status CodeQL npm (tag) Maintenance License: MIT Code Style Downloads Total Downloads Month

ffmpeg.wasm is a pure Webassembly / Javascript port of FFmpeg. It enables video & audio record, convert and stream right inside browsers.

AVI to MP4 Demo

transcode-demo

Try it: https://ffmpegwasm.netlify.app

Installation

Node

$ npm install @ffmpeg/ffmpeg @ffmpeg/core

As we are using the latest experimental features, you need to add few flags to run in Node.js

$ node --experimental-wasm-threads --experimental-wasm-bulk-memory transcode.js

Browser

Or, using a script tag in the browser (only works in some browsers, see list below):

SharedArrayBuffer is only available to pages that are cross-origin isolated. So you need to host your own server with Cross-Origin-Embedder-Policy: require-corp and Cross-Origin-Opener-Policy: same-origin headers to use ffmpeg.wasm.

<script src="static/js/ffmpeg.min.js"></script>
<script>
  const { createFFmpeg } = FFmpeg;
  ...
</script>

Only browsers with SharedArrayBuffer support can use ffmpeg.wasm, you can check HERE for the complete list.

Usage

ffmpeg.wasm provides simple to use APIs, to transcode a video you only need few lines of code:

const fs = require('fs');
const { createFFmpeg, fetchFile } = require('@ffmpeg/ffmpeg');

const ffmpeg = createFFmpeg({ log: true });

(async () => {
  await ffmpeg.load();
  ffmpeg.FS('writeFile', 'test.avi', await fetchFile('./test.avi'));
  await ffmpeg.run('-i', 'test.avi', 'test.mp4');
  await fs.promises.writeFile('./test.mp4', ffmpeg.FS('readFile', 'test.mp4'));
  process.exit(0);
})();

Use other version of ffmpeg.wasm-core / @ffmpeg/core

For each version of ffmpeg.wasm, there is a default version of @ffmpeg/core (you can find it in devDependencies section of package.json), but sometimes you may need to use newer version of @ffmpeg/core to use the latest/experimental features.

Node

Just install the specific version you need:

$ npm install @ffmpeg/core@latest

Or use your own version with customized path

const ffmpeg = createFFmpeg({
  corePath: '../../../src/ffmpeg-core.js',
});

Browser

const ffmpeg = createFFmpeg({
  corePath: 'static/js/ffmpeg-core.js',
});

For the list available versions and their changelog, please check: https://github.com/ffmpegwasm/ffmpeg.wasm-core/releases

Multi-threading

Multi-threading need to be configured per external libraries, only following libraries supports it now:

x264

Run it multi-threading mode by default, no need to pass any arguments.

libvpx / webm

Need to pass -row-mt 1, but can only use one thread to help, can speed up around 30%

Documentation

FAQ

What is the license of ffmpeg.wasm?

There are two components inside ffmpeg.wasm:

@ffmpeg/core contains WebAssembly code which is transpiled from original FFmpeg C code with minor modifications, but overall it still following the same licenses as FFmpeg and its external libraries (as each external libraries might have its own license).

@ffmpeg/ffmpeg contains kind of a wrapper to handle the complexity of loading core and calling low-level APIs. It is a small code base and under MIT license.

Can I use ffmpeg.wasm in Firefox?

Yes, but only for Firefox 79+ with proper header in both client and server, visit https://ffmpegwasm.netlify.app to try whether your Firefox works.

For more details: https://github.com/ffmpegwasm/ffmpeg.wasm/issues/106

What is the maximum size of input file?

2 GB, which is a hard limit in WebAssembly. Might become 4 GB in the future.

How can I build my own ffmpeg.wasm?

In fact, it is ffmpeg.wasm-core most people would like to build.

To build on your own, you can check build.sh inside https://github.com/ffmpegwasm/ffmpeg.wasm-core repository.

Also you can check this series of posts to learn more fundamental concepts:

Why it doesn't work in my local environment?

When calling ffmpeg.load(), by default it looks for http://localhost:3000/node_modules/@ffmpeg/core/dist/ to download essential files (ffmpeg-core.js, ffmpeg-core.wasm, ffmpeg-core.worker.js). It is necessary to make sure you have those files served there.

If you have those files serving in other location, you can rewrite the default behavior when calling createFFmpeg():

const { createFFmpeg } = FFmpeg;
const ffmpeg = createFFmpeg({
  corePath: "http://localhost:3000/public/ffmpeg-core.js",
  // Use public address if you don't want to host your own.
  // corePath: 'https://unpkg.com/@ffmpeg/[email protected]/dist/ffmpeg-core.js'
  log: true,
});
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].