Muting HDMI Audio Output

Hi all,

When using my Odroid N2 I wanted to be able to mute the HDMI Audio Output when using SPDIF, so I used the F3 key on my remote to run a command.

Keymap was this:

<keymap>
	<global>
			<keyboard>
				<key id="61530">control.setfocus(9000,0,absolute)</key>
				<F1>RunScript(script.audio.profiles,1)</F1>      <!-- switches to profile 1 -->
				<F2>RunScript(script.audio.profiles,2)</F2>      <!-- switches to profile 2 -->
				<F6>RunScript(script.audio.profiles,3)</F6>      <!-- switches to profile 3 -->
				<F4>RunScript(script.audio.profiles,4)</F4>      <!-- switches to profile 4 -->
				<F5>RunScript(script.audio.profiles,popup)</F5>  <!-- displays a dialog for you to pick a profile -->
				<F3>System.ExecWait(/storage/.kodi/userdata/headphones.sh)</F3>
				<F8>RunScript(script.audio.profiles,0)</F8>      <!-- rotates through the profiles -->
			</keyboard>
	</global>
</keymap>

Headphones.sh was this:

if amixer get 'Audio hdmi-out mute' | grep -q 'off'; then
	amixer sset 'Audio hdmi-out mute' on &> /dev/null
	kodi-send --action "RunScript(script.audio.profiles,2)"
else
	amixer sset 'Audio hdmi-out mute' off &> /dev/null
	kodi-send --action "RunScript(script.audio.profiles,1)"
fi

All I did was press F3 on the remote and start playing the video. There was no audio from the HDMI and I could listen to the SPDIF Headphones. All worked great for years.

I now have an AM6B+ and while the F3 key still mutes the HDMI output it is unmuted as soon as I start playing a video. Why, and how do I stop this from happening?

TIA

EDIT: Some more information - Seems the problem is related to playing HDR10 and HDR10+ videos only.

I enabled debug, rebooted, run headphones.sh at 2024-06-24 08:52:53.826 to enable the SPDIF output and to mute the audio from the HDMI output. This worked! I then played an HDR10 video via File Manager and the HDMI Audio became unmuted.

Log and configure is here:
https://paste.coreelec.org/ScammedFarmer

115 views and nobody has any ideas?

If you require more information please ask.