Skip to main content

Package to compress multiple large .MOV or .MP4 videos into a single light .mp4 video.

Project description

Video Compressing

PyPI version

A Python library for reducing the size of and merging multiple video files. This package is designed for simplicity and efficiency, leveraging FFmpeg for video compression and manipulation.

Features

  • Reduce Video Size: Scale down video dimensions and bitrate using a customizable reduction factor.
  • Merge Multiple Videos: Combine multiple video files into a single output.
  • Command-Line Interface: Use the package directly from the terminal for quick processing.

Installation

Clone the Repository

git clone https://github.com/Gabriel-melki/video-compressing.git
cd video-compressing

Install Dependencies

This project uses Poetry for dependency management. Install Poetry if you don’t have it:

pip install poetry

Install the dependencies and activate the vitual environment:

poetry install
poetry shell

Ensure FFmpeg is installed on your system:

Ubuntu/Debian:

sudo apt update && sudo apt install ffmpeg

MacOS (with Homebrew):

brew install ffmpeg

Windows:

Download FFmpeg and add it to your PATH.

Usage

Command-Line Tool You can run the VideoCompressing tool directly from the terminal.

python -m src.video-compressing.reduce_video input1.mp4 input2.mp4 -r 0.5 -o output.mp4

Parameters:

  • input_files: List of input video files (required)
  • -r, --reduction-factor: A float value to scale down videos (required). Example: 0.5 reduces the size by 50%.
  • o, --output-file: Name of the output file (optional). Default: Automatically generated if not provided.

Example:

Reduce and merge video1.mp4 and video2.mp4 by 50% into output.mp4:

python -m src.video-compressing.reduce_video video1.mp4 video2.mp4 -r 0.5 -o output.mp4

Without an output file:

python -m src.video-compressing.reduce_video video1.mp4 video2.mp4 -r 0.5

Using as a Library Import and call the reduce_and_merge_videos function directly in your Python code:

from src.video-compressing.tools import reduce_and_merge_videos

reduce_and_merge_videos(
    input_files=["video1.mp4", "video2.mp4"],
    reduction_factor=0.5,
    output_file="output.mp4"
)

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

video_compressing-0.1.2.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

video_compressing-0.1.2-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file video_compressing-0.1.2.tar.gz.

File metadata

  • Download URL: video_compressing-0.1.2.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.9.7 Darwin/23.1.0

File hashes

Hashes for video_compressing-0.1.2.tar.gz
Algorithm Hash digest
SHA256 fa206067f709d54b7a8227820752269b06aa9655d31b1270541abe9801397025
MD5 dbd703efbe77480222ff201ee9495c20
BLAKE2b-256 574cb19ba8f2b59247f200e8f84ba9275daaedd7d29284a72fc5cddb6b84f637

See more details on using hashes here.

File details

Details for the file video_compressing-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: video_compressing-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.9.7 Darwin/23.1.0

File hashes

Hashes for video_compressing-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 18092c1251dbf9a174b45ab28cc9c719e4faddc63997987a241ed63c95e187e5
MD5 176d3b184b3f4a23574f8ed6b58b7b3b
BLAKE2b-256 4646077297d534beb48aa2e67fa0c472171ebece08fdb8132dc8ef796114ab2a

See more details on using hashes here.

Supported by

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