#flac #encoding

sys libflac-sys

Raw FFI bindings to the libFLAC library

9 releases

0.3.4 Oct 4, 2025
0.3.3 Apr 23, 2025
0.3.1 Dec 10, 2023
0.3.0 Dec 17, 2022
0.1.0 Aug 22, 2020

#126 in Audio

Download history 55/week @ 2026-01-08 195/week @ 2026-01-15 176/week @ 2026-01-22 178/week @ 2026-01-29 116/week @ 2026-02-05 113/week @ 2026-02-12 158/week @ 2026-02-19 320/week @ 2026-02-26 216/week @ 2026-03-05 253/week @ 2026-03-12 311/week @ 2026-03-19 611/week @ 2026-03-26 403/week @ 2026-04-02 536/week @ 2026-04-09 789/week @ 2026-04-16 772/week @ 2026-04-23

2,544 downloads per month
Used in 12 crates (7 directly)

BSD-3-Clause

2MB
47K SLoC

C 42K SLoC // 0.1% comments Rust 3.5K SLoC // 0.0% comments C++ 1.5K SLoC // 0.1% comments Shell 15 SLoC

Contains (obscure autoconf code, 7KB) ogg/configure.ac

Rust FFI bindings to the libFLAC library

This crate provides raw FFI bindings to the libFLAC library for reading and writing losslessly compressed FLAC audio files.

Following the *-sys package conventions, the libflac-sys crate does not define higher-level abstractions over the native libFLAC library functions.

Usage

Add this to your Cargo.toml:

[dependencies]
libflac-sys = "0.3"

Features

  • build-flac (enabled by default): build libFLAC instead of linking to the system library – cmake and a C toolchain is required
  • build-ogg (enabled by default, implies build-flac): build support for FLAC data in OGG containers into libFLAC; if build-flac is not selected, support for OGG containers depends on the configuration of the system libFLAC

Auto-generating the Rust bindings

The Rust bindings have already been auto-generated with bindgen (using the bindgen/run-bindgen.sh script) and are part of this crate (see src/bindings.rs).

Contributing

If you want to report a problem or suggest an improvement, please go to https://github.com/mgeier/libflac-sys. Contributions are always welcome!

Licenses

This crate uses the BSD-3-Clause license, in reference to Xiph.Org's BSD-like license which is used as libFLAC license and libogg license.

Dependencies