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

ffmpeg / Alarm Sound problem #44

Closed
mfischcgn opened this issue Jun 28, 2020 · 54 comments
Closed

ffmpeg / Alarm Sound problem #44

mfischcgn opened this issue Jun 28, 2020 · 54 comments
Labels
bug Something isn't working help wanted Extra attention is needed investigating What the... stale Hello?

Comments

@mfischcgn
Copy link

mfischcgn commented Jun 28, 2020

Hi there.
If I want to use the audio options for the Alarm, I get this error message:

Error: spawn ffplay ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21)

I tried to install ffmpeg. It seemed that it is installed, but the error persists.
Maybe someone could help me getting this working. Thanks in advance!

(I use docker with a Homebridge image on a Synology NAS)

@mfischcgn
Copy link
Author

Finally i got ffmpeg installed directly to docker, now i still got errors, but different. Any suggestions? Thanks:
Audio failed
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4693:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4693:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4693:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5181:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM default
No more combinations to try, audio open failed
Failed to open file '/homebridge/node_modules/homebridge-securitysystem/sounds/de-DE/current-home.mp3' or configure filtergraph

@MiguelRipoll23 MiguelRipoll23 added the bug Something isn't working label Jun 28, 2020
@MiguelRipoll23

This comment has been minimized.

@mfischcgn

This comment has been minimized.

@MiguelRipoll23

This comment has been minimized.

@MiguelRipoll23 MiguelRipoll23 added the investigating What the... label Jun 28, 2020
@mfischcgn

This comment has been minimized.

@MiguelRipoll23

This comment has been minimized.

@mfischcgn

This comment has been minimized.

@mfischcgn

This comment has been minimized.

@mfischcgn

This comment has been minimized.

@MiguelRipoll23

This comment has been minimized.

@MiguelRipoll23
Copy link
Owner

MiguelRipoll23 commented Jun 28, 2020

Looks like it's not supported by the Synology Docker UI but — there's something else we can do.

  1. Go the the Synology Docker UI.
  2. Click the Image option from the sidebar.
  3. Click the Launch button.
  4. Check the Execute container using high privilege checkbox.
  5. Continue as normal.

Now all the devices should be mounted to the container (including the audio one).

@mfischcgn

This comment has been minimized.

@MiguelRipoll23

This comment has been minimized.

@mfischcgn

This comment has been minimized.

@MiguelRipoll23

This comment has been minimized.

@mfischcgn

This comment has been minimized.

@MiguelRipoll23

This comment has been minimized.

@mfischcgn

This comment has been minimized.

@MiguelRipoll23

This comment has been minimized.

@mfischcgn

This comment has been minimized.

@mfischcgn
Copy link
Author

I found the solution i think!
When i use it like this is works:

ffplay current-alert.mp3 -nodisp (-volume 100)

I think it's because the Synology has no Display Ports, so -nodisp seems to help
Would be great to make it possible to chose a volume in your plugin.

(Screenshot-> I used "-loop 100" and "-volume 100" just for testing reasons)
Bildschirmfoto 2020-06-28 um 16 53 41

@MiguelRipoll23

This comment has been minimized.

@mfischcgn

This comment has been minimized.

@mfischcgn

This comment has been minimized.

@MiguelRipoll23

This comment has been minimized.

@mfischcgn

This comment has been minimized.

@mfischcgn

This comment has been minimized.

@MiguelRipoll23

This comment has been minimized.

@mfischcgn

This comment has been minimized.

@MiguelRipoll23

This comment has been minimized.

@mfischcgn

This comment has been minimized.

@MiguelRipoll23

This comment has been minimized.

@MiguelRipoll23 MiguelRipoll23 reopened this Jul 4, 2020
@MiguelRipoll23 MiguelRipoll23 added the help wanted Extra attention is needed label Jul 8, 2020
@macjl
Copy link
Contributor

macjl commented Jul 13, 2020

Hello,

I'm facing exactly the same problem. I've search, and found that the default Alsa card was not good to play sounds. FYI, I'm running this plugin in a computer under Linux with multiple sound devices (HDMI, Webcam, Audio USB card, Line out...)

So, for me, the solution would be to use this ffmpeg command instead of ffplay, to select the right Alsa audio card :
ffmpeg -i /opt/node/lib/node_modules/homebridge-securitysystem/sounds/en-US/current-night.mp3 -f alsa default:CARD=Device

For Linux with Alsa, you can find all audio cards with command :
ffplay -sinks alsa

@MiguelRipoll23, do you think it's possible to provide an option to override the audio sound card?
As it should work on Linux, and other OS, I think all the output device should be a parameter.
For example :
"audio_output" : "-f alsa default:CARD=Device"
and command :
ffmpeg -i <audio_file> <audio_output>

But you should keep using 'ffplay' for default configuration, because you won't know what output device to use depending on OS.

@MiguelRipoll23
Copy link
Owner

@macjl sure, thanks for your help!

the solution would be to use this ffmpeg command instead of ffplay

It doesn't work using ffplay? I thought they shared options.

ffplay -i /opt/node/lib/node_modules/homebridge-securitysystem/sounds/en-US/current-night.mp3 -f alsa default:CARD=Device -nodisp -autoexit

@macjl

This comment has been minimized.

@MiguelRipoll23

This comment has been minimized.

@macjl

This comment has been minimized.

@MiguelRipoll23

This comment has been minimized.

@raixer

This comment has been minimized.

@macjl

This comment has been minimized.

@MiguelRipoll23

This comment has been minimized.

@MiguelRipoll23

This comment has been minimized.

@macjl

This comment has been minimized.

@MiguelRipoll23
Copy link
Owner

MiguelRipoll23 commented Jul 13, 2020

@macjl okay I think I figured this out:

  1. Remove everything from the Audio Arguments option.
  2. Restart Homebridge.
  3. Execute on your terminal: SDL_AUDIODRIVER="alsa" AUDIODEV="hw:1,0"
    (You may need to change the number that comes after hw: until you get your sound card, the one I gave is you is the second one)
  4. Try the plugin's sounds.

Hopefully it works now.

@macjl
Copy link
Contributor

macjl commented Jul 14, 2020

You got it!!!

I have added this to my docker-compose, and it's working now :

    environment:
      AUDIODEV: "hw:2,0"
      SDL_AUDIODRIVER: "alsa"

So I think you don't have to add the 'audio_arguments' feature in your plugin.

Thank you!

@MiguelRipoll23
Copy link
Owner

MiguelRipoll23 commented Jul 14, 2020

Thanks both for your patience on this issue, great to hear that.

@mfischcgn can you connect via SSH to your docker container and do the following steps?

  1. Edit your ~/.bashsrc
  2. Add the following lines at the end of the file:

export AUDIODEV=hw:1,0
export SDL_AUDIODRIVER=alsa

  1. Save the file.
  2. Try the plugin sounds.

You may need to try hw:2,0, hw:3,0... for it to work as the sound card may have a different identifier, hopefully we fix the issue for you too! :)

@raixer
Copy link

raixer commented Jul 14, 2020

Oh I have no problems with audio. I am running homebridge on a mac. What I was asking before was about the audio_path. I didn't realize you had added that option in the GUI.

@MiguelRipoll23
Copy link
Owner

Sorry! I meant the author of this issue (@mfischcgn) instead.

Refer to 44#issuecomment-658295471 to solve this issue.

Thank you!

@raixer
Copy link

raixer commented Jul 17, 2020

@MiguelRipoll23 I was just testing the update today. Took me a while to figure out how to make the custom sounds folder. Had to read the committed code in order to see that I have to have folder 'en-US' inside and the audio file has to follow the same naming convention. But finally got it working.
That info should be added in the documentation tho.

@MiguelRipoll23
Copy link
Owner

@raixer just added these changes to the beta channel:

  • Language directory is now automatically created.
  • Instructions are added to the audio_path directory.
  • Updated README & plugin log to reflect the instructions file creation.

My biggest priority has been adding debug messages to the plugin, they're very helpful during testing. I was hoping to improve the documentation and Wiki this week but unfortunately I was quite busy.

Thanks!

@stale
Copy link

stale bot commented Jul 26, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed investigating What the... stale Hello?
Projects
None yet
Development

No branches or pull requests

4 participants