Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/laurent22/pmcam
Poor man's video capture with motion detection in Bash
https://github.com/laurent22/pmcam
Last synced: 15 days ago
JSON representation
Poor man's video capture with motion detection in Bash
- Host: GitHub
- URL: https://github.com/laurent22/pmcam
- Owner: laurent22
- Created: 2015-01-26T17:10:00.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2019-12-08T01:29:30.000Z (almost 5 years ago)
- Last Synced: 2024-08-02T16:48:05.565Z (3 months ago)
- Language: Shell
- Size: 4.88 KB
- Stars: 38
- Watchers: 6
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# pmcam - poor man's video capture with motion detection in Bash
This simple Bash script captures images from a webcam with motion detection support. I wanted to find out what my dog was up to when I am not at home, but could not find any free video capture software on OS X. I put together this quick and dirty solution, which does the job surprisingly well.
Frames are captured at regular intervals using `ffmpeg`. Then ImageMagick's `compare` tool is used to check if this frame is similar to the previous one. If the frames are different enough, they are kept, otherwise they are deleted. This provide very simple motion detection and avoids filling up the hard drive with duplicate frames.
## Installation
### OS X
brew install ffmpeg
brew install imagemagick
curl -O https://raw.github.com/laurent22/pmcam/master/pmcam.sh### Linux (Debian)
sudo apt-get install ffmpeg
# or: sudo apt-get install libav-tools
sudo apt-get install imagemagick
curl -O https://raw.github.com/laurent22/pmcam/master/pmcam.sh### Windows
(Not tested)
* Install [Cygwin](https://www.cygwin.com/) or [MinGW](http://www.mingw.org/)
* Install [ffmpeg](http://ffmpeg.zeranoe.com/builds/)
* Install [ImageMagick](http://www.imagemagick.org/script/binary-releases.php)## Usage
./pmcam.sh
The script will use the default webcam to capture frames. To capture using a different camera, the ffmpeg command `-i` parameter can be changed - see the [ffmpeg documentation](https://trac.ffmpeg.org/wiki/Capture/Webcam) for more information.
A frame will then be saved approximately every 1 second to the "images" folder next to the Bash script. Both delay and target folder can be changed in the script.
To stop the script, press Ctrl + C.
## TODO
* Allow specifying the video capture source and format (curently hardcoded)
* Command line argument to change frame directory.
* Command line argument to change interval between frame captures.
* Command line argument to specify the threshold for a frame to be kept.## License
MIT