Turn a video into a colorbar
Project description
movie_colorbar
A simple script to turn a video into a colorbar.
Install
Prerequisites
This code is compatible with all currently supported Python versions, and requires that you have ffmpgeg installed in your path. You can install it in your virtual enrivonment with:
python -m pip install movie_colorbar
Usage
With this package is installed in the activated enrivonment, it can be called through python -m movie_colorbar
or through a newly created colorbar
command.
Detailed usage goes as follows:
Usage: python -m movie_colorbar [OPTIONS] [SOURCE_PATH]
Turn a video into a colorbar.
╭─ Arguments ────────────────────────────────────────────────────────────────────────────────╮
│ source_path [SOURCE_PATH] Location, relative or absolute, of the source video file │
│ to get the images from. │
│ [default: .] │
╰────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ──────────────────────────────────────────────────────────────────────────────────╮
│ --title TEXT Name that will be given to the output directory. │
│ [default: output] │
│ --method TEXT Method used to calculate the average color. Options │
│ are: 'rgb', 'hsv', 'hue', 'kmeans', 'common', 'lab', │
│ 'xyz', 'rgbsquared', 'resize' and 'quantized'. │
│ [default: rgbsquared] │
│ --fps INTEGER Number of frames to extract per second of video │
│ footage. │
│ [default: 10] │
│ --log-level TEXT The base console logging level. Can be 'debug', │
│ 'info', 'warning' and 'error'. │
│ [default: info] │
│ --install-completion Install completion for the current shell. │
│ --show-completion Show completion for the current shell, to copy it or │
│ customize the installation. │
│ --help Show this message and exit. │
╰────────────────────────────────────────────────────────────────────────────────────────────╯
An example command is then:
python -m movie_colorbar ~/Desktop/STARWARS_9_TRAILER.webm --title sw9_trailer --method rgbsquared --fps 25
The script will call ffmpeg
to extract 25 (in this case) images per second from the video file.
It will then apply the chosen method - here rgbsquared
- to determine the average color of each frame.
Finally, it creates the colorbar with all averages and saves it in a new folder titled bars/title
, with title
being the argument you provided.
The final output's name is a concatenation of the provided file, and of the method used.
Giving a directory as input will process all video files found in this directory.
It is recommended to decrease the fps when processing long videos such as entire movies.
TODO
- Delete the
images
folder after completion. - Turn into a package.
- Improving the command line experience.
- Offer an option to do all at the same time.
Output example
Here is an example of what the script outputs, when ran on the last Star Wars 9 trailer.
All methods output can be found in the bars
folder of this repository.
Kmeans:
Rgb:
Rgbsquared:
Lab:
MIT © 2019 Felix Soubelet
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file movie_colorbar-0.2.2.tar.gz
.
File metadata
- Download URL: movie_colorbar-0.2.2.tar.gz
- Upload date:
- Size: 93.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d43201fe2573fef61107f4b76b959586a27592c621063ff35073a01f71ece8a6 |
|
MD5 | 56cb96ebfbcf5416b9aaecfba48f887f |
|
BLAKE2b-256 | e4a647d7dda5268512e3a2a127a7bf1ead72bd29008ea868e1e4b7522d6e804f |
File details
Details for the file movie_colorbar-0.2.2-py3-none-any.whl
.
File metadata
- Download URL: movie_colorbar-0.2.2-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 782b8f4372f4c53e755a0cb91d3af3609baf326753f8c4082ede6299cc291d7b |
|
MD5 | c7e3d2eaf679fef1a5b5173ad7b5f823 |
|
BLAKE2b-256 | 9933e54e6812cc82dddecde5460c54626352953f31113892dd7e6ab3507309aa |