ffmpeg libraries precompiled for WebAsembly/WASI, as a Rust crate.

Overview

FFMPEG crate for WebAssembly/WASI

This crate bundles FFMPEG's libraries, precompiled for WebAssembly. No native installation required.

Compatible with Fastly's Compute@Edge.

These are low-level bindings, directly exposing the original C functions to Rust.

Usage

[dependencies]
ffmpeg-wasi = "0"
use ffmpeg_wasi::*;

#[global_allocator]
static ALLOCATOR: FFMpegAllocator = FFMpegAllocator;
You might also like...
Yet another video to ASCII animation (in Rust)
Yet another video to ASCII animation (in Rust)

Yet another video to ASCII tool (in Rust) Requirements opencv Installation cargo install video2ascii You may also want to add

Xiu - A simple and secure live media server in pure Rust (RTMP/HTTP-FLV/HLS/Relay).🦀
Xiu - A simple and secure live media server in pure Rust (RTMP/HTTP-FLV/HLS/Relay).🦀

Xiu is a simple and secure live media server written by pure Rust, it now supports popular live protocols like RTMP/HLS/HTTP-FLV (and maybe other protocols in the future), you can deploy it as a stand-alone server or a cluster using the relay feature.

Media Cleaner is a simple CLI tool to clean up your media library based on your Overseerr requests and Tautulli history, written in Rust.

Media Cleaner Media Cleaner is a simple CLI tool to clean up your media library based on your Overseerr requests and Tautulli history, written in Rust

This is a lightweight audio-video player built in Rust using FFmpeg libraries. It demonstrates the usage of FFmpeg with Rust to play back video files.

FFmpeg Rust Video Player This is a lightweight audio-video player built in Rust using FFmpeg libraries. It demonstrates the usage of FFmpeg with Rust

A fork of the abandoned ffmpeg-next crate which is a fork of the abandoned ffmpeg crate

This is a fork of the abandoned ffmpeg-next crate which is a fork of the abandoned ffmpeg crate. Currently supported FFmpeg versions: 4.x, 5.x. Build

A simple tool to convert a WebAssembly module to a WASI component (component model, WASI-preview2).
A simple tool to convert a WebAssembly module to a WASI component (component model, WASI-preview2).

A simple tool to convert a WebAssembly module (wasm32-wasi, wasm32-freestanding) to a WASI component (component model, WASI-preview2). Installation In

Easy c̵̰͠r̵̛̠ö̴̪s̶̩̒s̵̭̀-t̶̲͝h̶̯̚r̵̺͐e̷̖̽ḁ̴̍d̶̖̔ ȓ̵͙ė̶͎ḟ̴͙e̸̖͛r̶̖͗ë̶̱́ṉ̵̒ĉ̷̥e̷͚̍ s̷̹͌h̷̲̉a̵̭͋r̷̫̊ḭ̵̊n̷̬͂g̵̦̃ f̶̻̊ơ̵̜ṟ̸̈́ R̵̞̋ù̵̺s̷̖̅ţ̸͗!̸̼͋

Rust S̵̓i̸̓n̵̉ I̴n̴f̶e̸r̵n̷a̴l mutability! Howdy, friendly Rust developer! Ever had a value get m̵̯̅ð̶͊v̴̮̾ê̴̼͘d away right under your nose just when

Sets of libraries and tools to write applications and libraries mixing OCaml and Rust

Sets of libraries and tools to write applications and libraries mixing OCaml and Rust. These libraries will help keeping your types and data structures synchronized, and enable seamless exchange between OCaml and Rust

Open Source Rust kernel; Runs WASM and WASI as lightweight containers.

😳 etheryal Kernel etheryal kernel is an Open Source capability-based Kernel written in the Rust programming language. The kernel allows implementing

simple operating system written in Rust with wasi support.

Agave OS Agave OS is a simple operating system written in Rust with wasi support. It is designed to be lightweight and easy to use. It is also designe

Let's combine wasi-nn and witx-bindgen and see how it goes!

WASI-NN Experiment (API Docs) Experiments with wasmtime, the wasi-nn proposal, and tract. Getting Started To use this experiment, you will first need

Todo application on Atmos (WebAssembly with WASI)

Get starting Install subo CLI at https://github.com/suborbital/subo Build todo app cd todos subo build . Run docker compose docker compose up Pl

A virtual filesystem layer for WASI
A virtual filesystem layer for WASI

wasi-vfs A virtual filesystem layer for WASI. NOTICE: This project currently supports only WASI applications on the top of wasi-libc This project prov

Cargo wrapper for working with Webassembly wasi(x).

cargo-wasix A cargo subcommand that wraps regular cargo commands for compiling Rust code to wasix, a superset of Websassembly wasi with additional fun

rsmpeg is a thin&safe layer above the FFmpeg's Rust bindings
rsmpeg is a thin&safe layer above the FFmpeg's Rust bindings

A Rust crate that exposes FFmpeg's power as much as possible.

A ffmpeg/rust based HLS stream generator
A ffmpeg/rust based HLS stream generator

hls-streamer Stream your heart's content with HLS. Movtivation I've got a CCTV camera from AliExpress, I know I can use ffmpeg hls demuxer to split up

Rust port of ffmpeg's native AAC encoder

raash 🪇 An attempt at RIIR-ing the native AAC encoder from ffmpeg. First, I used c2rust to translate all relevant C code into Rust, and I'm in the pr

📼 Wrapper around ffmpeg which simplifies merging of multiple videos
📼 Wrapper around ffmpeg which simplifies merging of multiple videos

Vidmerger A wrapper around ffmpeg which simplifies merging of multiple videos. 🙉 What is this exactly? Vidmerger is a command-line-tool which uses ff

AV1 encoding tool with fast VMAF sampling. Uses svt-av1, ffmpeg & vmaf
AV1 encoding tool with fast VMAF sampling. Uses svt-av1, ffmpeg & vmaf

ab-av1 AV1 encoding tool with fast VMAF sampling. Uses svt-av1, ffmpeg & vmaf. Command: auto-encode Automatically determine the best crf to deliver th

Comments
  • rust-lld: error: function signature mismatch: __wasi_path_rename

    rust-lld: error: function signature mismatch: __wasi_path_rename

    I can't compile when I use this library.

    [package]
    name = "rust_wasm"
    version = "0.1.0"
    edition = "2021"
    
    # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
    
    [lib]
    name = "testwasi"
    path = "src/lib.rs"
    crate-type =["cdylib"]
    
    [dependencies]
    ffmpeg-wasi = "0"
    
    [build]
    target = "wasm32-wasi"
    

    This is my code.

    use std::ffi::CString;
    use std::ffi::CStr;
    use std::str;
    
    use ffmpeg_wasi::avformat::{
    av_version_info,
    };
    pub extern fn test() {
        unsafe{
            av_register_all();
            let info = CStr::from_ptr(av_version_info()).to_str().unwrap().to_owned();
            println!("Info: {}", info);
       }
    }
    

    This is error.

     
    error: linking with `rust-lld` failed: exit status: 1
      |
      = note: "rust-lld" "-flavor" "wasm" "--rsp-quoting=posix" "--export" "test" "--export=__heap_base" "--export=__data_end" "-z" "stack-size=1048576" "--stack-first" "--allow-undefined" "--fatal-warnings" "--no-demangle" "/code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/testwasi.119yydf3g7nz2rhx.rcgu.o" "/code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/testwasi.1e3af4th2b1gnhel.rcgu.o" "/code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/testwasi.1oek3ig4egr8m0un.rcgu.o" "/code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/testwasi.1rqlra1q7hrkhsto.rcgu.o" "/code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/testwasi.1udr4718k0q8gk0e.rcgu.o" "/code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/testwasi.1yeifx0tzdvuuw14.rcgu.o" "/code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/testwasi.2d8gwrmngo1i1jzb.rcgu.o" "/code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/testwasi.2ix0hrydk1toj2cr.rcgu.o" "/code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/testwasi.2sku7kmr9a99y0x3.rcgu.o" "/code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/testwasi.2v6d3e3zblyr6za6.rcgu.o" "/code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/testwasi.3a7h7nbqv4lgma75.rcgu.o" "/code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/testwasi.3afle6az3n79j6b3.rcgu.o" "/code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/testwasi.3cfqpsfoaf4c0byx.rcgu.o" "/code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/testwasi.3eo8hkzdeayptmj3.rcgu.o" "/code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/testwasi.3fy3lwh64wikqv06.rcgu.o" "/code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/testwasi.3jvid9c5o75cgpkv.rcgu.o" "/code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/testwasi.3o4g2n3k62e2136h.rcgu.o" "/code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/testwasi.3rg3zfvm7hy2kagr.rcgu.o" "/code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/testwasi.3rqpfleibaby47hh.rcgu.o" "/code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/testwasi.3xzp8uyd689y0jvc.rcgu.o" "/code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/testwasi.3yla30jmeqkt3dc0.rcgu.o" "/code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/testwasi.402piutxsdytp81c.rcgu.o" "/code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/testwasi.44seho64fz573v7z.rcgu.o" "/code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/testwasi.489mt03bfu695ap.rcgu.o" "/code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/testwasi.48ismj07hc0og0hm.rcgu.o" "/code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/testwasi.4iwgna1too8d697a.rcgu.o" "/code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/testwasi.5b8lchosgvn5r1ub.rcgu.o" "/code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/testwasi.5d8mraw0kmwi9syp.rcgu.o" "/code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/testwasi.n1i7z4w8ldcegu6.rcgu.o" "/code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/testwasi.n6jm90ofi899aoe.rcgu.o" "/code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/testwasi.ord8ujz8ps3l4m8.rcgu.o" "/code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/testwasi.27b3qtgf8bxc7tr0.rcgu.o" "-L" "/code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps" "-L" "/code/media-wasm/rust_wasm/target/debug/deps" "-L" "/code/media-wasm/rust_wasm/src/third/rust-ffmpeg-wasi/wasm-libs" "-L" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-wasi/lib" "/code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/libffmpeg_wasi-2b37b2550ed8ec83.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-wasi/lib/libstd-01fcc12541b386d5.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-wasi/lib/libpanic_abort-d871bb5d8995b7e2.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-wasi/lib/libwasi-25ade38e4b9444cc.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-wasi/lib/librustc_demangle-d296420d4d054f6e.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-wasi/lib/libstd_detect-24a9a2d9a29ca001.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-wasi/lib/libhashbrown-8171499f9fabfe22.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-wasi/lib/libminiz_oxide-5da7227bedffaa30.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-wasi/lib/libadler-cdc6c68a3726f24f.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-wasi/lib/librustc_std_workspace_alloc-087645de8a9fd58d.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-wasi/lib/libunwind-ea6af84cc2c77472.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-wasi/lib/libcfg_if-678881514599538d.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-wasi/lib/liblibc-71897fa43d02f337.rlib" "-l" "c" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-wasi/lib/liballoc-9b1f59330ce56757.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-wasi/lib/librustc_std_workspace_core-ed558c3b97e153de.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-wasi/lib/libcore-b6d90a94f12e0d39.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-wasi/lib/libcompiler_builtins-843a799c600942bd.rlib" "-L" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-wasi/lib" "-L" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-wasi/lib/self-contained" "-o" "/code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/testwasi.wasm" "--gc-sections" "--no-entry" "-O0"
      = note: rust-lld: error: function signature mismatch: __wasi_path_readlink
              >>> defined as (i32, i32, i32, i32, i32, i32) -> i32 in /code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/libffmpeg_wasi-2b37b2550ed8ec83.rlib(readlinkat.o)
              >>> defined as (i32, i32, i32, i32, i32) -> i32 in /root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-wasi/lib/self-contained/libc.a(__wasilibc_real.o)
              
              rust-lld: error: function signature mismatch: __wasi_path_filestat_set_times
              >>> defined as (i32, i32, i32, i32, i64, i64, i32) -> i32 in /code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/libffmpeg_wasi-2b37b2550ed8ec83.rlib(utimensat.o)
              >>> defined as (i32, i32, i32, i64, i64, i32) -> i32 in /root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-wasi/lib/self-contained/libc.a(__wasilibc_real.o)
              
              rust-lld: error: function signature mismatch: __wasi_path_unlink_file
              >>> defined as (i32, i32, i32) -> i32 in /code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/libffmpeg_wasi-2b37b2550ed8ec83.rlib(__wasilibc_unlinkat.o)
              >>> defined as (i32, i32) -> i32 in /root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-wasi/lib/self-contained/libc.a(__wasilibc_real.o)
              
              rust-lld: error: function signature mismatch: __wasi_path_link
              >>> defined as (i32, i32, i32, i32, i32, i32, i32) -> i32 in /code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/libffmpeg_wasi-2b37b2550ed8ec83.rlib(linkat.o)
              >>> defined as (i32, i32, i32, i32, i32) -> i32 in /root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-wasi/lib/self-contained/libc.a(__wasilibc_real.o)
              
              rust-lld: error: function signature mismatch: __wasi_path_filestat_get
              >>> defined as (i32, i32, i32, i32, i32) -> i32 in /code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/libffmpeg_wasi-2b37b2550ed8ec83.rlib(faccessat.o)
              >>> defined as (i32, i32, i32, i32) -> i32 in /root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-wasi/lib/self-contained/libc.a(__wasilibc_real.o)
              
              rust-lld: error: function signature mismatch: __wasi_path_rename
              >>> defined as (i32, i32, i32, i32, i32, i32) -> i32 in /code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/libffmpeg_wasi-2b37b2550ed8ec83.rlib(renameat.o)
              >>> defined as (i32, i32, i32, i32) -> i32 in /root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-wasi/lib/self-contained/libc.a(__wasilibc_real.o)
              
              rust-lld: error: function signature mismatch: __wasi_path_symlink
              >>> defined as (i32, i32, i32, i32, i32) -> i32 in /code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/libffmpeg_wasi-2b37b2550ed8ec83.rlib(symlinkat.o)
              >>> defined as (i32, i32, i32) -> i32 in /root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-wasi/lib/self-contained/libc.a(__wasilibc_real.o)
              
              rust-lld: error: function signature mismatch: __wasi_path_open
              >>> defined as (i32, i32, i32, i32, i32, i64, i64, i32, i32) -> i32 in /code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/libffmpeg_wasi-2b37b2550ed8ec83.rlib(openat.o)
              >>> defined as (i32, i32, i32, i32, i64, i64, i32, i32) -> i32 in /root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-wasi/lib/self-contained/libc.a(__wasilibc_real.o)
              
              rust-lld: error: function signature mismatch: __wasi_path_create_directory
              >>> defined as (i32, i32, i32) -> i32 in /code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/libffmpeg_wasi-2b37b2550ed8ec83.rlib(mkdirat.o)
              >>> defined as (i32, i32) -> i32 in /root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-wasi/lib/self-contained/libc.a(__wasilibc_real.o)
              
              rust-lld: error: function signature mismatch: __wasi_path_remove_directory
              >>> defined as (i32, i32, i32) -> i32 in /code/media-wasm/rust_wasm/target/wasm32-wasi/debug/deps/libffmpeg_wasi-2b37b2550ed8ec83.rlib(__wasilibc_rmdirat.o)
              >>> defined as (i32, i32) -> i32 in /root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-wasi/lib/self-contained/libc.a(__wasilibc_real.o)
              
    
    warning: `rust_wasm` (lib) generated 4 warnings
    error: could not compile `rust_wasm` due to previous error; 4 warnings emitted
    

    Can you give me an example that works. And I found that there are two key avfilter functions av_buffersrc_add_frame and av_buffersink_get_frame missing from the library.

    opened by ScriJey 2
  • Document build process

    Document build process

    Fascinating project. I tried doing this about a year ago but WASI didn't have everything I needed at the time. I am curious as to how you built your lib files (in wasm-libs). It would be great if you could add your build scripts to the repo.

    opened by hypertextjay 1
Owner
Frank Denis
Parisian fashion photographer with a knack for cryptography, computer vision, opensource software and infosec. Get my public keys here: https://sk.tl/7CPRo8kn
Frank Denis
rsmpeg is a thin&safe layer above the FFmpeg's Rust bindings

A Rust crate that exposes FFmpeg's power as much as possible.

Lark Technologies Pte. Ltd. 384 Jan 2, 2023
A ffmpeg/rust based HLS stream generator

hls-streamer Stream your heart's content with HLS. Movtivation I've got a CCTV camera from AliExpress, I know I can use ffmpeg hls demuxer to split up

null 16 Jan 9, 2023
📼 Wrapper around ffmpeg which simplifies merging of multiple videos

Vidmerger A wrapper around ffmpeg which simplifies merging of multiple videos. ?? What is this exactly? Vidmerger is a command-line-tool which uses ff

Thomas Gotwig 51 Dec 16, 2022
AV1 encoding tool with fast VMAF sampling. Uses svt-av1, ffmpeg & vmaf

ab-av1 AV1 encoding tool with fast VMAF sampling. Uses svt-av1, ffmpeg & vmaf. Command: auto-encode Automatically determine the best crf to deliver th

Alex Butler 92 Jan 1, 2023
Wrap a standalone FFmpeg binary in an intuitive Iterator interface. 🏍

FFmpeg Sidecar ?? Wrap a standalone FFmpeg binary in an intuitive Iterator interface. Motivation The core goal of this project is to provide a method

Nathan Babcock 26 Feb 22, 2023
Rust high level RTSP client

RRTSP Client Currently works, but a lot of work to do. PRs welcome! Examples, crates.io, better Readme.md and other things coming soon.

Lucas Zanela 13 Dec 26, 2022
High-level RTSP multimedia streaming library, in Rust

High-level RTSP multimedia streaming library, in Rust. Good support for ONVIF RTSP/1.0 IP surveillance cameras, as needed by Moonfire NVR. Works around brokenness in cheap closed-source cameras.

Scott Lamb 108 Jan 8, 2023
Rust-based video player for astrophotography

Astro Video Player Rust-based video player for astrophotography videos in SER and AVI format. Supports debayering of RAW color images. Status: Works w

Andy Grove 6 May 7, 2022
Pure-rust implementation of legacy H.263 video codec and associated color transforms

website | demo | nightly builds | wiki h263-rs h263-rs is a pure-Rust implementation of ITU-T Recommendation H.263 (2005/08), a video codec commonly u

Ruffle 7 Dec 18, 2022
A not well-named youtube's videos downloader written in Rust 🦀

ytdl-rs A not well-named youtube's videos downloader written in Rust ?? For information about how to use, legal section, next steps in the project, co

Alejandro Lopez 6 Jun 17, 2022