2

I run an RTSP server on my Raspberry Pi 3 by using cvlc. I recently wanted to add audio as well but I can't the audio to work.

Here's my current cvlc config:

cvlc \
    v4l2:///dev/video0:chroma=h264:width=1280:height=720:input-slave=alsa://hw:1,0 \
     --sout '#transcode{acodec=mpga,ab=128,channels=2,samplerate=44100,threads=4,audio-sync=1}:rtp{mux=ts,mime=video/ts,sdp=rtsp://:8080/stream.sdp}'

Right now I'm getting the following when I try to run this:

VLC media player 3.0.8 Vetinari (revision 3.0.8-0-gf350b6b5a7)
[00936060] dbus interface error: Failed to connect to the D-Bus session daemon: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
[00936060] main interface error: no suitable interface module
[008bc938] main libvlc error: interface "dbus,none" initialization failed
[0093b7e8] main interface error: no suitable interface module
[008bc938] main libvlc error: interface "globalhotkeys,none" initialization failed
[0093b850] dummy interface: using the dummy interface module...

I don't have any monitor attached to my Raspberry Pi so all this output seems ~fine. However, when I stream via VLC -- I don't hear any audio. Looking at the stream statistics in VLC, no audio is being received?

enter image description here

I've verified the audio is at hw:1,0 using arecord:

$ arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: C920 [HD Pro Webcam C920], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

How can I troubleshoot this? Would it be possible to capture audio from the webcam and push it to the headphone jack so I can verify audio is being picked up? Is there some sort of pulseaudio/alsa configuration I should check?

  • I would start by connecting an HDMI screen to it and playing the video stream locally. Then you'll know whether the audio is lost on the way from the webcam to VLC or on the way from VLC to the RSTP client. – Dmitry Grigoryev Mar 21 at 10:30
3
+25

Would it be possible to capture audio from the webcam and push it to the headphone jack so I can verify audio is being picked up?

Yes. You can do that either by running raspi-config and selecting "Advanced Options" -> "Audio" -> "headphone jack", or running an equivalent command:

amixer cset numid=3 $X
# set $X to 1 for headphone jack, 2 for HDMI

One typical reason for webcams to produce no sound is that their microphone is muted. Run alsamixer, select you webcam (F6), then recording (F4), and increase the volume to the maximum (Space and/or ). If the microphone is called Mic (typically it is), you can also do it in one command:

amixer -c 1 set Mic cap

If you can't replay the sound from your webcam to the sound output, try playing an MP3 file or running espeak hello. If there's still no sound, check whether you have the audio driver loaded using lsmod.

Good luck.

0

As Dmitry Grigoryev said, "I would start by connecting an HDMI screen to it and playing the video stream locally. Then you'll know whether the audio is lost on the way from the webcam to VLC or on the way from VLC to the RSTP client."

The question: "Would it be possible to capture some audio from a webcam and play it and hear it from the headphone jack?"

The answer is yes, if you can verify that the audio is at certain place as what you said in your question.

New contributor
A User is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • What makes your answer different from that of @Dmitry Grigoryev? – Ingo Mar 26 at 10:24
  • 1
    @Ingo Not that I think this answer is great, but to tell the truth it was posted before mine. In the beginning I have only posted a comment. – Dmitry Grigoryev Mar 27 at 8:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.