MyCave

RaspberryPI stream video and audio

WORKING version found here: https://hmbd.wordpress.com/2016/08/01/raspberry-pi-video-and-audio-recording-and-streaming-guide/


server.sh script


#!/bin/bash

# clear states by picam
cd $HOME/picam
rm state
rm hooks
rm -rf rec


SESSION_NAME="picam"

tmux new-session -s $SESSION_NAME -n "picam" -d

tmux split-window -v -t $SESSION_NAME


tmux send-keys -t $SESSION_NAME:1.1 'cd '$HOME'/picam; sleep 10; ./picam --alsadev hw:1,0 --rtspout -w 800 -h 480 -v 500000 -f 20' C-m
tmux send-keys -t $SESSION_NAME:1.2 'cd '$HOME'/node-rtsp-rtmp-server; ./start_server.sh ' C-m


truncate -s 0 ~/urls

ips=$(hostname -I)
for ip in $ips
do
        echo "rtsp://"$ip"/live/picam" >> ~/urls
done

leafpad --display :0.0 ~/urls



Then create a auto start script at ~/.config/autostart/server.desktop


[Desktop Entry]
Encoding=UTF-8
Name=PicamServer
Terminal=false
Type=Application
Comment=Start a terminal and list directory
Categories=AudioVideo;
Exec=/usr/bin/lxterminal -e '/home/pi/server.sh'



For my case i have attached 3.5" display that's why i show the links for vlc/player with leafpad.