Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio not working - gstreamer-audio_1 errors #28

Closed
guythnick opened this issue Jan 8, 2020 · 15 comments
Closed

Audio not working - gstreamer-audio_1 errors #28

guythnick opened this issue Jan 8, 2020 · 15 comments

Comments

@guythnick
Copy link

I have setup your project on a raspberry pi via the docker install method. Video seems to be working fine, but I have no audio. Using a cheap USB mic that shows as card1 in arecord -l.

When I run
docker-compose logs | grep gstreamer-audio

I get repeats of this output:

gstreamer-audio_1  | Setting pipeline to NULL ...
gstreamer-audio_1  | Freeing pipeline ...
gstreamer-audio_1  | Additional debug info:
gstreamer-audio_1  | pulsesrc.c(1015): gst_pulsesrc_open (): /GstPipeline:pipeline0/GstPulseSrc:pulsesrc0
gstreamer-audio_1  | mkdir: cannot create directory ‘/var/run/dbus’: File exists
gstreamer-audio_1  | dbus-daemon[16]: Failed to start message bus: The pid file "/run/dbus/pid" exists, if the message bus is not running, remove this file
gstreamer-audio_1  | E: [pulseaudio] main.c: Daemon startup failed.
gstreamer-audio_1  | Connection failure: Connection refused
gstreamer-audio_1  | pa_context_connect() failed: Connection refused
gstreamer-audio_1  | Connection failure: Connection refused
gstreamer-audio_1  | pa_context_connect() failed: Connection refused
gstreamer-audio_1  | Setting pipeline to PAUSED ...
gstreamer-audio_1  | ERROR: Pipeline doesn't want to pause.
@guythnick guythnick mentioned this issue Jan 9, 2020
@alogoc
Copy link

alogoc commented Jan 13, 2020

May I ask which mic you are using? Having the exact same problem, I used same as the authors mic, which is USB and used an adapter to convert it to mini usb to plug it in as I am running this on pi zero. Ordered another mic now..I'll post the results once I get to try it.

@guythnick
Copy link
Author

I actually was using the same cheap microphone originally recommended. Today I received a AmazonBasics Portable USB Condenser Microphone, and that is working with Pulse as-is. So, I think it is an issue with those cheap microphones.

@kotarokun
Copy link

I facing the same problem. Is it an problem of Docker? or of microphone?

@J4nsen
Copy link

J4nsen commented Mar 31, 2021

The audio device (if I remember correctly hw1) is hardcoded in the docker containers. If a HDMI cable was plugged in, my cheap usb mic got the identifier hw2, and since HDMI does not provide audio-input, the container fails to start. So please make sure that hw1 actually is the microphone.

@nine86
Copy link

nine86 commented May 6, 2021

So at first I thought my audio issues were related to the device being hw2 vs hw1 but as suggested by @J4nsen once the HDMI cable is removed that is no longer a problem. However I get the following errors when I run:
docker-compose logs | grep gstreamer-audio

I get:

gstreamer-audio_1  | Command not found: /audio_entry.sh
gstreamer-audio_1  | Command not found: /audio_entry.sh
gstreamer-audio_1  | Command not found: /audio_entry.sh
gstreamer-audio_1  | Command not found: /audio_entry.sh

When I run: docker-compose ps
I get:

            Name                          Command                 State      Ports
----------------------------------------------------------------------------------
fruitnanny_fruitnanny_1        /usr/bin/entry.sh node ser ...   Up                
fruitnanny_gstreamer-audio_1   /usr/bin/entry.sh /audio_e ...   Restarting        
fruitnanny_gstreamer-video_1   /usr/bin/entry.sh gst-laun ...   Up                
fruitnanny_janus_1             /usr/bin/entry.sh /bin/sh  ...   Up                
fruitnanny_nginx_1             /docker-entrypoint.sh ngin ...   Up                

Any help would be much appreciated

@J4nsen
Copy link

J4nsen commented May 6, 2021

Did you change anything in the Dockefile related to the audio container? Is the image still ivadim/fruitnanny-gstreamer?

@nine86
Copy link

nine86 commented May 6, 2021

Did you change anything in the Dockefile related to the audio container? Is the image still ivadim/fruitnanny-gstreamer?

Do you mean the Dockerfile in opt/fruitnanny/docker/gstreamer? That was unedited. However I did make a change to /opt/fruitnanny docker-compose.yml. I changed ivadim/fruitnanny-gstreamer container to klemmie117/fruitnanny-gstreamer-fix as that was suggested to fix the video streaming issues.

@J4nsen
Copy link

J4nsen commented May 6, 2021

You only have to change the image to klemmie117/fruitnanny-gstreamer-fix for the video container. The audio container can be left as is.

@nine86
Copy link

nine86 commented May 6, 2021

You only have to change the image to klemmie117/fruitnanny-gstreamer-fix for the video container. The audio container can be left as is.

Thanks I'm going to try that now and update here. I figured as much when you asked if I made a change to the container.

@nine86
Copy link

nine86 commented May 6, 2021

@J4nsen Doesn't seem to work. The error log is as below:

gstreamer-audio_1  | I: [pulseaudio] main.c: Daemon startup successful.
gstreamer-audio_1  | Failure: Module initialization failed
gstreamer-audio_1  | Failure: Module initialization failed
gstreamer-audio_1  | Setting pipeline to PAUSED ...
gstreamer-audio_1  | Pipeline is live and does not need PREROLL ...
gstreamer-audio_1  | Setting pipeline to PLAYING ...
gstreamer-audio_1  | New clock: GstPulseSrcClock
gstreamer-audio_1  | ERROR: from element /GstPipeline:pipeline0/GstPulseSrc:pulsesrc0: Failed to connect stream: No such entity
gstreamer-audio_1  | Additional debug info:
gstreamer-audio_1  | pulsesrc.c(1622): gst_pulsesrc_prepare (): /GstPipeline:pipeline0/GstPulseSrc:pulsesrc0
gstreamer-audio_1  | Execution ended after 0:00:00.003790619
gstreamer-audio_1  | Setting pipeline to PAUSED ...
gstreamer-audio_1  | Setting pipeline to READY ...
gstreamer-audio_1  | Setting pipeline to NULL ...
gstreamer-audio_1  | Freeing pipeline ...
gstreamer-audio_1  | mkdir: cannot create directory ‘/var/run/dbus’: File exists
gstreamer-audio_1  | dbus-daemon[18]: Failed to start message bus: The pid file "/run/dbus/pid" exists, if the message bus is not running, remove this file
gstreamer-audio_1  | Process 22 died: No such process; trying to remove PID file. (/run/avahi-daemon//pid)
gstreamer-audio_1  | E: [pulseaudio] main.c: Daemon startup failed.
gstreamer-audio_1  | Connection failure: Connection refused
gstreamer-audio_1  | pa_context_connect() failed: Connection refused
gstreamer-audio_1  | Connection failure: Connection refused
gstreamer-audio_1  | pa_context_connect() failed: Connection refused
gstreamer-audio_1  | Setting pipeline to PAUSED ...
gstreamer-audio_1  | ERROR: Pipeline doesn't want to pause.
gstreamer-audio_1  | ERROR: from element /GstPipeline:pipeline0/GstPulseSrc:pulsesrc0: Failed to connect: Connection refused
gstreamer-audio_1  | Additional debug info:
gstreamer-audio_1  | pulsesrc.c(1015): gst_pulsesrc_open (): /GstPipeline:pipeline0/GstPulseSrc:pulsesrc0
gstreamer-audio_1  | Setting pipeline to NULL ...
gstreamer-audio_1  | Freeing pipeline ...

When I run: docker-compose ps everything was fine for the first 2 mins then after that I get the restarting status.
I get:

            Name                          Command                 State      Ports
----------------------------------------------------------------------------------
fruitnanny_fruitnanny_1        /usr/bin/entry.sh node ser ...   Up                
fruitnanny_gstreamer-audio_1   /usr/bin/entry.sh /audio_e ...   Restarting        
fruitnanny_gstreamer-video_1   /usr/bin/entry.sh gst-laun ...   Up                
fruitnanny_janus_1             /usr/bin/entry.sh /bin/sh  ...   Up                
fruitnanny_nginx_1             /docker-entrypoint.sh ngin ...   Up  

@J4nsen
Copy link

J4nsen commented May 6, 2021

Please make sure that hw:1 is actually your microphone. You can do this on the docker-host, e.g., by running alsamixer or aplay -l.

@nine86
Copy link

nine86 commented May 6, 2021

I run arecord -l and I get the following:

**** List of CAPTURE Hardware Devices ****
card 1: Device [USB PnP Sound Device], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

@J4nsen
Copy link

J4nsen commented May 6, 2021

This looks ok. Sorry, I dont have my fruitnanny here anymore, so I can only give some advice.

Next step would be running the container on its own and execute the steps in audio_entry.sh and audio_stream.sh (https://github.com/ivadim/fruitnanny/tree/master/docker/gstreamer) manually.

@nine86
Copy link

nine86 commented May 6, 2021

This looks ok. Sorry, I dont have my fruitnanny here anymore, so I can only give some advice.

Next step would be running the container on its own and execute the steps in audio_entry.sh and audio_stream.sh (https://github.com/ivadim/fruitnanny/tree/master/docker/gstreamer) manually.

Hey I really appreciate any advice at all. Thank you so very much!!! Trying to complete this project in time for when my baby is born. Haha. It's been a slog since I'm so unfamiliar with the software. Sorry to ask, but any chance you could elaborate on the steps to do the above?

@J4nsen
Copy link

J4nsen commented May 6, 2021

Make sure all other fruitnanny containers are stopped.

Execute $ docker images, use the ID to run a bash in the container with $ docker run -i -t idofcontainer /bin/bash.

In the container run:

$ chgrp audio -- /dev/snd/*
$ mkdir /var/run/dbus
$ dbus-daemon --system --fork
$ avahi-daemon -D

$ pulseaudio -D -v --log-target=stderr
$ pactl load-module module-alsa-source device=hw:1
$ pactl load-module module-echo-cancel source_name=microphone aec_method=webrtc 'aec_args="analog_gain_control=0 digital_gain_control=0"'
$ gst-launch-1.0 -v pulsesrc device=microphone ! audioconvert ! audioresample ! opusenc ! rtpopuspay ! queue max-size-bytes=0 max-size-buffers=0 ! udpsink host=127.0.0.1 port=5002

Check after every step if it worked. I suppose it should fail around pulseaudio/pactl. You could then run pulseaudio in the foreground with $ pulseaudio -vvv & and continue again with the rest of the commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants