# python-ffmpeg-installer **Repository Path**: gdty/python-ffmpeg-installer ## Basic Information - **Project Name**: python-ffmpeg-installer - **Description**: python ffmpeg 下载最新版静态包 - **Primary Language**: Python - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-07-03 - **Last Updated**: 2025-07-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # python-ffmpeg-installer The easiest way to get ffmpeg v6 installed through python. ## Install ```bash > pip install --extra-index-url https://pypi.cnb.cool/gdteyu/python/-/packages/simple python_ffmpeg_installer ``` ## Usage ```py import python_ffmpeg_installer # python_ffmpeg_installer installed on first call to add_paths(), threadsafe. python_ffmpeg_installer.add_paths() # blocks until files are downloaded # or python_ffmpeg_installer.add_paths(weak=True) to only add if ffmpeg/ffprobe not already on path # Now ffmpeg and ffprobe will use python_ffmpeg_installer versions. os.system("python_ffmpeg_installer -i myfile.mp4 ...") ``` Or if you want more lazy behavior to install on first use, or you don't want to modify system paths, use `python_ffmpeg_installer ` ```py import python_ffmpeg_installer # python_ffmpeg_installer installed on first call, threadsafe. os.system("python_ffmpeg_installer -i myfile.mp4 ...") ``` You can also use it on the command line ```bash > pip install python_ffmpeg_installer > python_ffmpeg_installer -i file.mp4 ... > python_ffprobe_installer ... > python_ffmpeg_paths FFMPEG=\**\ffmpeg.exe FFPROBE=\**\ffprobe.exe ``` ## About This tool installs binaries for ffmpeg and ffprobe binary (with all plugins and codecs) into the running platform. The platform binaries are installed on first use and is done without requiring elevated permissions. This package is designed to allow tools that rely on `ffmpeg` to have a fully featured `ffmpeg` available by just including this package. No seperate install of ffmpeg is needed. ### Without this library... Your ffmpeg tool would have to rely on the user to install `ffmpeg`, with the right build settings to ensure your tool functions correctly. This is a major pain for ffmpeg based tools (missing codecs for example) and this library solves this problem. As of now, binaries are available for: * `win32` (Windows) * `darwin` (MacOS) * `linux` (From Ubuntu 20LTS) * Pull requests to support for other platforms are welcome! Too add support please see related git repo: others. There is both an python api and a command line api. After installing this package the command line aliases will be available: * `python_ffmpeg` operates just like `ffmpeg` * `python_ffprobe` operates just like `ffprobe`. * `python_ffmpeg_paths` prints out the paths of the ffmpeg binaries. ```bash > python_ffmpeg_paths FFMPEG=\*\ffmpeg.exe FFPROBE=\*\ffprobe.exe ``` ## Api Here's how to get the binaries and execute them. ```py # Using the alias method import os # Platform binaries will be installed the first run. os.system("python_ffmpeg_installer -version") # python_ffmpeg_installer is an alias for this tools python_ffmpeg_installer. os.system("python_ffprobe_installer -version") ``` ```py # Using the program location method import subprocess from python_ffmpeg_installer import run # Platform binaries are installed on the first run of below. ffmpeg, ffprobe = run.get_or_fetch_platform_executables_else_raise() # ffmpeg, ffprobe will be paths to ffmpeg and ffprobe. subprocess.check_output([ffmpeg, "-version"]) subprocess.check_output([ffprobe, "-version"]) ``` ## Upload python setup.py upload ## Testing * Clone this project `git clone https://gitee.com/gdty/python_ffmpeg_installer` * `cd python_ffmpeg_installer` * Then run tests ## Virtual Environment (optional) To test it in a virtual environment, use this easy helper: To easily setup a virtual environment, please run ```bash python setupvirtualenv.py ``` Then run `./activate.sh` to activate the shell. or idea project setting SDKs add python sdk venv,and modules add sdk,but must add python tools ## Binary source * others ## Version ffmpeg and ffprobe are both version: 6.0 ## Release History * 1.0.0 init