Skip to main content

A Python package for high-quality FFmpeg command generation and video utilities.

Project description

FFmpeg Tools

A Python package for simplified FFmpeg command generation, video downloading, and file management.

Installation

pip install ffmpeg-tools

Usage

1. Generating & Running FFmpeg Commands

from ffmpeg_tools import build_command, run_command

# 1. Build the command
cmd = build_command("compress_high_quality", input="video.mp4", output="compressed.mp4")

# 2. Run the command (returns True if successful)
success = run_command(cmd)

# Optional: Dry run to just print the command
run_command(cmd, dry_run=True)

2. Custom Commands (Dynamic JSON)

You can add your own FFmpeg command templates without modifying the package source.

from ffmpeg_tools.commands import add_command, build_command

# Add a new command template
add_command(
    name="my_custom_encode",
    command=["ffmpeg", "-y", "-i", "{input}", "-c:v", "libx264", "-preset", "fast", "{output}"],
    description="My custom fast encoding profile"
)

# Use the new command
cmd = build_command("my_custom_encode", input="video.mp4", output="video_fast.mp4")

The commands are stored in commands.json in the package directory.

3. Downloading Videos

from pathlib import Path
from ffmpeg_tools import download_video

# Download a video from YouTube
download_video(
    url="https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    output_folder=Path("downloads"),
    clear_folder=False
)

4. Cleaning Filenames

from pathlib import Path
from ffmpeg_tools import clean_filename

file_path = Path("downloads/My Video (2024).mp4")
new_path = clean_filename(file_path)
print(new_path)
# Output: downloads/My_Video_2024.mp4

License

MIT

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

ffmpeg_tools-0.1.6.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

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

ffmpeg_tools-0.1.6-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file ffmpeg_tools-0.1.6.tar.gz.

File metadata

  • Download URL: ffmpeg_tools-0.1.6.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for ffmpeg_tools-0.1.6.tar.gz
Algorithm Hash digest
SHA256 d27f5961d73dd1fda3dbca43958d90991287e520afcfd0eb6d5489877cadb244
MD5 f341708569bc7335156677c318965ee4
BLAKE2b-256 d2f32a22b4b45d8db4c6b0fd524f37168fa2f0bac9174c8b63a0f1d3b627bea7

See more details on using hashes here.

File details

Details for the file ffmpeg_tools-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: ffmpeg_tools-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for ffmpeg_tools-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 a8697e909850140fdf899ba22eebdc5f5d41836fcd7113180df6f8d4fe48cf27
MD5 951697a128e187b62ec5ca2aa24accae
BLAKE2b-256 4113e857833c5afdcf50961abe0c7185114e4f3cf13629173033721f7993bbff

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