rust-av / rav1e_js

rav1e js/wasm bindings

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rav1e_js

The slowest and most dangerous AV1 encoder of the web.

About

rav1e_js aims to bring the power of rav1e to the web!

Usage

Api

  1. Clone + enter the repository
    git clone https://github.com/rust-av/rav1e_js
    cd rav1e_js
  2. Install wasm-pack
    curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
  3. Build package
    # Build (emits wasm-, js/ts-files to pkg/)
    wasm-pack build
  4. Add file dependency to package.json
    {
        // ...
        "dependencies": {
            "rav1e": "file:path/to/pkg",
            // ...
        },
        // ...
    }
  5. Use it in your project:
    import { ChromaSampling, EncoderConfig, VideoEncoder } from "rav1e";
    
    // ...

Example Website

Run rebuild.sh:

bash rebuild.sh

or run:

wasm-pack build

cd www/
npm install
npm start
# website served at localhost:3000

Please first enter the developer console and then start playing the video. You should see logging about the data collection and encoding.

Note!: This can take quite a while.

If it doesn't start, please try:

  1. reload the webpage

Testing

# test in browser
wasm-pack test --headless --[firefox, chrome, safari]

# test in node
wasm-pack test --node

About

rav1e js/wasm bindings

License:BSD 2-Clause "Simplified" License


Languages

Language:Rust 77.5%Language:TypeScript 16.7%Language:HTML 2.3%Language:CSS 1.6%Language:JavaScript 1.4%Language:Shell 0.6%