webrtc-rs/examples

Audio not working on example play-from-disk-vpx

jurgob opened this issue · 2 comments

Hello, I m running the example play-from-disk-vpx.
the video streaming is working, but the audio is not.

the problem is that in this line : https://github.com/webrtc-rs/examples/blob/main/examples/play-from-disk-vpx/play-from-disk-vpx.rs#L258 I get the following error:

thread 'tokio-runtime-worker' panicked at 'called `Result::unwrap()` on an `Err` value: ErrBadIDPageLength', examples/play-from-disk-vpx/play-from-disk-vpx.rs:272:61

( to print it I've changed that line like this: let (mut ogg, _) = OggReader::new(reader, true).unwrap(); )

I've tryed with an ogg file generated like in the guide and from a file download.

this is the ffprobe of the file I'm trying to use:

ffprobe test_data/output.ogg
ffprobe version 5.0.1 Copyright (c) 2007-2022 the FFmpeg developers
  built with Apple clang version 13.1.6 (clang-1316.0.21.2.5)
  configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/5.0.1_2 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-neon
  libavutil      57. 17.100 / 57. 17.100
  libavcodec     59. 18.100 / 59. 18.100
  libavformat    59. 16.100 / 59. 16.100
  libavdevice    59.  4.100 / 59.  4.100
  libavfilter     8. 24.100 /  8. 24.100
  libswscale      6.  4.100 /  6.  4.100
  libswresample   4.  3.100 /  4.  3.100
  libpostproc    56.  3.100 / 56.  3.100
Input #0, ogg, from 'test_data/output.ogg':
  Duration: 00:01:30.46, start: 0.000000, bitrate: 123 kb/s
  Stream #0:0: Audio: vorbis, 44100 Hz, stereo, fltp, 128 kb/s
    Metadata:
      ARTIST          : Patrick de Arteaga
      TITLE           : Child's Nightmare
      COMMENTS        : Creative Commons Attribution 4.0
      DATE            : 2019

Thanks in advance!

Another note, using the ogg file they are quoting here, everything is working fine:

pion/webrtc#2181

I made it work. I converted the audio in stereo adding the option -c:a dca -ac 2

so now the command is like:

ffmpeg -i $INPUT_FILE -map 0:a -c:a dca -ac 2 -c:a libopus -page_duration 20000 -vn output.ogg