Skip to content

matdoess/zerocam

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zerocam

Python based interface for the pi zero w for timelapse videos and live streaming

Used Hardware

System Info

User & Password

  • Linux - pi:raspberry
  • Django -

Access Point

  • SSID: zerocamap
  • Password: zerocampw
  • static ip: 192.168.4.1
  • dhcp-range: 192.168.4.2 - 192.168.4.20

URL's

.service files

picam.service | start picam streaming
django.service | Django Webinterface
gpiobutton.service | listen for button press and shutdown pi or activate access point
picam-ramdisk.service | create ramdisk folder on startup

folders

  • testing: code snippets and testing of modules
  • script: mainly setup and startup scripts
  • media: folder for videos, images, timelapse, etc.

Setup

Basic Raspberry Setup

  • Set shared Memory to 256mb
    Needed for picamera pictures with highest resolution

ffmpeg installation (with hardware acceleration)

https://github.com/legotheboss/YouTube-files/wiki/(RPi)-Compile-FFmpeg-with-the-OpenMAX-H.264-GPU-acceleration https://www.reddit.com/r/raspberry_pi/comments/5677qw/hardware_accelerated_x264_encoding_with_ffmpeg/ https://askubuntu.com/questions/87111/if-i-build-a-package-from-source-how-can-i-uninstall-or-remove-completely

Delete previous version of ffmpeg: sudo apt-get remove ffmpeg

Install checkinstall: sudo apt-get install checkinstall

Download and Compile ffmpeg with Hardware Acceleration on Raspberry Pi:

cd /home/pi/
sudo apt-get install libomxil-bellagio-dev -y
git clone https://github.com/FFmpeg/FFmpeg.git
cd FFmpeg
sudo ./configure --arch=armel --target-os=linux --enable-gpl --enable-omx --enable-omx-rpi --enable-nonfree
sudo make
sudo checkinstall

You can remove it from your system anytime using:
dpkg -r ffmpeg

If an error occurs when running checkinstall try:
sudo checkinstall --fstrans=no

ffmpeg with mmal support (probably not needed):
https://maniaclander.blogspot.com/2017/08/ffmpeg-with-pi-hardware-acceleration.html
sudo ./configure --arch=armel --target-os=linux --enable-gpl --enable-mmal --enable-omx --enable-omx-rpi --enable-nonfree

Programming

TODO

Python

  1. pip3 install --user pipenv (required)

Django

Setup Project(for Documentation only)

  1. pipenv install
  2. Projekt erstellen django-admin startproject zerocam_ui
  3. In zerocam_ui Ordner wechseln
  4. pipenv shell
  5. Django App erstellen python manage.py startapp wifi_setup
  6. Anleitung befolgen https://docs.djangoproject.com/en/2.1/intro/tutorial01/
  7. Admin User erstellen python manage.py createsuperuser

Run Application

  1. cd zerocam/
  2. pipenv install
  3. pipenv run zerocam_ui/manage.py runserver
  4. Enjoy

Livestream

-- Symlink anlegen damit django die Files ausliefert ln -s /run/shm/hls /home/pi/zerocam/zerocam_ui/wifi_setup/static/video

Commands for Testing

picam

picam with hls streaming / framerate 25 / volume gain 10x:
/home/pi/picam/picam --alsadev complex_convert -o /run/shm/hls -f 25 --volume 10
picam with timestam
/home/pi/picam/picam --alsadev complex_convert -o /run/shm/hls -f 25 --volume 10 --time
picam with timeformat "2018-12-01 12:30:05"
/home/pi/picam/picam --alsadev complex_convert -o /run/shm/hls -f 25 --volume 10 --time --timeformat "%F %T"

ffmpeg

Create timelapse from jpg
ffmpeg -framerate 10 -pattern_type glob -i '*.jpg' -r 25 timelapse10.mp4
Create timelapse with hardware acceleration
(Change -framerate value to your needs)
ffmpeg -framerate 10 -pattern_type glob -i '*.jpg' -c:v h264_omx -b:v 4000k -r 25 timelapse10.mp4

systemd

https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units

check if service is active
https://stackoverflow.com/questions/30056280/test-if-a-systemd-unit-is-active-in-a-bash-script
systemctl is-active picam.service
check if service is active (only exit-code):
systemctl -q is-active picam.service

Reference

picamera

https://picamera.readthedocs.io/en/release-1.13/index.html

i2s mems mic

mpromonet/v4l2rtspserver#94 (comment)

Power Button

https://howchoo.com/g/mwnlytk3zmm/how-to-add-a-power-button-to-your-raspberry-pi

Programming Basics

Efficency of while loops

if conditions

About

Python based interface for the pi zero w for timelapse videos and live streaming

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages