Rpi VLC



  • Hi All,

    I'm attempting to push a Raspberry Pi VLC video stream to my google home hub.
    test.sh
    #!/bin/bash
    a="$(date)"
    p="/home/pi/tmp/Script_ran_$(date +%F_%R).txt"
    echo $a >> $p
    timeout 60 cvlc /home/pi/Desktop/test.mp4 --sout '#chromecast' --sout-chromecast-ip=192.168.0.10 --demux-filter=demux_chromecast

    Commands.json
    {"trigger":"Video background","command":"/home/pi/tmp/test.sh","ground":"background","voice":"video background",allowParams":"false"},

    Running test.sh writes the file and pushes the video to the google home hub.
    TRIGGERcmd writes the text file but does not start the video :(

    Any help would be greatly appreicated.

    Raspberry Pi 3, Raspbian Stretch with desktop (Nov 2018)



  • @belleye, that's pretty cool. I didn't know you could do that.

    I think you're probably trying to run cvlc as root because when you run background commands on a Pi, they run as root.

    root@pi:~# cvlc
    VLC is not supposed to be run as root. Sorry.
    If you need to use real-time priorities and/or privileged TCP ports
    you can use /usr/bin/vlc-wrapper (make sure it is Set-UID root and
    cannot be run by non-trusted users first).
    

    You can be root and run something as the pi user like this:

    root@pi:~# sudo -u pi cvlc
    VLC media player 3.0.3 Vetinari (revision 3.0.3-1-0-gc2bb759264)
    [00d0b048] vlcpulse audio output error: PulseAudio server connection failure: Connection refused
    [00d247e8] dbus interface error: Failed to connect to the D-Bus session daemon: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
    [00d247e8] main interface error: no suitable interface module
    [00cb2938] main libvlc error: interface "dbus,none" initialization failed
    [00d2fd80] main interface error: no suitable interface module
    [00cb2938] main libvlc error: interface "globalhotkeys,none" initialization failed
    [00d2fde8] dummy interface: using the dummy interface module...
    [00d196e8] main playlist: playlist is empty
    

    Also, I like the tags. I think you're the first person who's used them.



  • @russ, Thanks that sorted it. The MP4 was only to simplify things, the real power comes from linking to a IP camera.

    driveway.sh
    sudo -u pi timeout 60 cvlc rtsp://192.168.0.11:554/user=xxxxx_password=xxxxx_channel=1_stream=0.sdp?real_stream --sout '#chromecast' --sout-chromecast-ip=192.168.0.10 --demux-filter=demux_chromecast

    Now I don't need a nest camera :)

    One last piece in the puzzle, can I share my triggercmd account with my wife's google account? Or do I need 2 RPIs?

    I can execute the script from google home, but my wife can't use the service due to not having a triggercmd account.



  • @belleye, you're probably using Voice Match, so Google Home uses a different Google account depending on who's talking. The issue is you can only have one Google account linked to a TRIGGERcmd account. If you link a second account, it invalidates the previous account's link.

    This issue came up before and the best solution seemed to be to use IFTTT like this:

    Her Google account triggers an IFTTT recipe with Google Assistant on THIS side, and a Webhook on THAT side, which triggers the command with your TRIGGERcmd token.



  • @russ Thanks I'm away for a week or more, I'll have a crack when I get back.