Moonlight x86_64 sound fix. How-To

  • The no sound problem is because pulseaudio is configured to output to a dummy sound device.
    We need to configure it to output to our sound card.
    So you need to get your sound card number and device number. Mine for example is hw:0,7
    This looks a little complicated but its not. Only two lines in moonlight.sh need changed to fix the sound.

    To find your numbers SSH into LibreELEC and do:
    # aplay -l

    This will return a list of sound devices.
    Here is one of mine.

    card 0: HDMI [HDA Intel HDMI], device 7: HDMI 1 [HDMI 1]

    To test if this the right device substitute the CARD number and DEVICE number into this command.
    # aplay -D plughw:CARD,DEVICE /usr/share/kodi/addons/http://resource.uisounds.kodi/resources/notify.wav

    Test each one of your sound devices in turn until you hear output from your speakers.
    When you find the correct sound device you will use the CARD and DEVICE numbers below.

    Now its time to edit moonlight.sh using nano or something like WinSCP.
    # nano /storage/.kodi/addons/script.moonlight/bin/moonlight.sh

    scroll to the bottom of moonlight.sh and find this section of the script.

    modprobe snd_bcm2835 || :
    echo $MOONLIGHT_ARG >> $ADDON_LOG_FILE
    /bin/sh -c "${ADDON_DIR}/bin/moonlight ${MOONLIGHT_ARG} > ${ADDON_LOG_FILE} 2>&1"
    rmmod snd_bcm2835 || :

    Change it to read like this.

    INDEX=$(pactl load-module module-alsa-sink device=hw:CARD,DEVICE channels=2)
    echo $MOONLIGHT_ARG >> $ADDON_LOG_FILE
    /bin/sh -c "${ADDON_DIR}/bin/moonlight ${MOONLIGHT_ARG} > ${ADDON_LOG_FILE} 2>&1"
    pactl unload-module $INDEX

    Be sure to replace CARD and DEVICE with the numbers you found above. And set the number of channels. For 5.1 channels=6

    Also, in moonlight's settings, disable "Force video acceleration", and reboot after making any changes to the settings.

    Sadly its buggy with some games. In the Witcher 3 for instance some sounds play on the host pc.
    Works great for Doom and Assassins Creed though.

    Edited once, last by rbtcordell (November 16, 2016 at 8:21 AM).

  • Hi, this is very interesting... as I'm not able to get any VIDEO from the moonlight addon in x64. Can anyone help me ? I tried every option on the addon. I'm running latest GE version (3.4.0.70) and it works perfectly on the same LE 8.0.1 on my RPi3, but no video on x64 (Brix Mini PC).

    Any ideas or recommendations for this problem ?

    Thanks.

  • if is start but then black screen and reload? this is a issue with the host pc... in android version it commits with "the host pc is in game, pls stop it first" ... after an reboot of home pc and no starting software it works