Proposed:
HW:
pz woh
4btn msh pad
[1] stream start
[2] stream stop
[3] restart
[4] shutdown
streaming online led
USB | piCam - IR
16G SD
usb2micro x 2
sw
motion
raspian light image
streamerpi (extract piaccbtn_v7.py)
Remote start/stop/flip/down
---------------------- SD Raspi Light
run in update and upgrade. Console
sudo Raspi-confi to set up pw, expand disk, set wifi, boot to pi console.
add pw,
Install motion
sudo apt-get install motion
sudo nano /etc/default/motion
Enable daemon
# set to 'yes' to enable the motion daemon
start_motion_daemon=yes
logs -/var/log/motion/motion.log
Launcher - /etc/init.d/motion
file output- /var/lib/motion
If you are getting errors about the logs, remove the /var/logs/motion entire directory.
It will rebuild it and start working.
cd /var/logs/motion
sudo rm motion
cd ..
sudo rm -R motion
reboot.
sudo service motion status should include:
Active: active (running) since Wed
If you are also having problems with the /var/lib/motion errors, you can delete it as well.
It will rebuild it. On one test, I had to do that and it fixed the permissions problem.
If it says active(exited), check the logs for the problem.
edit /etc/motion/motion.conf
Flask
Optional Remote Control
I will be making the unit accessible from a remote machine. This will allow me to also start and stop streaming from another machine.
For now, I will use the html landing page from piACC, but will add a simple html interface shortly.
Reference:
You can use this tutorial to add an interface. Though it is more for the GPIO relay control, it is everything you need to run the commands needed, you just need to dress up the index.html file.
Adding Interface
sudo pip install flask
We will simply need to run some commands on button press.
Reference:
Shell cmds from flask
I will work on streaming directly from motion, but for now I am testing with just using ffmpeg.
You will need to get a stream URL and key from youtube.
You can find it under your channel if you click on
Go Live instead of upload video in the menu .

It will be under Encoder Setup

Click Reveal to reveal your key.
ffmpeg -f alsa -ac 2 -i hw:1 -f v4l2 -s 1920x1080 -r 30 -input_format h264 -i /dev/video0 -vcodec copy -r 15 -g 30 -b:v 3000k -ar 44100 -threads 6 -b:a 96k -bufsize 3000k -f flv rtmp://a.rtmp.youtube.com/live2/YOUR_STREAM_KEY
I have created a shell command called stream.sh and will put it in the pi home directory. You will need to update your key in the line above.
You will also need to insure motion is not running by running
sudo service motion stop
Become a Patron to view code!