... | ... |
@@ -2,7 +2,78 @@ |
2 | 2 |
|
3 | 3 |
Zoom in on video motion. |
4 | 4 |
|
5 |
+- [Usage](#usage) |
|
6 |
+- [Install](#install) |
|
7 |
+ - [With `pipx`, for users](#with-pipx-for-users) |
|
8 |
+ - [Into `venv`, for developers](#into-venv-for-developers) |
|
9 |
+- [License](#license) |
|
10 |
+ |
|
11 |
+`zoommotion` is implemented in [Python][], uses [OpenCV][] and [SciPy][] for |
|
12 |
+processing, and external [FFmpeg][] processes for broad file read and write |
|
13 |
+support (via [`ffmpeg-python`][] and [`pyffstream`][]). |
|
14 |
+ |
|
15 |
+Simple algorithms are used to achieve speed with acceptable results ([Gaussian |
|
16 |
+mixture background/foreground segmentation][] and [Gaussian blur][] paired with |
|
17 |
+a [Butterworth filter][]). Algorithm parameters and input/output file |
|
18 |
+parameters can be supplied with command line options, see [Usage](#usage). |
|
19 |
+ |
|
5 | 20 |
[`zoommotion`]: https://git.rcrnstn.net/rcrnstn/zoommotion |
21 |
+[Python]: https://www.python.org |
|
22 |
+[OpenCV]: https://opencv.org/about/ |
|
23 |
+[SciPy]: https://www.scipy.org |
|
24 |
+[FFmpeg]: https://ffmpeg.org |
|
25 |
+[`ffmpeg-python`]: https://github.com/kkroening/ffmpeg-python |
|
26 |
+[`pyffstream`]: https://git.rcrnstn.net/rcrnstn/pyffstream |
|
27 |
+[Gaussian mixture background/foreground segmentation]: https://docs.opencv.org/3.4/d7/d7b/classcv_1_1BackgroundSubtractorMOG2.html |
|
28 |
+[Gaussian blur]: https://docs.opencv.org/3.4/d4/d86/group__imgproc__filter.html#gaabe8c836e97159a9193fb0b11ac52cf1 |
|
29 |
+[Butterworth filter]: https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.butter.html |
|
30 |
+ |
|
31 |
+## Usage |
|
32 |
+ |
|
33 |
+`zoommotion --help`: |
|
34 |
+ |
|
35 |
+``` |
|
36 |
+usage: zoommotion [-h] [--margins L R T B] [--blur-factor F] |
|
37 |
+ [--blur-threshold T] [--lowpass-factor F] |
|
38 |
+ [--start-frame FRAME] [--end-frame FRAME] [--decimate COUNT] |
|
39 |
+ [--width WIDTH] [--height HEIGHT] [--codec CODEC] |
|
40 |
+ [--pix-fmt PIX_FMT] [--extra-args ARGS] [--no-preview] |
|
41 |
+ [--no-write] [--no-audio] [--overwrite] [--debug DEBUG_FILE] |
|
42 |
+ [--output OUTPUT_FILE] |
|
43 |
+ INPUT_FILE |
|
44 |
+ |
|
45 |
+Zoom in on video motion. |
|
46 |
+ |
|
47 |
+positional arguments: |
|
48 |
+ INPUT_FILE input file |
|
49 |
+ |
|
50 |
+optional arguments: |
|
51 |
+ -h, --help show this help message and exit |
|
52 |
+ --margins L R T B margins (left, right, top, bottom, in percent) of |
|
53 |
+ output video (default: [0, 0, 0, 0]) |
|
54 |
+ --blur-factor F blur size factor (default: 0.05) |
|
55 |
+ --blur-threshold T blur threshold (default: 32) |
|
56 |
+ --lowpass-factor F low-pass filter cutoff frequency factor (default: |
|
57 |
+ 0.00015) |
|
58 |
+ --start-frame FRAME starting input frame to process (inclusive) |
|
59 |
+ --end-frame FRAME ending input frame to process (exclusive) |
|
60 |
+ --decimate COUNT only use every COUNT input frame |
|
61 |
+ --width WIDTH width of output video |
|
62 |
+ --height HEIGHT height of output video |
|
63 |
+ --codec CODEC codec of output video |
|
64 |
+ --pix-fmt PIX_FMT pixel format of output video |
|
65 |
+ --extra-args ARGS extra arguments to pass to FFmpeg, as a JSON object |
|
66 |
+ (do not specify the leading dash for keys, use a null |
|
67 |
+ value for arguments that do not take a parameter) |
|
68 |
+ --no-preview do not show any previews |
|
69 |
+ --no-write do not write any files |
|
70 |
+ --no-audio do not include audio in output files |
|
71 |
+ --overwrite overwrite output files |
|
72 |
+ --debug DEBUG_FILE produce debug output (leave empty to base filename on |
|
73 |
+ input) |
|
74 |
+ --output OUTPUT_FILE produce final output (leave empty to base filename on |
|
75 |
+ input) |
|
76 |
+``` |
|
6 | 77 |
|
7 | 78 |
## Install |
8 | 79 |
|
... | ... |
@@ -4,6 +4,68 @@ Zoom in on video motion. |
4 | 4 |
|
5 | 5 |
[`zoommotion`]: https://git.rcrnstn.net/rcrnstn/zoommotion |
6 | 6 |
|
7 |
+## Install |
|
8 |
+ |
|
9 |
+Make sure [Python is installed][Python download], [`pip`][] is available and |
|
10 |
+the [`pip`][], [`setuptools`][] and [`wheel`][] packages are up to date: |
|
11 |
+ |
|
12 |
+```sh |
|
13 |
+python3 -m pip install --user --upgrade pip setuptools wheel |
|
14 |
+``` |
|
15 |
+ |
|
16 |
+Reference: [Python Packaging User Guide: Requirements for Installing |
|
17 |
+Packages][]. |
|
18 |
+ |
|
19 |
+[Python download]: https://python.org/download |
|
20 |
+[`pip`]: https://pip.readthedocs.io |
|
21 |
+[`setuptools`]: https://setuptools.readthedocs.io |
|
22 |
+[`wheel`]: https://wheel.readthedocs.io |
|
23 |
+[Python Packaging User Guide: Requirements for Installing Packages]: https://packaging.python.org/tutorials/installing-packages/#requirements-for-installing-packages |
|
24 |
+ |
|
25 |
+### With [`pipx`][], for users |
|
26 |
+ |
|
27 |
+Make sure [`pipx`][] is installed: |
|
28 |
+ |
|
29 |
+```sh |
|
30 |
+python3 -m pip install --user pipx |
|
31 |
+``` |
|
32 |
+ |
|
33 |
+Install `zoommotion`: |
|
34 |
+ |
|
35 |
+```sh |
|
36 |
+pipx install "git+https://git.rcrnstn.net/rcrnstn/zoommotion" |
|
37 |
+``` |
|
38 |
+ |
|
39 |
+`zoommotion` should now be in your [`PATH`][] (if not, run `python3 -m pipx |
|
40 |
+ensurepath`). |
|
41 |
+ |
|
42 |
+Reference: [Python Packaging User Guide: Installing stand alone command line |
|
43 |
+tools][]. |
|
44 |
+ |
|
45 |
+[`pipx`]: https://pipxproject.github.io/pipx/ |
|
46 |
+[`PATH`]: https://en.wikipedia.org/wiki/PATH_(variable) |
|
47 |
+[Python Packaging User Guide: Installing stand alone command line tools]: https://packaging.python.org/guides/installing-stand-alone-command-line-tools/ |
|
48 |
+ |
|
49 |
+### Into [`venv`][], for developers |
|
50 |
+ |
|
51 |
+Clone and install into a repository [`venv`][] virtual environment: |
|
52 |
+ |
|
53 |
+```sh |
|
54 |
+git clone "https://git.rcrnstn.net/rcrnstn/zoommotion" |
|
55 |
+cd "zoommotion" |
|
56 |
+python3 -m venv .venv |
|
57 |
+. .venv/bin/activate |
|
58 |
+python3 -m pip install --editable . |
|
59 |
+``` |
|
60 |
+ |
|
61 |
+`zoommotion` should now be in your (virtual environment) [`PATH`][]. |
|
62 |
+ |
|
63 |
+Reference: [Python Packaging User Guide: Installing packages using pip and |
|
64 |
+virtual environments][]. |
|
65 |
+ |
|
66 |
+[`venv`]: https://docs.python.org/3/library/venv.html |
|
67 |
+[Python Packaging User Guide: Installing packages using pip and virtual environments]: https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/ |
|
68 |
+ |
|
7 | 69 |
## License |
8 | 70 |
|
9 | 71 |
Licensed under the [ISC License][] unless otherwise noted, see the |
... | ... |
@@ -3,3 +3,11 @@ |
3 | 3 |
Zoom in on video motion. |
4 | 4 |
|
5 | 5 |
[`zoommotion`]: https://git.rcrnstn.net/rcrnstn/zoommotion |
6 |
+ |
|
7 |
+## License |
|
8 |
+ |
|
9 |
+Licensed under the [ISC License][] unless otherwise noted, see the |
|
10 |
+[`LICENSE`][] file. |
|
11 |
+ |
|
12 |
+[ISC license]: https://en.wikipedia.org/wiki/ISC_license |
|
13 |
+[`LICENSE`]: LICENSE |