0

HiFi Berry with VLC command line

I'm trying to make a headless raspberry pi music player using hifiberry DAC with VLC. I'm pretty sure I just need some help with the exact command but I don't know enough about Linux to get it right.

I have it working well if I open a remote terminal using putty, and log in as pi, and give it this command:
Cvlc -A alsa -I dummy --quiet

I can then remotely control it with a VLC app on my cell phone

now, all I wanted to do, is add this to /etc/rc.local so it would autorun on boot.. but it just will not work... something about it not running under root or something.

I've found some tutorials on the internet on how to make it autorun by creating a user account for it and running a command in a script then running the script in rc.local, and when I do this, it does work as far as starting vlc at startup, and I can then access it with my phone, but the problem is, now I have no sound from hifiberry, but instead I am getting errors because it's trying to send its output to a nonexistent device. I have followed the instructions for installing the driver for hifiberry, but perhaps because it's a different user I need to set something up? Or perhaps I need to specify better to use the hifiberry with the command prompt?

Here are some details that hopefully will mean something to someone and help me solve this:
if I log in my remote terminal as pi and give the command:
cvlc -A alsa -I dummy

I get the following:

pi@raspberrypi ~ $ cvlc -A alsa -I dummy
VLC media player 2.0.3 Twoflower (revision 2.0.2-93-g77aa89e)
[0x1e8e870] inhibit interface error: Failed to connect to the D-Bus session daemon: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
[0x1e8e870] main interface error: no suitable interface module
[0x1e8e870] main interface error: no suitable interface module
[0x1d028f0] main libvlc error: interface "globalhotkeys,none" initialization failed
[0x1d15528] [http] lua interface: Lua HTTP interface
[0x1ed4d48] dummy interface: using the dummy interface module...

I have some errors that I don't understand, but probably due to have never started a GUI... but it DOES work,and does play through hifiberry. If I send the command:

cvlc -A alsa -I dummy --quiet

then I just do not see the errors and everything works great.

for my autorun script, I made an account with no password called vlc and created a script file called /etc/vlc/start.sh
contents of /etc/vlc/start.sh

#!/bin/sh
VLC_PORT=8080
VLC_USER=vlc

sudo -u vlc cvlc -A alsa -I http --http-port ${VLC_PORT}

when I run it I get:

pi@raspberrypi ~ $ /etc/vlc/start.sh
VLC media player 2.0.3 Twoflower (revision 2.0.2-93-g77aa89e)
[0x992c48] inhibit interface error: Failed to connect to the D-Bus session daemon: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
[0x992c48] main interface error: no suitable interface module
[0x992c48] main interface error: no suitable interface module
[0x9718f0] main libvlc error: interface "globalhotkeys,none" initialization failed
[0x992c48] [http] lua interface: Lua HTTP interface

At this point, the http interface is working, and I can use my phone to select a tract and play it, but I hit play, I get:

[0x1e29830] alsa audio output error: cannot open ALSA device "default": Permission denied
[0x1e29830] main audio output error: Audio output failed
[0x1e29830] main audio output error: The audio device "default" could not be used:
Permission denied.
Home directory /home/vlc not ours.
[0x1e29830] pulse audio output error: PulseAudio server connection failure: Connection refused
[0x1e29830] oss audio output error: cannot open audio device (/dev/dsp)
[0x1e29830] main audio output error: no suitable audio output module
[0x1e212e8] main decoder error: failed to create audio output

after it shows this error, it acts like it's playing something, but no sounds are being produced.

I can see that the device does not have permission, but I just don't know why or how to fix it. I don't know why I need permission to use my own hardware, why I don't have it already, or how to give it permission to be used.

Any one have any ideas about this?







2 comments

Please sign in to leave a comment.