sys libflac-sys

Raw FFI bindings to the libFLAC library

4 releases

0.2.2 Jul 25, 2021
0.2.1 Feb 14, 2021
0.2.0 Nov 26, 2020
0.1.0 Aug 22, 2020

#11 in Encoding

Download history 12/week @ 2022-01-28 3/week @ 2022-02-04 3/week @ 2022-02-11 6/week @ 2022-02-18 2/week @ 2022-02-25 3/week @ 2022-03-04 12/week @ 2022-03-11 19/week @ 2022-03-18 2/week @ 2022-03-25 3/week @ 2022-04-01 3/week @ 2022-04-08 22/week @ 2022-04-15 9/week @ 2022-04-22 33/week @ 2022-04-29 25/week @ 2022-05-06 79/week @ 2022-05-13

148 downloads per month
Used in flac-bound


42K SLoC

C 38K SLoC // 0.1% comments Rust 4K SLoC // 0.0% comments Shell 15 SLoC

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.


Add this to your Cargo.toml:

libflac-sys = "0.2"


  • 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).


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


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.