Skip to content

Commit

Permalink
Put FFmpeg binaries in a different PyPI package
Browse files Browse the repository at this point in the history
  • Loading branch information
WyattBlue committed Jul 14, 2022
1 parent 65a081f commit 7baa994
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 213 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/ff-publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Upload Python Package
on:
release:
types: [created]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
cd ff
mv ae_ffmpeg/ffmpeg/Windows ./
python setup.py bdist_wheel --plat-name=macosx_10_9_x86_64
twine upload dist/*
rm -rf dist build
mv Windows ae_ffmpeg/ffmpeg
mv ae_ffmpeg/ffmpeg/Darwin ./
python setup.py bdist_wheel --plat-name=win_amd64
twine upload dist/*
rm -rf dist build
mv ae_ffmpeg/ffmpeg/Windows ./
python setup.py sdist bdist_wheel
twine upload dist/*
17 changes: 1 addition & 16 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,8 @@ jobs:
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PIP_USERNAME }}
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PIP_PASSWORD }}
run: |
mv auto_editor/ffmpeg/Windows ./
python setup.py bdist_wheel --plat-name=macosx_10_9_x86_64
twine upload dist/*
rm -rf dist build
mv Windows auto_editor/ffmpeg
mv auto_editor/ffmpeg/Darwin ./
python setup.py bdist_wheel --plat-name=win_amd64
twine upload dist/*
rm -rf dist build
mv auto_editor/ffmpeg/Windows ./
python setup.py sdist bdist_wheel
twine upload dist/*
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ auto-editor --scale --help
- [Note on GPU Acceleration](https://auto-editor.com/gpu)

## Copyright
Auto-Editor is under the [Public Domain](https://github.com/WyattBlue/auto-editor/blob/master/LICENSE) and includes all files besides the ones listed below. Auto-Editor was created by [these people.](https://github.com/WyattBlue/auto-editor/blob/master/AUTHORS.md)
Auto-Editor is under the [Public Domain](https://github.com/WyattBlue/auto-editor/blob/master/LICENSE) and includes all directories besides the ones listed below. Auto-Editor was created by [these people.](https://github.com/WyattBlue/auto-editor/blob/master/AUTHORS.md)

The binaries under auto_editor/ffmpeg are subject to the [LGPLv3 License](https://github.com/WyattBlue/auto-editor/blob/master/auto_editor/ffmpeg/LICENSE.txt). The FFmpeg and FFprobe programs were created by the FFmpeg team and purposely compiled by WyattBlue for use in auto-editor.
ae-ffmpeg is under the [LGPLv3 License](https://github.com/WyattBlue/auto-editor/blob/master/auto_editor/ffmpeg/LICENSE.txt). The FFmpeg and FFprobe programs were created by the FFmpeg team and purposely compiled by WyattBlue for use in auto-editor.

## Issues
If you encounter a bug or have a feature request, you can [create a new issue](https://github.com/WyattBlue/auto-editor/issues/new). If you'll like to discuss this project, and chat with other users, you can use the [discord server](https://discord.com/invite/kMHAWJJ).
Binary file removed auto_editor/ffmpeg/Darwin/ffmpeg
Binary file not shown.
165 changes: 0 additions & 165 deletions auto_editor/ffmpeg/LICENSE.txt

This file was deleted.

Binary file removed auto_editor/ffmpeg/Windows/ffmpeg.exe
Binary file not shown.
Binary file removed auto_editor/ffmpeg/Windows/libopenh264.dll
Binary file not shown.
30 changes: 11 additions & 19 deletions auto_editor/ffwrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
from subprocess import PIPE, Popen
from typing import Any, Dict, List, Optional, Tuple

import ae_ffmpeg

from auto_editor.utils.func import get_stdout
from auto_editor.utils.log import Log

Expand All @@ -19,33 +21,23 @@
class FFmpeg:
__slots__ = ("debug", "path", "version")

@staticmethod
def _set_ff_path(ff_location: Optional[str], my_ffmpeg: bool) -> str:
if ff_location is not None:
return ff_location
if my_ffmpeg or system() not in ("Windows", "Darwin"):
return "ffmpeg"

# Assumming accessing __file__ is somewhat expensive.
program = "ffmpeg.exe" if system() == "Windows" else "ffmpeg"
dirpath = os.path.dirname(os.path.realpath(__file__))
file_path = os.path.join(dirpath, "ffmpeg", system(), program)

# May not exist because auto-editor doesn't bundle every architecture.
if os.path.isfile(file_path):
return file_path

return "ffmpeg"

def __init__(
self,
ff_location: Optional[str] = None,
my_ffmpeg: bool = False,
debug: bool = False,
) -> None:

def _set_ff_path(ff_location: Optional[str], my_ffmpeg: bool) -> str:
if ff_location is not None:
return ff_location
if my_ffmpeg:
return "ffmpeg"

return ae_ffmpeg.get_path()

self.debug = debug
self.path = self._set_ff_path(ff_location, my_ffmpeg)
self.path = _set_ff_path(ff_location, my_ffmpeg)
try:
_version = get_stdout([self.path, "-version"]).split("\n")[0]
_version = _version.replace("ffmpeg version", "").strip()
Expand Down
13 changes: 2 additions & 11 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,14 @@ def pip_version():
keywords="video audio media editor editing processing nonlinear automatic "
"silence-detect silence-removal silence-speedup motion-detection",
packages=find_packages(),
package_data={
"auto_editor": [
"help.json",
"ffmpeg/LICENSE.txt",
"ffmpeg/Windows/ffmpeg.exe",
"ffmpeg/Windows/ffprobe.exe",
"ffmpeg/Windows/libopenh264.dll",
"ffmpeg/Darwin/ffmpeg",
"ffmpeg/Darwin/ffprobe",
],
},
package_data={"auto_editor": ["help.json"]},
include_package_data=True,
zip_safe=False,
install_requires=[
"numpy>=1.22.0",
"pillow==9.2.0",
"av==9.2.0",
"ae-ffmpeg==1.0.0",
],
python_requires=">=3.8",
classifiers=[
Expand Down

0 comments on commit 7baa994

Please sign in to comment.