Ogg Opus
A decoder/encoder for Ogg Opus in Rust
Usage
Add to your cargo.toml
= "^0.1"
Minimum Rust version
Since we use const generics
, the minimum version of Rust is 1.51
Example
Encode
This example makes use of wav
crate, you can use it adding to your cargo.toml
file:
= "^1.0"
let mut f = open.unwrap;
let = read.unwrap;
let audio = b.try_into_sixteen.unwrap;
let opus = .unwrap;
Decode
Read from file
let mut f = open.unwrap;
let = .unwrap;
Read from Vec
use Cursor;
// Let's say this vec contains Ogg Opus data
let opus: = Vec new;
let = .unwrap;
What works and what not
- Only supports
i16
(integer of 16 bits) for the raw part. - Both mono and stereo are supported but only mono is tested.
- More channels than stereo are untested and will probably break it.
- Supports decoding and encoding any sample rate supported by Opus (8k Hz, 16k Hz, 32k Hz and 64k Hz) but only 16k Hz has been tested
- Encoding is set to a bitrate of 24k (because of Lily's constraints)
- There's still some inaccuracies around start and end of audio (can't tell if it's due to the encoder or the decoder)