Skip to content

rust-av/rav1e_js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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