BVSR
Batch Video Size Reduction (BVSR) using ffmpeg.
A python script to reduce the size of all videos in a folder while keeping its exact structure.
Requirements
- Python 3
- ffmpeg
Installation
pip install bvsr
Usage
usage: bvsr.py [-h] [--version] [--destination-folder DESTINATION_FOLDER]
[--crf CRF | --video-quality VIDEO_QUALITY | --target-size TARGET_SIZE] [--audio-quality AUDIO_QUALITY]
[--ffmpeg-exec FFMPEG_EXEC] [--encoder ENCODER] [-i]
source_folder
positional arguments:
source_folder The Source folder of the videos
options:
-h, --help show this help message and exit
--version show program's version number and exit
--destination-folder DESTINATION_FOLDER
The directory where the output videos will be stored, default to the same folder name with `bvsr` suffix in the
parent directory
--crf CRF Target Constant Rate Factor (CRF) value (RECOMMENDED)[More info at: https://trac.ffmpeg.org/wiki/Encode/H.264]
--video-quality VIDEO_QUALITY
Target video quality. Available qualities: ['videophone', 'videoconferencing', '240p', '360p', '480p', 'VCD', '720p',
'720p60', '1080p', '1080p60']
--target-size TARGET_SIZE
Target upper bound video size (in MB)
--audio-quality AUDIO_QUALITY
Target audio quality. Default to the audio quality of the source video. Available qualities: ['low', 'mid-range',
'medium', 'high', 'highest']
--ffmpeg-exec FFMPEG_EXEC
The ffmpeg executable file, default to `ffmpeg`
--encoder ENCODER The video encoder name
-i, --ignore-other-files
Ignore the other non-video files, the default operation is to copy the other files to the target folder to keep the
same source folder structure
Examples
- The recommended way to reduce the size of a video file is to use the Constant Rate Factor (CRF):
The range of the CRF scale is 0–51, where 0 is lossless, 23 is the default, and 51 is worst quality possible. A lower value generally leads to higher quality, and a subjectively sane range is 17–28. Consider 17 or 18 to be visually lossless or nearly so; it should look the same or nearly the same as the input but it isn't technically lossless. The range is exponential, so increasing the CRF value +6 results in roughly half the bitrate / file size, while -6 leads to roughly twice the bitrate.
Choose the highest CRF value that still provides an acceptable quality. If the output looks good, then try a higher value. If it looks bad, choose a lower value.
Run the following command to use a CRF value of 34 for example:
bvsr --crf 34 /path/to/the/source_folder
This will output the results in a folder in the parent directory with the same name of your source_folder suffixed with _bvsr.
The output folder will have the same structure as the source_folder (i.e. processing the video files and just copying any other file. Use --ignore-other-files to ignore them instead).
- If you want to specify a video quality rather than using the CRF:
bvsr --video-quality 480p /path/to/the/source_folder
Available qualities: ['videophone', 'videoconferencing', '240p', '360p', '480p', 'VCD', '720p', '720p60', '1080p', '1080p60']
- If you just care about the size and not the quality, you can specify a target size in
MBdirectly:
bvsr --target-size 100 --destination-folder /path/to/destination_folder
Although it is not guaranteed.
License
Metadata
Release files for bvsr 1.0.10
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 |
|---|---|---|---|---|
| bvsr-1.0.10.tar.gz | 20.9 kB | Without provenance | Details for bvsr-1.0.10.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bvsr-1.0.10-py3-none-any.whl | Python 3 | none | any | Details for bvsr-1.0.10-py3-none-any.whl |
Total release size: 42.4 kB
Release files / bvsr-1.0.10.tar.gz
| Download URL | bvsr-1.0.10.tar.gz |
|---|---|
| Size | 20.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aa64baf50200893e152cd96917a0e7e62eb76828706b97d1dcf0640eef81147e
|
|
BLAKE2b-256 checksum How to use checksums |
68c8362c9fba5c634a500db0e3ddc19746526e0661936f71e27a05a89a063b73
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.2 CPython/3.10.6 Linux/5.15.0-53-generic
|
Release files / bvsr-1.0.10-py3-none-any.whl
| Download URL | bvsr-1.0.10-py3-none-any.whl |
|---|---|
| Size | 21.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ab326bf71b0dc6f9916628ec687814a9ad77719e75d246f0cf083d1d3827cb61
|
|
BLAKE2b-256 checksum How to use checksums |
6e22a533f143937c6dbc7867702b1921e7c8b33994f369b189b1d135e4291b54
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.2 CPython/3.10.6 Linux/5.15.0-53-generic
|
Security for bvsr 1.0.10
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.