Skip to main content

Batch Video Size Reduction (BVSR) using ffmpeg.

Project description

BVSR

License: GPL v3

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

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 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 MB directly:
bvsr --target-size 100 --destination-folder /path/to/destination_folder

Although it is not guaranteed.

License

GPLv3 © Batch Video Size Reduction (BVSR)

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

bvsr-1.0.10.tar.gz (20.9 kB view details)

Uploaded Source

Built Distribution

bvsr-1.0.10-py3-none-any.whl (21.5 kB view details)

Uploaded Python 3

File details

Details for the file bvsr-1.0.10.tar.gz.

File metadata

  • Download URL: bvsr-1.0.10.tar.gz
  • Upload date:
  • Size: 20.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.10.6 Linux/5.15.0-53-generic

File hashes

Hashes for bvsr-1.0.10.tar.gz
Algorithm Hash digest
SHA256 aa64baf50200893e152cd96917a0e7e62eb76828706b97d1dcf0640eef81147e
MD5 30f3937be1a572ffd7b6d1168b60f6cb
BLAKE2b-256 68c8362c9fba5c634a500db0e3ddc19746526e0661936f71e27a05a89a063b73

See more details on using hashes here.

File details

Details for the file bvsr-1.0.10-py3-none-any.whl.

File metadata

  • Download URL: bvsr-1.0.10-py3-none-any.whl
  • Upload date:
  • Size: 21.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.10.6 Linux/5.15.0-53-generic

File hashes

Hashes for bvsr-1.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 ab326bf71b0dc6f9916628ec687814a9ad77719e75d246f0cf083d1d3827cb61
MD5 c7e846913cb1f4386407a0abc37f3eb2
BLAKE2b-256 6e22a533f143937c6dbc7867702b1921e7c8b33994f369b189b1d135e4291b54

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page