Home > Back-end >  VLC Raspberry pi 4 how to send audio to HDMI 2 via command line?
VLC Raspberry pi 4 how to send audio to HDMI 2 via command line?

Time:06-27

I'm running Rasbian OS on a raspberry pi 4 with two HDMI ports and via terminal, I can run a video with audio working on HDMI 1 using sudo cvlc --alsa-audio-device default video.mp4 now the problem I'm facing is running a second video on HDMI 2 with audio, I can get the video running using this command DISPLAY=:0 cvlc --qt-fullscreen-screennumber=1 --alsa-audio-device hw:1,0 video.mp4 but I can't seem to get the audio working on HDMI 2.

I checked my audio outputs using aplay -l which gave me the following output.

**** List of PLAYBACK Hardware Devices ****
card 0: b1 [bcm2835 HDMI 1], device 0: bcm2835 HDMI 1 [bcm2835 HDMI 1]
  Subdevices: 3/4
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
card 1: b2 [bcm2835 HDMI 2], device 0: bcm2835 HDMI 2 [bcm2835 HDMI 2]
  Subdevices: 2/2
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
card 2: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]
  Subdevices: 2/2
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1

The problem is I'm not really sure how to address the sound card 1 on --alsa-audio-device

CodePudding user response:

This solved my problem, I can now send audio individually to each HDMI by selecting the specific hardware output via command line.

HDMI1

DISPLAY=:0 cvlc  --alsa-audio-device hw:0,0 video.mp4

HDMI 2

DISPLAY=:0 cvlc --qt-fullscreen-screennumber=1 --alsa-audio-device hw:1,0 video.mp4

CodePudding user response:

Your problem is that the pi thinks of them as hdmi 0 and hdmi 1, so hdmi 0 is acctually 1, and hdmi 1 is 2. You can see this on the labelling on the ports on the pi

  • Related