#Playing audio from a file with rodio crate?

11 messages · Page 1 of 1 (latest)

sleek relic
#

I have a bunch of .mp4 files with various audio codes including AAC and opus. I don't think opus is supported so let's focus on AAC.
I'm using rodio with symphonia all options enabled.
This is the audio stream from my file:
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s (default)
It is AAC and supported by rodio/symphonia
Here is my code that fails:

        let (_stream, audio_stream) = OutputStream::try_default().unwrap();
        let ff = BufReader::new(File::open(&path).unwrap()); //.mp4 file
        let audio = Decoder::new(f).unwrap(); <--- error here

The LAST line let audo = .... fails with thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: UnrecognizedFormat',

the rest of the code is too much to paste but basically audio and audio_stream get passed around to another function that plays them by using let music = audio.convert_samples().buffered();
audio_stream.play_raw(music.clone()).unwrap();

Does anyone know how to fix this?

true bloom
#

doesn't mention AAC codec or MP4 container.

sleek relic
#

@true bloom symphonia-all flag enable this feature

sleek relic
#

any idea anyone

sleek relic
#

new error after converting mp4's audio codec to mp3 (still mp4 file)

#

thread 'main' panicked at 'called Option::unwrap() on a None value', /.cargo/registry/src/github.com-1ecc6299db9ec823/symphonia-format-isomp4-0.4.0/src/atoms/esds.rs:253:54

#

any idea

#

same code

sleek relic
#

i used ffmpeg to set the audio codec to vorbis and tried Decoder::new and Decoder::new_vorbis, same error on both: Unrecognized format

sleek relic
#

i need to play the audio of an mp4 file. the mp4 file samples have audio codes of types: aac, mp3, vorbis
i am using the symphonia-all flag in rodio
and all of them are unrecognized format
they play fine in VLC
and my code works fine on regular mp3 files that aren't mp4