|
1 | 1 | # Thumbnails <img src="https://github.com/pysnippet.png" align="right" height="64" />
|
2 | 2 |
|
3 | 3 | [](https://pypi.org/project/thumbnails/)
|
4 |
| -[](https://github.com/pysnippet/thumbnails/actions/workflows/tests.yml) |
| 4 | +[](https://github.com/pysnippet/thumbnails/actions/workflows/tests.yml) |
| 5 | +[](https://app.circleci.com/pipelines/github/pysnippet/thumbnails) |
5 | 6 | [](https://www.codacy.com?utm_source=github.com&utm_medium=referral&utm_content=pysnippet/thumbnails&utm_campaign=Badge_Grade)
|
6 | 7 | [](https://github.com/pysnippet/thumbnails/blob/master/LICENSE)
|
7 | 8 |
|
| 9 | +This tool stands out for its unparalleled optimization for lightning-fast thumbnail generation. By utilizing minimal |
| 10 | +resources, you can generate more in less time. And with a user-friendly CLI and a convenient Python API, this tool is |
| 11 | +the ultimate solution for efficient and streamlined thumbnail creation. |
| 12 | + |
| 13 | +## Compatible with Major Video Players |
| 14 | + |
8 | 15 | Modern web video players use the **WebVTT** formatted files to preview thumbnails at a pointed time.
|
9 | 16 | [WebVTT](https://www.w3.org/TR/webvtt1/) is a format for displaying timed text tracks (such as subtitles or captions).
|
10 | 17 | Open-source video players such as [Plyr](https://github.com/sampotts/plyr), [Video.js](https://github.com/videojs/video.js),
|
11 | 18 | [Flowplayer](https://github.com/flowplayer/flowplayer), [Fluid Player](https://github.com/fluid-player/fluid-player),
|
12 |
| -etc. use this format for showing the thumbnails. Using [external plugins](https://github.com/brightcove/videojs-thumbnails), |
13 |
| -Video.js also can handle **JSON** formatted thumbnails' metadata, and this tool can also generate the corresponding JSON. |
| 19 | +and more, use this format for showing the thumbnails. And, with the use of [external plugins](https://github.com/brightcove/videojs-thumbnails), |
| 20 | +Video.js even has the capability to handle **JSON** formatted thumbnail metadata. This is where our tool comes in, |
| 21 | +offering the ability to generate the perfect thumbnails to match your needs. |
14 | 22 |
|
15 |
| -## Goals |
| 23 | +## Features |
16 | 24 |
|
17 |
| -[//]: # (TODO: replace this whole section with a "Why use this tool?" section by describing the below clauses.) |
| 25 | +- Wide-ranging video format compatibility, accommodating all major video formats as input files. (mp4, mkv, avi, mov, ogv, webm, mpeg, mpg, wmv, etc.) |
| 26 | +- Flexible output options, supporting both WebVTT and JSON formats. |
| 27 | +- Generating video thumbnails through the CLI and the Python API. |
| 28 | +- Customize your thumbnail creation to fit your specific needs with various options. |
| 29 | +- Image compression technology, ensuring optimized file sizes for quick and efficient loading times. |
18 | 30 |
|
19 |
| -- [x] Support multiple video formats as an input file |
20 |
| -- [x] Support WebVTT/json output formats |
21 |
| -- [x] Set an interval, etc (options). |
22 |
| -- [ ] [Image compression opportunity.](https://github.com/pysnippet/thumbnails/issues/29) |
23 |
| -- [ ] [Provide a well documented python API.](https://github.com/pysnippet/thumbnails/issues/11) |
24 |
| -- [ ] [Use like a linux command or as a python library.](https://github.com/pysnippet/thumbnails/issues/18) |
25 |
| -- [x] Deliver a high performance result. |
| 31 | +## How to Use? |
26 | 32 |
|
27 |
| -## Usage |
| 33 | +### CLI Tool Usage |
| 34 | + |
| 35 | +The CLI is a convenient way to generate thumbnails for a video file. And it accepts files or directories as arguments. |
| 36 | +For the complete list of options, run `thumbnails --help`. |
28 | 37 |
|
29 | 38 | ```bash
|
30 |
| -thumbnails --help |
| 39 | +thumbnails --base /media/ --output /var/www/movie.com/media/thumbnails/ --interval 5 ~Videos/movies |
31 | 40 | ```
|
32 | 41 |
|
33 |
| -[//]: # (TODO: usage for CLI and python API) |
| 42 | +### Python API Usage |
34 | 43 |
|
35 |
| -## Development |
| 44 | +The Python API provides a flexible way to integrate video thumbnail generation into your existing applications. |
| 45 | +Both the CLI and the Python API share the same set of options. |
36 | 46 |
|
37 |
| -### Install the dependencies |
38 |
| -```bash |
39 |
| -python3 -m pip install -r requirements.txt |
40 |
| -``` |
| 47 | +```python |
| 48 | +from thumbnails import Generator |
41 | 49 |
|
42 |
| -### Install the development dependencies |
43 |
| -```bash |
44 |
| -python3 -m pip install -r tests/requirements.txt |
45 |
| -``` |
| 50 | +inputs = ( |
| 51 | + "~Downloads/movie.mp4", |
| 52 | + "~Videos/movies/1.avi", |
| 53 | + "~Videos/movies/2.ogv", |
| 54 | +) |
46 | 55 |
|
47 |
| -### Install the package in editable mode |
48 |
| -```bash |
49 |
| -python3 -m pip install -e . |
| 56 | +generator = Generator(inputs) |
| 57 | +generator.base = "/media/" |
| 58 | +generator.skip = True # skip existing thumbnails |
| 59 | +generator.output = "/var/www/movie.com/media/thumbnails/" |
| 60 | +generator.interval = 5 |
| 61 | +generator.generate() |
50 | 62 | ```
|
51 |
| -If you are using a non-default version of Python (for example, you work with a virtual environment), you may get an error with `distutils`. See how to [fix](https://askubuntu.com/questions/1261162) the issue. |
52 | 63 |
|
53 |
| -### Run the tests |
54 |
| -Run this in the local environment to ensure everything is working before opening a PR |
| 64 | +## Development |
| 65 | + |
| 66 | +Run the following command in the package's root directory to install it in editable mode. |
55 | 67 | ```bash
|
56 |
| -tox |
| 68 | +python3 -m pip install -e . |
57 | 69 | ```
|
| 70 | +This command will install the package in your local environment and allow you to make changes to the code and see the |
| 71 | +updates immediately. It will also install all the required dependencies listed in the [requirements.txt](requirements.txt) file. |
58 | 72 |
|
59 | 73 | ## Contribute
|
60 | 74 |
|
61 |
| -Everyone is welcome to contribute to this project. Please read the [contribution guidelines](https://github.com/pysnippet/instructions#readme) |
62 |
| -before you start. Contributions can be considered |
63 |
| - - Reporting an issue |
64 |
| - - Opening a pull-request |
65 |
| - - Suggesting an idea at discussions |
66 |
| - - Starring the repository if it was helpful |
| 75 | +Everyone is welcome to contribute to this project. Please read and follow the [contribution guidelines](https://github.com/pysnippet/instructions#readme) |
| 76 | +before you start. Contributions can be considered: |
| 77 | +- Reporting an issue |
| 78 | +- Opening a pull-request |
| 79 | +- Suggesting an idea at [discussions](https://github.com/pysnippet/thumbnails/discussions) |
| 80 | +- Starring the repository if you like it |
| 81 | + |
| 82 | +Before you open a PR, please run the unit tests in the local environment to ensure everything is working. You need to |
| 83 | +install [tox](https://github.com/tox-dev/tox) and run the tests for configured environments. |
| 84 | +```bash |
| 85 | +python3 -m pip install tox && tox |
| 86 | +``` |
67 | 87 |
|
68 | 88 | ## License
|
69 | 89 |
|
|
0 commit comments