datarhei / restreamer

The Restreamer is a complete streaming server solution for self-hosting. It has a visually appealing user interface and no ongoing license costs. Upload your live stream to YouTube, Twitch, Facebook, Vimeo, or other streaming solutions like Wowza. Receive video data from OBS and publish it with the RTMP and SRT server.
https://docs.datarhei.com/restreamer/
Apache License 2.0
3.96k stars 452 forks source link

Alsa USB-Device failed by Audio-Check with Restreamer #623

Open unixweb opened 1 year ago

unixweb commented 1 year ago

In generally have problems integrating any Alsa USB-Sound device into Restreamer.

Steps to reproduce the behavior:

  1. Admin - and add any Alsa Device
  2. Click on "Check"
  3. See following error ->

ffmpeg version 5.1.3-datarhei Copyright (c) 2000-2022 the FFmpeg developers built with gcc 11.2.1 (Alpine 11.2.1_git20220219) 20220219 configuration: --extra-version=datarhei --prefix=/usr --extra-libs='-lpthread -lxml2 -lm -lz -lsupc++ -lstdc++ -lssl -lcrypto -lz -lc -ldl' --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-static --enable-openssl --enable-libxml2 --enable-libv4l2 --enable-v4l2_m2m --enable-libfreetype --enable-alsa --enable-libsrt --enable-libx264 --enable-libx265 --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libvorbis --disable-ffplay --disable-debug --disable-doc --disable-shared libavutil 57. 28.100 / 57. 28.100 libavcodec 59. 37.100 / 59. 37.100 libavformat 59. 27.100 / 59. 27.100 libavdevice 59. 7.100 / 59. 7.100 libavfilter 8. 44.100 / 8. 44.100 libswscale 6. 7.100 / 6. 7.100 libswresample 4. 7.100 / 4. 7.100 libpostproc 56. 6.100 / 56. 6.100 [alsa @ 0x7f9867e690] cannot set channel count to 2 (Invalid argument) hw:1,0: I/O error

Expected behavior The issue is on any USB-Alsa Devices / eMeet / Elgato:3 / Webcams with Microphone / external USB-Microphone only the Jabra USB-Headset works without any problem, may is not stereo device.

Screenshots and Core Log stored

https://pad.unixweb.net/drive/#/2/drive/view/BeHaOFCIf4LgfVpr68bIxwxMLAZAaiOPSMrxSeH7uJY/

Desktop

ioppermann commented 1 year ago

Hi @unixweb, this was indeed a bug. The provided number of audio channels was ignored and the default is 2. So, no matter what you entered there, it always tried to configure it as a stereo device, which fails if the device doesn't support that.

I fixed the bug in the dev branch of the UI (datarhei/restreamer-ui@546024fc90f309a41361dffd69868cec42f65377)

I will try to update the datarhei/restreamer:dev Docker image, so you can check out the fixes.

unixweb commented 1 year ago

You will update both Docker images for datarhei/restreamer:dev and datarhei/restreamer-rpi:dev ? Give me a ping if there is an update available please. Thank you very much for this quick fix.

ioppermann commented 1 year ago

The latest datarhei/restreamer:dev and datarhei/restreamer:rpi-dev are now available for you to pull.

unixweb commented 1 year ago

Still the same issue

Alsa Media Device with Microphone on Camera

ffmpeg version 5.1.3-datarhei Copyright (c) 2000-2022 the FFmpeg developers built with gcc 11.2.1 (Alpine 11.2.1_git20220219) 20220219 configuration: --extra-version=datarhei --prefix=/usr --extra-libs='-lpthread -lxml2 -lm -lz -lsupc++ -lstdc++ -lssl -lcrypto -lz -lc -ldl' --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-static --enable-openssl --enable-libxml2 --enable-libv4l2 --enable-v4l2_m2m --enable-alsa --enable-libfreetype --enable-libsrt --enable-libx264 --enable-libx265 --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libvorbis --disable-ffplay --disable-debug --disable-doc --disable-shared libavutil 57. 28.100 / 57. 28.100 libavcodec 59. 37.100 / 59. 37.100 libavformat 59. 27.100 / 59. 27.100 libavdevice 59. 7.100 / 59. 7.100 libavfilter 8. 44.100 / 8. 44.100 libswscale 6. 7.100 / 6. 7.100 libswresample 4. 7.100 / 4. 7.100 libpostproc 56. 6.100 / 56. 6.100 [alsa @ 0x7fb2975690] cannot set channel count to 2 (Invalid argument) hw:1,0: I/O error

Alsa Media Device via USB

ffmpeg version 5.1.3-datarhei Copyright (c) 2000-2022 the FFmpeg developers built with gcc 11.2.1 (Alpine 11.2.1_git20220219) 20220219 configuration: --extra-version=datarhei --prefix=/usr --extra-libs='-lpthread -lxml2 -lm -lz -lsupc++ -lstdc++ -lssl -lcrypto -lz -lc -ldl' --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-static --enable-openssl --enable-libxml2 --enable-libv4l2 --enable-v4l2_m2m --enable-alsa --enable-libfreetype --enable-libsrt --enable-libx264 --enable-libx265 --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libvorbis --disable-ffplay --disable-debug --disable-doc --disable-shared libavutil 57. 28.100 / 57. 28.100 libavcodec 59. 37.100 / 59. 37.100 libavformat 59. 27.100 / 59. 27.100 libavdevice 59. 7.100 / 59. 7.100 libavfilter 8. 44.100 / 8. 44.100 libswscale 6. 7.100 / 6. 7.100 libswresample 4. 7.100 / 4. 7.100 libpostproc 56. 6.100 / 56. 6.100 [alsa @ 0x7f9a2ad690] cannot set channel count to 2 (Invalid argument) hw:4,0: I/O error

ioppermann commented 1 year ago

That's true. The latest fixes in the UI didn't make it into the dev Docker images. I will check that.

ioppermann commented 1 year ago

The dev and rpi-dev images are now updated and contain the fix for USB audio devices. Please make sure that you properly reload the UI, otherwise the old version might get loaded from the browser cache.

unixweb commented 1 year ago

It works now in general but there is now an another issue. After an hour of operation, the audio and video are no longer in sync and the stream itself keeps interrupting. Should I open a new issue about this?