Skip to content

Commit 15bd658

Browse files
committed
Minor feature added + Conda builds
- Support for disabling the progress bar - Added conda builds (for windows only)
1 parent 166dac1 commit 15bd658

File tree

10 files changed

+119
-9
lines changed

10 files changed

+119
-9
lines changed

README.md

+9-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Reading videos into NumPy arrays was never more simple. This library provides
44
an entire range of additional functionalities such as custom frame selection,
55
frame resizing, pixel normalization, grayscale conversion and much more.
66

7-
[Read the Documentation](https://mrinaljain17.github.io/mydia/html/index.html)
7+
[Read the Documentation](https://mrinaljain17.github.io/mydia)
88

99
## Getting started
1010

@@ -38,13 +38,19 @@ The tensor can be interpreted as:
3838

3939
## Installation
4040

41-
- **Install Mydia from PyPI (recommended):**
41+
- **Install from PyPI (Recommended):**
4242

4343
```bash
4444
pip install mydia
4545
```
4646

47-
- **Alternatively, install from Github source:**
47+
- **Install using conda package manager (Supported on Windows only)**
48+
49+
```bash
50+
conda install -c mrinaljain17 mydia
51+
```
52+
53+
- **Alternatively, install from source:**
4854

4955
First, clone the repository
5056

conda_build/README.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Conda Package Manager
2+
3+
Run the following commands from the directory `conda_build/` to build conda distribution
4+
of the package:
5+
6+
```bash
7+
conda-build mydia --numpy 1.14.5 -c mrinaljain17
8+
```
9+
10+
Here, `"mrinaljain17"` is the channel from which `ffmpeg-python` is installed.

conda_build/ffmpeg-python/bld.bat

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
"%PYTHON%" setup.py install --single-version-externally-managed --record=record.txt
2+
if errorlevel 1 exit 1

conda_build/ffmpeg-python/build.sh

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
$PYTHON setup.py install --single-version-externally-managed --record=record.txt

conda_build/ffmpeg-python/meta.yaml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{% set name = "ffmpeg-python" %}
2+
{% set version = "0.1.16" %}
3+
4+
package:
5+
name: "{{ name|lower }}"
6+
version: "{{ version }}"
7+
8+
source:
9+
url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz
10+
sha256: 721db04120ad110619c17dd7a72db8d21a6738d721be1b3b4c72a7516e6b07f4
11+
12+
build:
13+
number: 0
14+
script: "{{ PYTHON }} -m pip install . --no-deps --ignore-installed -vvv "
15+
16+
requirements:
17+
build:
18+
- future
19+
- pip
20+
- setuptools
21+
- python
22+
- pytest-runner
23+
run:
24+
- future
25+
- python
26+
27+
about:
28+
home: https://github.com/kkroening/ffmpeg-python
29+
license: Apache Software
30+
license_family: APACHE
31+
license_file:
32+
summary: Python bindings for FFmpeg - with complex filtering support
33+
doc_url:
34+
dev_url:

conda_build/mydia/bld.bat

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
"%PYTHON%" setup.py install --single-version-externally-managed --record=record.txt
2+
if errorlevel 1 exit 1

conda_build/mydia/build.sh

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
$PYTHON setup.py install --single-version-externally-managed --record=record.txt

conda_build/mydia/meta.yaml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{% set name = "mydia" %}
2+
{% set version = "2.1.1" %}
3+
4+
package:
5+
name: "{{ name|lower }}"
6+
version: "{{ version }}"
7+
8+
source:
9+
url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz
10+
sha256: ef07ff6b0c17ddac6749ae6ce9e295a4799dfb14a951bc25ee56778b24684f9a
11+
12+
build:
13+
number: 0
14+
script: "{{ PYTHON }} -m pip install . --no-deps --ignore-installed -vvv "
15+
16+
requirements:
17+
build:
18+
- pip
19+
- setuptools
20+
- python
21+
- ffmpeg-python
22+
- numpy
23+
- matplotlib
24+
- tqdm
25+
run:
26+
- ffmpeg-python
27+
- numpy
28+
- tqdm
29+
- matplotlib
30+
- python
31+
32+
about:
33+
home: https://github.com/MrinalJain17/mydia
34+
license: MIT License
35+
license_family: MIT
36+
license_file:
37+
summary: A simple and efficient wrapper for reading videos as NumPy tensors
38+
doc_url: https://mrinaljain17.github.io/mydia/
39+
dev_url:

docs/source/install.rst

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
Installation
22
------------
33

4-
- **Install Mydia from PyPI (recommended):**
4+
- **Install from PyPI (Recommended):**
55

66
.. code:: bash
77
88
pip install mydia
99
10-
- **Alternatively, install from Github source:**
10+
- **Install using conda package manager (Supported on Windows only)**
11+
12+
.. code:: bash
13+
14+
conda install -c mrinaljain17 mydia
15+
16+
- **Alternatively, install from source:**
1117

1218
First, clone the repository.
1319

mydia/mydia.py

+13-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
88
"""
99

10-
__version__ = "2.1.0"
10+
__version__ = "2.1.1"
1111
__author__ = "Mrinal Jain"
1212

1313
import warnings
@@ -263,11 +263,14 @@ def _probe(self, path):
263263

264264
return (fps, total_frames)
265265

266-
def read(self, paths):
266+
def read(self, paths, verbose=1):
267267
"""Function to read videos
268268
269269
:param paths: A list of paths/path of the video(s) to be read.
270270
:type paths: str or list[str]
271+
272+
:param verbose: If set to 0, the progress bar will be disabled.
273+
:type verbose: int
271274
272275
:return:
273276
A 5-dimensional tensor, whose shape will depend on the value of ``data_format``.
@@ -298,8 +301,14 @@ def read(self, paths):
298301
paths = [paths]
299302
else:
300303
raise ValueError("Invalid value of 'paths'")
301-
302-
list_of_videos = [self._read_video(path) for path in tqdm(paths, unit="videos")]
304+
disable = False
305+
if verbose == 0:
306+
disable = True
307+
308+
list_of_videos = [
309+
self._read_video(path)
310+
for path in tqdm(paths, unit="videos", disable=disable)
311+
]
303312
video_tensor = np.vstack(list_of_videos)
304313

305314
if self.data_format == "channels_first":

0 commit comments

Comments
 (0)