GithubHelp home page GithubHelp logo

soebb / static_ffmpeg Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zackees/static_ffmpeg

0.0 0.0 0.0 389.81 MB

Installs FFMPEG On Win32/Ubuntu/MacOS

License: MIT License

Python 99.84% Shell 0.16%

static_ffmpeg's Introduction

Actions Status Actions Status Actions Status

static-ffmpeg

The easiest way to get ffmpeg v5 installed through python.

Install

> pip install static-ffmpeg

Usage

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

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

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

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

# 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")
# 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

python setupvirtualenv.py

Then run ./activate.sh to activate the shell.

Binary source

Version

ffmpeg and ffprobe are both version: 5.0

Release History

  • 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 in some cases static_ffmpeg couldn't handle spaces in mp4 names.
  • 2.1: Addressed bug 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

static_ffmpeg's People

Contributors

matthiasmiller avatar zackees avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.