Packages

Native Elixir bindings for FFmpeg via the rsmpeg Rust crate. Replaces shelling out to the ffmpeg/ffprobe CLI with an in-process NIF.

Current section

Files

Jump to
exmpeg native exmpeg_native Cargo.toml
Raw

native/exmpeg_native/Cargo.toml

[package]
name = "exmpeg_native"
version = "0.1.0"
edition = "2024"
# rustler 0.38 raised its MSRV to 1.91; the crate cannot build on older
# toolchains.
rust-version = "1.91"
[lib]
name = "exmpeg_native"
crate-type = ["cdylib"]
[dependencies]
rustler = "0.38.0"
# rsmpeg 0.18 binds against FFmpeg 8.x. The crate links against the system
# ffmpeg libraries via pkg-config; FFMPEG_PKG_CONFIG_PATH can override the
# discovery path when building against a non-default install.
#
# Pinned to a specific rsmpeg git revision because the released
# 0.18.0+ffmpeg.8.0 on crates.io fails to compile against FFmpeg 8.0.1
# and later 8.x: an `avio_alloc_context` const-correctness change
# tightened the second parameter of the write callback from
# `uint8_t *` to `const uint8_t *`; git has the matching cfg gate,
# crates.io does not. The rev below is the latest rsmpeg master commit
# and builds cleanly against FFmpeg 8.1 (libavformat 62.x), which is the
# version CI, the release artefacts, and devenv now target.
#
# Pin to `rev` (not `branch`) so a rebase or branch deletion upstream
# cannot silently change what `cargo fetch` resolves on a fresh build.
rsmpeg = { git = "https://github.com/larksuite/rsmpeg", rev = "b21fcfde8bb1ffdc179504e370e330385baa9819", default-features = false, features = [
"link_system_ffmpeg",
"ffmpeg8",
] }
[features]
default = []
[lints.rust]
# `deny` rather than `forbid`: a handful of FFI helpers (reading C strings
# off `AVFormatContext` / `AVCodecParameters`, walking `AVDictionary` raw
# pointers) need explicit `unsafe`. Each such function carries a localized
# `#[allow(unsafe_code)]` so the crate-wide policy keeps everything else
# safe by default.
unsafe_code = "deny"
missing_docs = "warn"
unreachable_pub = "warn"
[lints.clippy]
pedantic = { level = "warn", priority = -1 }
module_name_repetitions = "allow"
missing_errors_doc = "allow"
missing_panics_doc = "allow"
doc_markdown = "allow"
doc_overindented_list_items = "allow"
# rsmpeg wrappers expose values as i32/u32; casting between integer widths
# is unavoidable and not actionable noise.
cast_possible_truncation = "allow"
cast_possible_wrap = "allow"
cast_sign_loss = "allow"
cast_precision_loss = "allow"
cast_lossless = "allow"
[profile.release]
opt-level = 3
lto = "thin"
codegen-units = 1