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.

from ffmpeg_tools import list_commands

# Print all available commands
list_commands()

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.7.tar.gz (7.2 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.7-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ffmpeg_tools-0.1.7.tar.gz
  • Upload date:
  • Size: 7.2 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.7.tar.gz
Algorithm Hash digest
SHA256 8e6010cd7f46c472a6cc6e819856a5989bf572af578ffb23b2182a208f79c94c
MD5 04b5681d481e9515d3769671d5cf2b36
BLAKE2b-256 2cabb29deef800edc8cedfebb019d00a26ea47882ba4355aaa7cc6e22131787b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ffmpeg_tools-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 8.3 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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 fbc1cea33464b3388c59d04927b41cbe661abca146850a064ca0596c4a7a1942
MD5 0cfd0411cd860a6f5c579500d0e8cfa5
BLAKE2b-256 0ca5787d443b6a3034a7a64919e3971b94081167e60de8a141156831792d546d

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