static-ffmpeg


Namestatic-ffmpeg JSON
Version 2.7 PyPI version JSON
download
home_pagehttps://github.com/zackees/static_ffmpeg
SummaryCross platform ffmpeg to work on various systems.
upload_time2024-04-24 00:29:50
maintainerNone
docs_urlNone
authorZach Vorhies
requires_python>=3.6.0
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
[![Actions Status](https://github.com/zackees/static_ffmpeg/workflows/MacOS_Tests/badge.svg)](https://github.com/zackees/static_ffmpeg/actions/workflows/push_macos.yml)
[![Actions Status](https://github.com/zackees/static_ffmpeg/workflows/Win_Tests/badge.svg)](https://github.com/zackees/static_ffmpeg/actions/workflows/push_win.yml)
[![Actions Status](https://github.com/zackees/static_ffmpeg/workflows/Ubuntu_Tests/badge.svg)](https://github.com/zackees/static_ffmpeg/actions/workflows/push_ubuntu.yml)

# static-ffmpeg

The easiest way to get ffmpeg v5 installed through python.

## Install

```bash
> pip install static-ffmpeg
```

## Usage

```py
import static_ffmpeg
# ffmpeg installed on first call to add_paths(), threadsafe.
static_ffmpeg.add_paths()  # blocks until files are downloaded
# or static_ffmpeg.add_paths(weak=True) to only add if ffmpeg/ffprobe not already on path
# Now ffmpeg and ffprobe will use static_ffmpeg versions.
os.system("ffmpeg -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 `static_ffmpeg`


```py
import static_ffmpeg
# ffmpeg installed on first call, threadsafe.
os.system("static_ffmpeg -i myfile.mp4 ...")
```

You can also use it on the command line

```bash
> pip install static-ffmpeg
> static_ffmpeg -i file.mp4 ...
> static_ffprobe ...
> static_ffmpeg_paths
FFMPEG=c:\users\niteris\dev\static_ffmpeg\static_ffmpeg\bin\win32\ffmpeg.exe
FFPROBE=c:\users\niteris\dev\static_ffmpeg\static_ffmpeg\bin\win32\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: [ffmpeg_bins](https://github.com/zackees/ffmpeg_bins).

There is both an python api and a command line api. After installing this package the command line aliases will be available:

  * `static_ffmpeg` operates just like `ffmpeg`
  * `static_ffprobe` operates just like `ffprobe`.
  * `static_ffmpeg_paths` prints out the paths of the ffmpeg binaries.

```bash
> static_ffmpeg_paths
FFMPEG=c:\users\niteris\dev\static_ffmpeg\static_ffmpeg\bin\win32\ffmpeg.exe
FFPROBE=c:\users\niteris\dev\static_ffmpeg\static_ffmpeg\bin\win32\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("static_ffmpeg -version")  # static_ffmpeg is an alias for this tools ffmpeg.
os.system("static_ffprobe -version")
```


```py
# Using the program location method
import subprocess
from static_ffmpeg 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"])
```



## Testing

  * Clone this project `git clone https://github.com/zackees/static_ffmpeg`
  * `cd static_ffmpeg`
  * Then run tox `tox`


## 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.

## Binary source
  * https://github.com/zackees/ffmpeg_bins

## Version

ffmpeg and ffprobe are both version: 5.0

## Release History
  * 2.7: Bugfix, increase the timeout to download for slow connections to 10 minutes.
  * 2.6: Bugfix, `add_paths(...)` can now be called multiple times without polluting the os env path.
  * 2.5: `add_paths()` now has optional `weak` parameter (default False). If True then `ffmpeg/ffprobe` binaries are only only if either `ffmpeg` OR `ffprobe` doesn't already exist on path
  * 2.3: Adds `static_ffmpeg.add_paths()`
  * 2.2: Addressed [bug 9](https://github.com/zackees/static_ffmpeg/issues/9) in some cases static_ffmpeg couldn't handle spaces in mp4 names.
  * 2.1: Addressed [bug 7](https://github.com/zackees/static_ffmpeg/issues/7) on Win32 for not handling spaces in directory names in the site packages path.
  * 2.0:
    * ffmpeg upgraded to 5.0
    * added ffprobe (static_ffprobe or get run.get_platform_executables_or_raise() to get the binary location)
    * Now downloads platform specific binary to reduce install size (reduced 2/3rds of the install size vs 1.0)
  * 1.0:
    * ffmpeg 4.4 released + tests

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/zackees/static_ffmpeg",
    "name": "static-ffmpeg",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6.0",
    "maintainer_email": null,
    "keywords": null,
    "author": "Zach Vorhies",
    "author_email": "dont@email.me",
    "download_url": "https://files.pythonhosted.org/packages/58/77/1a160360a82d3b152bba3bfb850181ade1af6f53767813de7adb3fd50c8e/static_ffmpeg-2.7.tar.gz",
    "platform": null,
    "description": "\r\n[![Actions Status](https://github.com/zackees/static_ffmpeg/workflows/MacOS_Tests/badge.svg)](https://github.com/zackees/static_ffmpeg/actions/workflows/push_macos.yml)\r\n[![Actions Status](https://github.com/zackees/static_ffmpeg/workflows/Win_Tests/badge.svg)](https://github.com/zackees/static_ffmpeg/actions/workflows/push_win.yml)\r\n[![Actions Status](https://github.com/zackees/static_ffmpeg/workflows/Ubuntu_Tests/badge.svg)](https://github.com/zackees/static_ffmpeg/actions/workflows/push_ubuntu.yml)\r\n\r\n# static-ffmpeg\r\n\r\nThe easiest way to get ffmpeg v5 installed through python.\r\n\r\n## Install\r\n\r\n```bash\r\n> pip install static-ffmpeg\r\n```\r\n\r\n## Usage\r\n\r\n```py\r\nimport static_ffmpeg\r\n# ffmpeg installed on first call to add_paths(), threadsafe.\r\nstatic_ffmpeg.add_paths()  # blocks until files are downloaded\r\n# or static_ffmpeg.add_paths(weak=True) to only add if ffmpeg/ffprobe not already on path\r\n# Now ffmpeg and ffprobe will use static_ffmpeg versions.\r\nos.system(\"ffmpeg -i myfile.mp4 ...\")\r\n```\r\n\r\nOr if you want more lazy behavior to install on first use, or you don't want to modify system paths, use `static_ffmpeg`\r\n\r\n\r\n```py\r\nimport static_ffmpeg\r\n# ffmpeg installed on first call, threadsafe.\r\nos.system(\"static_ffmpeg -i myfile.mp4 ...\")\r\n```\r\n\r\nYou can also use it on the command line\r\n\r\n```bash\r\n> pip install static-ffmpeg\r\n> static_ffmpeg -i file.mp4 ...\r\n> static_ffprobe ...\r\n> static_ffmpeg_paths\r\nFFMPEG=c:\\users\\niteris\\dev\\static_ffmpeg\\static_ffmpeg\\bin\\win32\\ffmpeg.exe\r\nFFPROBE=c:\\users\\niteris\\dev\\static_ffmpeg\\static_ffmpeg\\bin\\win32\\ffprobe.exe\r\n```\r\n\r\n## About\r\n\r\nThis 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.\r\n\r\nThis 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.\r\n\r\n### Without this library...\r\n\r\nYour 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.\r\n\r\nAs of now, binaries are available for:\r\n  * `win32` (Windows)\r\n  * `darwin` (MacOS)\r\n  * `linux` (From Ubuntu 20LTS)\r\n  * Pull requests to support for other platforms are welcome! Too add support please see related git repo: [ffmpeg_bins](https://github.com/zackees/ffmpeg_bins).\r\n\r\nThere is both an python api and a command line api. After installing this package the command line aliases will be available:\r\n\r\n  * `static_ffmpeg` operates just like `ffmpeg`\r\n  * `static_ffprobe` operates just like `ffprobe`.\r\n  * `static_ffmpeg_paths` prints out the paths of the ffmpeg binaries.\r\n\r\n```bash\r\n> static_ffmpeg_paths\r\nFFMPEG=c:\\users\\niteris\\dev\\static_ffmpeg\\static_ffmpeg\\bin\\win32\\ffmpeg.exe\r\nFFPROBE=c:\\users\\niteris\\dev\\static_ffmpeg\\static_ffmpeg\\bin\\win32\\ffprobe.exe\r\n```\r\n\r\n\r\n## Api\r\n\r\nHere's how to get the binaries and execute them.\r\n\r\n```py\r\n# Using the alias method\r\nimport os\r\n# Platform binaries will be installed the first run.\r\nos.system(\"static_ffmpeg -version\")  # static_ffmpeg is an alias for this tools ffmpeg.\r\nos.system(\"static_ffprobe -version\")\r\n```\r\n\r\n\r\n```py\r\n# Using the program location method\r\nimport subprocess\r\nfrom static_ffmpeg import run\r\n# Platform binaries are installed on the first run of below.\r\nffmpeg, ffprobe = run.get_or_fetch_platform_executables_else_raise()\r\n# ffmpeg, ffprobe will be paths to ffmpeg and ffprobe.\r\nsubprocess.check_output([ffmpeg, \"-version\"])\r\nsubprocess.check_output([ffprobe, \"-version\"])\r\n```\r\n\r\n\r\n\r\n## Testing\r\n\r\n  * Clone this project `git clone https://github.com/zackees/static_ffmpeg`\r\n  * `cd static_ffmpeg`\r\n  * Then run tox `tox`\r\n\r\n\r\n## Virtual Environment (optional)\r\n\r\nTo test it in a virtual environment, use this easy helper:\r\n\r\nTo easily setup a virtual environment, please run\r\n```bash\r\npython setupvirtualenv.py\r\n```\r\n\r\nThen run `./activate.sh` to activate the shell.\r\n\r\n## Binary source\r\n  * https://github.com/zackees/ffmpeg_bins\r\n\r\n## Version\r\n\r\nffmpeg and ffprobe are both version: 5.0\r\n\r\n## Release History\r\n  * 2.7: Bugfix, increase the timeout to download for slow connections to 10 minutes.\r\n  * 2.6: Bugfix, `add_paths(...)` can now be called multiple times without polluting the os env path.\r\n  * 2.5: `add_paths()` now has optional `weak` parameter (default False). If True then `ffmpeg/ffprobe` binaries are only only if either `ffmpeg` OR `ffprobe` doesn't already exist on path\r\n  * 2.3: Adds `static_ffmpeg.add_paths()`\r\n  * 2.2: Addressed [bug 9](https://github.com/zackees/static_ffmpeg/issues/9) in some cases static_ffmpeg couldn't handle spaces in mp4 names.\r\n  * 2.1: Addressed [bug 7](https://github.com/zackees/static_ffmpeg/issues/7) on Win32 for not handling spaces in directory names in the site packages path.\r\n  * 2.0:\r\n    * ffmpeg upgraded to 5.0\r\n    * added ffprobe (static_ffprobe or get run.get_platform_executables_or_raise() to get the binary location)\r\n    * Now downloads platform specific binary to reduce install size (reduced 2/3rds of the install size vs 1.0)\r\n  * 1.0:\r\n    * ffmpeg 4.4 released + tests\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Cross platform ffmpeg to work on various systems.",
    "version": "2.7",
    "project_urls": {
        "Homepage": "https://github.com/zackees/static_ffmpeg"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3cab2c835ea7a36dc23c5c0364d6b1764b1829946d1bad1c0581e31c7cf7988d",
                "md5": "01ad4f54fdcf883dab7e7d0dae700efb",
                "sha256": "8e36528c4592c0acf69806fab0f3dd74d485c8a91467cc4c0999610293f47000"
            },
            "downloads": -1,
            "filename": "static_ffmpeg-2.7-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "01ad4f54fdcf883dab7e7d0dae700efb",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.6.0",
            "size": 7512,
            "upload_time": "2024-04-24T00:29:48",
            "upload_time_iso_8601": "2024-04-24T00:29:48.205475Z",
            "url": "https://files.pythonhosted.org/packages/3c/ab/2c835ea7a36dc23c5c0364d6b1764b1829946d1bad1c0581e31c7cf7988d/static_ffmpeg-2.7-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "58771a160360a82d3b152bba3bfb850181ade1af6f53767813de7adb3fd50c8e",
                "md5": "acb4f0b40332e53ee21132f1b1a909ed",
                "sha256": "d43d6376d4f1f74533b5fe0e81bee899342594aacb2919f2ca468b0d3b093a53"
            },
            "downloads": -1,
            "filename": "static_ffmpeg-2.7.tar.gz",
            "has_sig": false,
            "md5_digest": "acb4f0b40332e53ee21132f1b1a909ed",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6.0",
            "size": 7778,
            "upload_time": "2024-04-24T00:29:50",
            "upload_time_iso_8601": "2024-04-24T00:29:50.006308Z",
            "url": "https://files.pythonhosted.org/packages/58/77/1a160360a82d3b152bba3bfb850181ade1af6f53767813de7adb3fd50c8e/static_ffmpeg-2.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-24 00:29:50",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "zackees",
    "github_project": "static_ffmpeg",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "tox": true,
    "lcname": "static-ffmpeg"
}
        
Elapsed time: 0.25564s