PureWebM
Originally written for PureMPV, with this utility it is possible to encode webms from a given input, according to a restricted file size or a default CRF (Constant Rate Factor). If the utility is called whilst encoding, additional webm parameters will be put in a queue using Unix sockets.
Usage
To encode a quick webm with the defaults:
$ purewebm -ss 00:00:02.268 -to 00:00:10.310 -i "/tmp/Videos/nijinosaki.mkv"
Encoding 1 of 1: 100%
Only the video stream will be mapped (no audio) with a size limit of 3MB, and saved under $HOME/Videos/PureWebM.
To encode a webm with size limit of 6MB, burned subtitles, and opus audio:
$ purewebm -i "/tmp/Videos/nijinosaki.mkv" --size_limit 6 -subs --extra_params '-map 0:a -c:a libopus -b:a 128k'
Encoding 1 of 1: 100%
It is possible to request usage instructions through the --help or -h option flags:
$ purewebm --help
usage: purewebm [-h] [--version] (--status | --kill | --input INPUT) [--name_type {unix,md5}]
[--subtitles] [--encoder ENCODER] [--start_time START_TIME] [--stop_time STOP_TIME]
[--lavfi LAVFI] [--size_limit SIZE_LIMIT] [--crf CRF] [--cpu-used {0,1,2,3,4,5}]
[--deadline {good,best}] [--extra_params EXTRA_PARAMS]
[output]
Utility to encode quick webms with ffmpeg
positional arguments:
output the output file, if not set, the filename will be generated according to
--name_type and saved in $HOME/Videos/PureWebM
options:
-h, --help show this help message and exit
--version, -v show program's version number and exit
--status queries the main process and prints the current status
--kill sends the kill command to the main process; this will terminate all
encodings immediately, with no cleanups
--input INPUT, -i INPUT
the input file to encode (NOTE: several files can be selected adding more
-i flags just like with ffmpeg, these will be only for a single output
file; to encode different files run this program multiple times, the files
will be queued in the main process using Unix sockets)
--name_type {unix,md5}, -nt {unix,md5}
the filename type to be generated if the output file is not set: unix uses
the current time in microseconds since Epoch, md5 uses the filename of the
input file with a short MD5 hash attached (default is unix)
--subtitles, -subs burn the subtitles onto the output file; this flag will automatically use
the subtitles found in the first input file, to use a different file use
the -lavfi flag with the subtitles filter directly
--encoder ENCODER, -c:v ENCODER
the encoder to use (default is libvpx-vp9)
--start_time START_TIME, -ss START_TIME
the start time offset (same as ffmpeg's -ss)
--stop_time STOP_TIME, -to STOP_TIME
the stop time (same as ffmpeg's -to)
--lavfi LAVFI, -lavfi LAVFI
the set of filters to pass to ffmpeg
--size_limit SIZE_LIMIT, -sl SIZE_LIMIT
the size limit of the output file in megabytes, use 0 for no limit (default
is 3)
--crf CRF, -crf CRF the crf to use (default is 24)
--cpu-used {0,1,2,3,4,5}, -cpu-used {0,1,2,3,4,5}
the cpu-used for libvpx-vp9; a number between 0 and 5 inclusive, the higher
the number the faster the encoding will be with a quality trade-off
(default is 0)
--deadline {good,best}, -deadline {good,best}
the deadline for libvpx-vp9; good is the recommended one, best has the best
compression efficiency but takes the most time (default is good)
--extra_params EXTRA_PARAMS, -ep EXTRA_PARAMS
the extra parameters to pass to ffmpeg, these will be appended making it
possible to override some defaults
Logs are saved under $HOME/.config/PureWebM/PureWebM.log
Configuration file
Some of the default options can be changed using a configuration file named PureWebM.conf in the configuration folder. Changeable options are size_limit, crf, and deadline. The following is an example of a configuration file:
# ~/.config/PureWebM/PureWebM.conf
size_limit=4
crf=28
deadline=good
Installation
It can be installed using pip:
$ pip install purewebm
or
$ git clone https://github.com/4ndrs/PureWebM.git
$ cd PureWebM
$ pip install .
Alternatively, pipx can be used if PEP 668 is enforced:
$ pipx install purewebm
Metadata
Release files for purewebm 1.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| purewebm-1.2.1.tar.gz | 14.2 kB | Without provenance | Details for purewebm-1.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| purewebm-1.2.1-py3-none-any.whl | Python 3 | none | any | Details for purewebm-1.2.1-py3-none-any.whl |
Total release size: 31.7 kB
Release files / purewebm-1.2.1.tar.gz
| Download URL | purewebm-1.2.1.tar.gz |
|---|---|
| Size | 14.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5c83304b72e96a753de35e33ab11336cae4f9894686f3b4b6b42de0634a6baa3
|
|
BLAKE2b-256 checksum How to use checksums |
e0710a6eeb99d602c3b88a2b3fce14cd5befee8be0f24ed133ce5ddd85c48364
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Release files / purewebm-1.2.1-py3-none-any.whl
| Download URL | purewebm-1.2.1-py3-none-any.whl |
|---|---|
| Size | 17.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
84b0520116778f84d38e3c468792424653651d86508e6f27e1b6c93287f859d9
|
|
BLAKE2b-256 checksum How to use checksums |
3c0748218f841f8d26a2370457ffe57be35eacb6f643c82ff90134ffd2ec886d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Security for purewebm 1.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.