You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+50-30
Original file line number
Diff line number
Diff line change
@@ -28,8 +28,9 @@ A usage example can be found in `extract_mvs.py`.
28
28
29
29
### Recent Changes
30
30
31
+
- Provided PyPI package
31
32
- Added unittests in `tests/tests.py`
32
-
- Updated Python 3.10, and OpenCV 4.5.5
33
+
- Updated for compatibility with Python >3.8
33
34
- Provided a script to wrap Docker run command
34
35
- Updated demo script with command line arguments for extraction and storing of motion vectors
35
36
- Changed Docker image to manylinux_2_24_x86_64 to prepare for building wheels
@@ -38,77 +39,96 @@ A usage example can be found in `extract_mvs.py`.
38
39
39
40
The mv-extractor seems to be quite popular and I want to improve it. However, I do not have the time and resources to do this alone. Hence, I gladly welcome any community contributions.
40
41
41
-
One improvement that is on my mind, is the packaging and distribution of mv-extractor via PyPI. This requires creating a source distribution and building binary wheels for different target architectures and Python versions. Ideally, the build would be automated with a CI pipeline, e.g., GitHub Actions. It would be awesome, if someone is interested in helping me and getting this to work. In this case, please just open an issue and we can discuss the details.
42
-
43
42
44
43
## Quickstart
45
44
46
-
### Step 1: Install Prerequisites
47
-
48
-
Install [Docker](https://docs.docker.com/).
45
+
### Step 1: Install
49
46
50
-
### Step 2: Clone Source Code
51
-
52
-
Change into the desired installation directory on your machine and clone the source code
47
+
You can install the motion vector extractor via pip
Note, that we currently provide the package only for x86-64 linux, such as Ubuntu or Debian, and Python 3.8, 3.9, and 3.10. If you are on a different platform, please use the Docker image as described [below](#installation-via-docker).
56
53
57
-
### Step 3: Extract Motion Vectors
54
+
### Step 2: Extract Motion Vectors
58
55
59
-
Change into the `mv_extractor` directory and run the extraction script
56
+
Download the example video `vid.mp4` from the repo and place it somewhere. To extract the motion vectors, open a terminal at the same location and run
60
57
```
61
-
sudo ./run.sh python3.10 extract_mvs.py
58
+
extract_mvs vid.mp4 --preview --verbose
62
59
```
63
-
This pulls a prebuild Docker image and runs the mv-extractor within this image.
64
60
65
-
The extraction script provides several command line options, e.g., to store extracted motion vectors to disk, and to enable/disable graphical output. To see all command line options type
61
+
The extraction script provides command line optionsto store extracted motion vectors to disk, and to enable/disable graphical output. For all options type
66
62
```
67
-
sudo ./run.sh python3.10 extract_mvs.py -h
63
+
extract_mvs -h
68
64
```
69
-
For example, if you want to store extracted frames and motion vectors to disk, you can do so by running
65
+
For example, to store extracted frames and motion vectors to disk without showing graphical output run
70
66
```
71
-
sudo ./run.sh python3.10 extract_mvs.py --dump
67
+
extract_mvs vid.mp4 --dump
72
68
```
73
-
You can also open another video stream by specifying its file path or url, e.g.,
Now, to run the tests from the `mv_extractor` directory with
81
+
```
82
+
python3 tests/tests.py
87
83
```
88
84
Confirm that all tests pass.
89
85
90
-
### Importing mv-extractor into Your Own Scripts
86
+
If you are using the Docker image instead of the PyPI package as explained below, you can invoke the tests with
87
+
```
88
+
sudo ./run.sh python3.10 tests/tests.py
89
+
```
90
+
91
+
### Importing mvextractor into Your Own Scripts
91
92
92
93
If you want to use the motion vector extractor in your own Python script import it via
93
94
```
94
-
from mv_extractor import VideoCap
95
+
from mvextractor.videocap import VideoCap
95
96
```
96
97
You can then use it according to the example in `extract_mvs.py`.
97
98
98
99
Generally, a video file is opened by `VideoCap.open()` and frames, motion vectors, frame types and timestamps are read by calling `VideoCap.read()` repeatedly. Before exiting the program, the video file has to be closed by `VideoCap.release()`. For a more detailed explanation see the API documentation below.
99
100
100
-
### Building the Docker Image Locally
101
+
### Installation via Docker
102
+
103
+
Instead of installing the motion vector extractor via PyPI you can also use the prebuild Docker image from [DockerHub](https://hub.docker.com/r/lubo1994/mv-extractor). The Docker image contains the motion vector extractor and all its dependencies and comes in handy for quick testing or in case your platform is not compatible with the provided Python package.
104
+
105
+
#### Prerequisites
106
+
107
+
To use the Docker image you need to install [Docker](https://docs.docker.com/). Furthermore, you need to clone the source code with
0 commit comments