rodio icon indicating copy to clipboard operation
rodio copied to clipboard

Throws UnrecognizedFormat while playing audio generated by ffmpeg and youtubedl.

Open Sreyas-Sreelal opened this issue 6 years ago • 4 comments

The decoder seems not working with audio files generated by youtubedl and ffmpeg. Here's a minimal repro

  1. Run
youtube-dl ytsearch1:okay --extract-audio --audio-format mp3 --output music.mp3
  1. Build and run
use rodio::Sink;
use std::io::BufReader;

fn main() {
    let device = rodio::default_output_device().unwrap();
    let sink = Sink::new(&device);
    let file = std::fs::File::open("music.mp3").unwrap();
    sink.append(rodio::Decoder::new(BufReader::new(file)).unwrap());
    sink.sleep_until_end();
}

Output

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: UnrecognizedFormat', src/libcore/result.rs:999:5
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

This is the same case for .wav files too. The audio files works perfectly with other players.

Sreyas-Sreelal avatar Jul 28 '19 09:07 Sreyas-Sreelal

I'm currently having UnrecognizedFormat errors too. Few second long mp3 sound effects. What's weird is that they're from a series of similar sound effects (like punch1.mp3 ~ punch7.mp3), but only 2 of them give errors.

Downloaded the soundpack from http://df.zweistein.cz/soundsense/ . '\soundpack\packs\battle\hit\punch\punch4.mp3' and '\soundpack\packs\battle\hit\push\push5.mp3' .

prixt avatar Aug 07 '19 12:08 prixt

I'm currently having the same issue, did you manage to solve it by any chance?

RainbowCookie32 avatar Dec 16 '19 18:12 RainbowCookie32

Same issue here but not mp3s, just regular wav files..

This might have larger scope than just ffmpeg and youtubedl?

Is there some kind of bitrate limit? These samples are 48kHz 24bit

  • Rodio Version: rodio = "0.11.0"
  • OS: macOS Mojave 10.14.6
  • Rust version: rustc 1.42.0 (b8cedc004 2020-03-09)

Code

extern crate rodio;

use std::io::BufReader;

fn main() {
    let device = rodio::default_output_device().unwrap();
    let sink = rodio::Sink::new(&device);

    let file = std::fs::File::open("./sounds/RC000126.wav").unwrap();

    sink.append(rodio::Decoder::new(BufReader::new(file)).unwrap());
    sink.sleep_until_end();
}

Backtrace

wav_test $ RUST_BACKTRACE=1 cargo run
   Compiling wav_test v0.1.0 (/Users/RJPB2/Documents/wav_test)
    Finished dev [unoptimized + debuginfo] target(s) in 2.00s
     Running `target/debug/wav_test`
_UniCharInfo_LinearCount:888
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: UnrecognizedFormat', src/main.rs:11:17
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:77
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1052
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1426
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:204
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:224
  10: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:472
  11: rust_begin_unwind
             at src/libstd/panicking.rs:380
  12: core::panicking::panic_fmt
             at src/libcore/panicking.rs:85
  13: core::option::expect_none_failed
             at src/libcore/option.rs:1199
  14: core::result::Result<T,E>::unwrap
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libcore/result.rs:963
  15: wav_test::main
             at src/main.rs:11
  16: std::rt::lang_start::{{closure}}
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libstd/rt.rs:67
  17: std::rt::lang_start_internal::{{closure}}
             at src/libstd/rt.rs:52
  18: std::panicking::try::do_call
             at src/libstd/panicking.rs:305
  19: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:86
  20: std::panicking::try
             at src/libstd/panicking.rs:281
  21: std::panic::catch_unwind
             at src/libstd/panic.rs:394
  22: std::rt::lang_start_internal
             at src/libstd/rt.rs:51
  23: std::rt::lang_start
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libstd/rt.rs:67
  24: wav_test::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

selfup avatar Apr 04 '20 19:04 selfup

Same issue here with espeak-ng.

tristan-f-r avatar Apr 17 '22 01:04 tristan-f-r