threers-codec 0.1.0

Pure-Rust media codecs: H.264/HEVC/VP9 encoders, H.264/HEVC/VP9/AV1 decoders, AAC/MP3/Opus/Vorbis/FLAC/WAV decoders, AAC-LC and MP3 encoders, MP4/WebM/Matroska/Ogg, GIF/APNG, captions, and VideoToolbox acceleration on macOS
Documentation
//! Decode a WebM Opus file N times (profiling aid). usage: opus_bench IN N
fn main() {
    let a: Vec<String> = std::env::args().collect();
    if a.len() < 3 {
        eprintln!("usage: opus_bench IN N");
        std::process::exit(2);
    }
    let data = std::fs::read(&a[1]).expect("read");
    let n: usize = a.get(2).map_or(10, |s| s.parse().unwrap());
    let t = std::time::Instant::now();
    let mut tot = 0;
    for _ in 0..n {
        tot += threers_codec::opus::decode_webm(&data)
            .expect("decode")
            .planes[0]
            .len();
    }
    eprintln!(
        "{:.1} ms per decode ({tot})",
        t.elapsed().as_secs_f64() * 1e3 / n as f64
    );
}