RustAudio / rodio

Rust audio playback library
Apache License 2.0
1.66k stars 215 forks source link

even with ```features = ["symphonia-isomp4"]``` mp4 files just give Unrecognized format #527

Open Per6 opened 6 months ago

Per6 commented 6 months ago

it is nowhere explained, how to use mp4 files with rodio, just, that it is diabeled by default. I assumed, it would work by enabeling the "symphonia-isomp4" feature however it does not work and returns an error of unrecognized format.

let file = File::open(path).expect("unable to open file");
let file = BufReader::new(file);
// mp4 crashes in let source = ...
let source = Decoder::new(file).expect("unable to convert file to a 
music file");

i've also tried to use new_mp4 but it doesn't work with any of the Mp4Types and returns the same error just for mp4


let source = if path
        .file_name()
        .unwrap()
        .to_string_lossy()
        .ends_with(".mp4")
    {
        Decoder::new_mp4(file, rodio::decoder::Mp4Type::Mp4)
            .expect("unable to convert mp4 file to a music file")
    } else {
        Decoder::new(file).expect("unable to convert file to a music file")
    };
Per6 commented 5 months ago

I don't know much about codecs, but even with: rodio = { version = "0.17", features = ["symphonia-isomp4", "symphonia-all"] } symphonia = { version = "0.5", features = ["isomp4", "all", "all-codecs"] } it still gives the same error of: unable to convert mp4 file to a music file: UnrecognizedFormat