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 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.4.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.4-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: video_compressing-0.1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 fd70e235c102d28cd99d4c1015705101235262feb4bdafc58639fadf6140cc5e
MD5 9ea074947954abc2c3ffe8344844b2eb
BLAKE2b-256 288c6a652cd7a35d32ee405dee157a5ed16850669a29c25cb06f53b7a557850f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: video_compressing-0.1.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 8cae1971ccd3ca8abbc97fc696abdfac1a3508a3e7d44c3819c2bf60236cae38
MD5 4fbeac11dc5eb9ea75f05329956c2f2f
BLAKE2b-256 4e22c64c03e3a5cc7b2f437a968469cd62f5cfddb5a6d8ce8a037cfdbae19ea7

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