huceke / omxplayer

omxplayer
GNU General Public License v2.0
522 stars 502 forks source link

Raspberry Pi 2, can't route audio to alsa:hw:1,0 #294

Closed snobu closed 7 years ago

snobu commented 7 years ago

Just trying to output audio over my USB device (Logitech G330 Headset). Told omxplayer to use alsa:hw:1,0 as audio device but the audio doesn't come through.

pi@raspberrypi:~ $ omxplayer --loop --aspect-mode stretch -o alsa:hw:1,0 --vol +200 \
                      $(youtube-dl -g "https://www.youtube.com/watch?v=kIBtqXj3Ftk")

I've also tried to set my device as the default sound device for ALSA, but to no avail. speaker-test for example works just fine and i can hear the test noise.

pi@raspberrypi:~ $ omxplayer -v
omxplayer - Commandline multimedia player for the Raspberry Pi
        Build date: Mon, 30 Jan 2017 01:52:37 +0000
        Version   : 62fb580 [master]

What am i doing wrong?

snobu commented 7 years ago

Nevermind, it seems there's a problem with the last part, the youtube-dl part. If i download the video locally first and run omxplayer against the local file, audio comes up just nicely.

Seems youtube-dl -g sometimes will default to video only formats, but you can override that with

-f FORMAT_ID

like this:

pi@raspberrypi:~ $ omxplayer --loop --aspect-mode stretch -o alsa:hw:1,0 --vol +200 \
                      $(youtube-dl -g "https://www.youtube.com/watch?v=kIBtqXj3Ftk" -f 18)

Use this to get available formats for a video:

youtube-dl $URL -F