Skip to content

Commit

Permalink
Version 1.4.0 (#1)
Browse files Browse the repository at this point in the history
Cleaning up and turning into public repo
  • Loading branch information
cdgriffith authored Jun 28, 2020
1 parent 87c089d commit 825157e
Show file tree
Hide file tree
Showing 7 changed files with 401 additions and 155 deletions.
111 changes: 111 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
lvenv/
venv*/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/

.idea/

config.yaml
*.log
8 changes: 8 additions & 0 deletions .idea/raspberry_pi_streaming_setup.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.5.0
hooks:
- id: mixed-line-ending
- id: trailing-whitespace
- id: requirements-txt-fixer
- id: check-yaml
- id: check-json
- id: fix-encoding-pragma
- id: check-byte-order-marker
- id: debug-statements
- repo: https://github.com/psf/black
rev: stable
hooks:
- id: black
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License

Copyright (c) 2020 Chris Griffith

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
84 changes: 84 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,86 @@
# Raspberry Pi Camera / Webcam streaming helper scripts

This script is designed to help automate turing a raspberry pi with a
compatible video4linux2 camera into a MPEG-DASH / HLS streaming server.

The steps it will attempt to take:

* Install nginx
* Install FFmpeg OR (optional) Compile and Install FFmpeg with h264 hardware acceleration
* Update rc.local to run required setup script on reboot
* Create index.html file to view video stream at
* Create systemd service and enable it

If you will be compiling while running over SSH, please use in a background terminal like "tmux" or "screen".

If you are compilng FFmpeg, be aware, this will build a NON REDISTRIBUTABLE FFmpeg.
You will not be able to share the built binaries under any license.

To use the standard FFmpeg, just need to run the script as root / sudo then you're good to go:

```
sudo python3 streaming_setup.py
```

If you want to compile FFmpeg make sure to pass the `--compile-ffmpeg` flag
and I suggest setting the user to `pi` if making in your home directory.

```
sudo python3 streaming_setup.py --compile-ffmpeg --run-as pi
```



## Script Options

```
usage: streaming_setup [-h] [-v] [-d DEVICE] [-s VIDEO_SIZE] [-f INPUT_FORMAT]
[-c CODEC] [--ffmpeg-params FFMPEG_PARAMS]
[--index-file INDEX_FILE]
[--on-reboot-file ON_REBOOT_FILE]
[--systemd-file SYSTEMD_FILE] [--compile-ffmpeg]
[--camera-info] [--minimal] [--run-as RUN_AS]
[--disable-fdk-aac] [--disable_avisynth]
[--disable-dav1d] [--disable-zimg] [--disable-kvazaar]
[--disable-libxavs] [--disable-libsrt] [--rebuild-all]
[--safe]
streaming_setup version 1.4.0
optional arguments:
-h, --help show this help message and exit
-v, --version
-d DEVICE, -i DEVICE, --device DEVICE
Camera. Selected: /dev/video0
-s VIDEO_SIZE, --video-size VIDEO_SIZE
The video resolution from the camera (using 2592x1944)
-f INPUT_FORMAT, --input-format INPUT_FORMAT
The format the camera supports (using h264)
-c CODEC, --codec CODEC
Conversion codec (using 'copy')
--ffmpeg-params FFMPEG_PARAMS
specify additional FFmpeg params, helpful if not
copying codec e.g.: '-b:v 4M -maxrate 4M -buffsize 8M'
--index-file INDEX_FILE
--on-reboot-file ON_REBOOT_FILE
--systemd-file SYSTEMD_FILE
--compile-ffmpeg
--camera-info Show all detected cameras [/dev/video(0-9)] and exit
--minimal Minimal FFmpeg compile including h264, x264, alsa
sound and fonts
--run-as RUN_AS compile programs as provided user (suggested 'pi',
defaults to 'root')
--disable-fdk-aac Normally installed on full install
--disable_avisynth Normally installed on full install
--disable-dav1d Normally installed on full install
--disable-zimg Normally installed on full install
--disable-kvazaar Normally installed on full install
--disable-libxavs Normally installed on full install
--disable-libsrt Normally installed on full install
--rebuild-all Recompile all libraries
--safe disable overwrite of existing or old scripts
```

## License

MIT License - Copyright (c) 2020 Chris Griffith
15 changes: 15 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[tool.black]
line-length = 120
target-version = ['py36', 'py37', 'py38']
exclude = '''
/(
\.eggs
| \.git
| \.idea
| \.pytest_cache
| _build
| build
| dist
| venv
)/
'''
Loading

0 comments on commit 825157e

Please sign in to comment.