portable-ffmpeg 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- portable_ffmpeg-0.1.0/.github/dependabot.yml +12 -0
- portable_ffmpeg-0.1.0/.github/workflows/publish.yml +35 -0
- portable_ffmpeg-0.1.0/.github/workflows/test.yml +47 -0
- portable_ffmpeg-0.1.0/.gitignore +18 -0
- portable_ffmpeg-0.1.0/.pre-commit-config.yaml +28 -0
- portable_ffmpeg-0.1.0/.python-version +1 -0
- portable_ffmpeg-0.1.0/PKG-INFO +168 -0
- portable_ffmpeg-0.1.0/README.md +137 -0
- portable_ffmpeg-0.1.0/pyproject.toml +96 -0
- portable_ffmpeg-0.1.0/run_test.py +49 -0
- portable_ffmpeg-0.1.0/src/portable_ffmpeg/__init__.py +29 -0
- portable_ffmpeg-0.1.0/src/portable_ffmpeg/config.py +106 -0
- portable_ffmpeg-0.1.0/src/portable_ffmpeg/core.py +149 -0
- portable_ffmpeg-0.1.0/src/portable_ffmpeg/downloaders.py +155 -0
- portable_ffmpeg-0.1.0/src/portable_ffmpeg/enums.py +54 -0
- portable_ffmpeg-0.1.0/src/portable_ffmpeg/py.typed +0 -0
- portable_ffmpeg-0.1.0/tests/__init__.py +1 -0
- portable_ffmpeg-0.1.0/tests/test_core.py +116 -0
- portable_ffmpeg-0.1.0/tests/test_downloaders.py +200 -0
- portable_ffmpeg-0.1.0/tests/test_enums.py +81 -0
- portable_ffmpeg-0.1.0/tests/test_integration.py +210 -0
- portable_ffmpeg-0.1.0/uv.lock +443 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
publish:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
environment: release
|
|
11
|
+
permissions:
|
|
12
|
+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
|
|
17
|
+
- name: Install uv
|
|
18
|
+
uses: astral-sh/setup-uv@v4
|
|
19
|
+
with:
|
|
20
|
+
version: "latest"
|
|
21
|
+
|
|
22
|
+
- name: Set up Python
|
|
23
|
+
run: uv python install
|
|
24
|
+
|
|
25
|
+
- name: Install dependencies
|
|
26
|
+
run: uv sync --dev
|
|
27
|
+
|
|
28
|
+
- name: Run tests
|
|
29
|
+
run: uv run pytest
|
|
30
|
+
|
|
31
|
+
- name: Build package
|
|
32
|
+
run: uv build
|
|
33
|
+
|
|
34
|
+
- name: Publish to PyPI
|
|
35
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
name: Lint and Test
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
push:
|
|
6
|
+
branches: [master]
|
|
7
|
+
pull_request:
|
|
8
|
+
branches: [master]
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
pre-commit:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
- uses: tox-dev/action-pre-commit-uv@v1
|
|
16
|
+
|
|
17
|
+
test:
|
|
18
|
+
needs: pre-commit
|
|
19
|
+
|
|
20
|
+
runs-on: ${{ matrix.os }}
|
|
21
|
+
strategy:
|
|
22
|
+
fail-fast: false
|
|
23
|
+
matrix:
|
|
24
|
+
os:
|
|
25
|
+
# x86
|
|
26
|
+
- ubuntu-latest
|
|
27
|
+
- windows-latest
|
|
28
|
+
- macos-13
|
|
29
|
+
# arm64
|
|
30
|
+
- ubuntu-24.04-arm
|
|
31
|
+
- macos-latest
|
|
32
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
33
|
+
|
|
34
|
+
steps:
|
|
35
|
+
- uses: actions/checkout@v4
|
|
36
|
+
|
|
37
|
+
- name: Install uv
|
|
38
|
+
uses: astral-sh/setup-uv@v4
|
|
39
|
+
with:
|
|
40
|
+
version: "latest"
|
|
41
|
+
|
|
42
|
+
- name: Install dependencies
|
|
43
|
+
run: uv sync --dev -p "${{ matrix.python-version }}"
|
|
44
|
+
|
|
45
|
+
- name: Run tests
|
|
46
|
+
run: |
|
|
47
|
+
uv run run_test.py
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
3
|
+
rev: v5.0.0
|
|
4
|
+
hooks:
|
|
5
|
+
- id: trailing-whitespace
|
|
6
|
+
- id: end-of-file-fixer
|
|
7
|
+
- id: check-yaml
|
|
8
|
+
- id: check-added-large-files
|
|
9
|
+
- id: check-merge-conflict
|
|
10
|
+
- id: check-toml
|
|
11
|
+
- id: debug-statements
|
|
12
|
+
- id: mixed-line-ending
|
|
13
|
+
|
|
14
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
15
|
+
rev: v0.11.13
|
|
16
|
+
hooks:
|
|
17
|
+
- id: ruff-check
|
|
18
|
+
args: [--fix]
|
|
19
|
+
- id: ruff-format
|
|
20
|
+
|
|
21
|
+
- repo: local
|
|
22
|
+
hooks:
|
|
23
|
+
- id: pyright
|
|
24
|
+
name: pyright
|
|
25
|
+
entry: uv run --no-progress --frozen --all-extras --all-groups pyright --project pyproject.toml .
|
|
26
|
+
language: system
|
|
27
|
+
types: [python]
|
|
28
|
+
pass_filenames: false
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.10
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: portable-ffmpeg
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Downloads static ffmpeg builds for Windows, macOS, and Linux
|
|
5
|
+
Project-URL: Homepage, https://github.com/mrkbac/portable-ffmpeg
|
|
6
|
+
Project-URL: Repository, https://github.com/mrkbac/portable-ffmpeg
|
|
7
|
+
Project-URL: Issues, https://github.com/mrkbac/portable-ffmpeg/issues
|
|
8
|
+
Author-email: Marko Bausch <60338487+mrkbac@users.noreply.github.com>
|
|
9
|
+
License: MIT
|
|
10
|
+
Keywords: audio,ffmpeg,ffprobe,multimedia,portable,static,video
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Multimedia :: Sound/Audio
|
|
21
|
+
Classifier: Topic :: Multimedia :: Video
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: pre-commit; extra == 'dev'
|
|
26
|
+
Requires-Dist: pyright; extra == 'dev'
|
|
27
|
+
Requires-Dist: pytest-cov; extra == 'dev'
|
|
28
|
+
Requires-Dist: pytest>=8.4.0; extra == 'dev'
|
|
29
|
+
Requires-Dist: ruff; extra == 'dev'
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
# Portable FFmpeg
|
|
33
|
+
|
|
34
|
+
Downloads static ffmpeg builds for Windows, macOS, and Linux.
|
|
35
|
+
|
|
36
|
+
- Supports Windows, macOS, and Linux
|
|
37
|
+
- Supports x86_64 architecture on all platforms, ARM64 on macOS and Linux
|
|
38
|
+
- Automatic platform detection and binary caching
|
|
39
|
+
|
|
40
|
+
## Usage
|
|
41
|
+
|
|
42
|
+
### Python API
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
from portable_ffmpeg import get_ffmpeg
|
|
46
|
+
ffmpeg_path, ffprobe_path = get_ffmpeg()
|
|
47
|
+
print(ffmpeg_path) # Path to ffmpeg executable
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Command Line Interface
|
|
51
|
+
|
|
52
|
+
After installation, you can use `static_ffmpeg` and `static_ffprobe` directly from the command line:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# Use static ffmpeg
|
|
56
|
+
static_ffmpeg -i input.mp4 output.mp3
|
|
57
|
+
|
|
58
|
+
# Use static ffprobe
|
|
59
|
+
static_ffprobe -v quiet -print_format json -show_format input.mp4
|
|
60
|
+
|
|
61
|
+
# Print paths to the binaries
|
|
62
|
+
print_paths
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The CLI commands automatically download and cache the appropriate static binaries for your platform.
|
|
66
|
+
|
|
67
|
+
### PATH Management
|
|
68
|
+
|
|
69
|
+
You can also programmatically manage your PATH:
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
from portable_ffmpeg import add_to_path, remove_from_path
|
|
73
|
+
|
|
74
|
+
# Add FFmpeg binaries to PATH
|
|
75
|
+
add_to_path()
|
|
76
|
+
|
|
77
|
+
# Add only if FFmpeg is not already available (weak mode)
|
|
78
|
+
add_to_path(weak=True)
|
|
79
|
+
|
|
80
|
+
# Remove from PATH
|
|
81
|
+
remove_from_path()
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Sources of Static Builds
|
|
85
|
+
|
|
86
|
+
This package downloads static FFmpeg binaries from the following trusted sources:
|
|
87
|
+
|
|
88
|
+
### Windows (x86_64 only)
|
|
89
|
+
|
|
90
|
+
- **Source**: [CODEX FFMPEG @ gyan.dev](https://www.gyan.dev/ffmpeg/builds/)
|
|
91
|
+
- **URL**: `https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-essentials.zip`
|
|
92
|
+
- **Description**: Official Windows builds, 64-bit static binaries licensed as GPLv3
|
|
93
|
+
|
|
94
|
+
### macOS
|
|
95
|
+
|
|
96
|
+
#### Intel (x86_64)
|
|
97
|
+
|
|
98
|
+
- **Source**: [OSXExperts.net](http://www.osxexperts.net/)
|
|
99
|
+
- **URLs**:
|
|
100
|
+
- FFmpeg: `https://www.osxexperts.net/ffmpeg71intel.zip`
|
|
101
|
+
- FFprobe: `https://www.osxexperts.net/ffprobe71intel.zip`
|
|
102
|
+
- **Description**: Static FFmpeg 7.1 binaries for macOS Intel processors
|
|
103
|
+
|
|
104
|
+
#### Apple Silicon (arm64)
|
|
105
|
+
|
|
106
|
+
- **Source**: [OSXExperts.net](http://www.osxexperts.net/)
|
|
107
|
+
- **URLs**:
|
|
108
|
+
- FFmpeg: `https://www.osxexperts.net/ffmpeg711arm.zip`
|
|
109
|
+
- FFprobe: `https://www.osxexperts.net/ffprobe711arm.zip`
|
|
110
|
+
- **Description**: Static FFmpeg 7.1.1 binaries optimized for Apple Silicon processors
|
|
111
|
+
|
|
112
|
+
### Linux (x86_64 and arm64)
|
|
113
|
+
|
|
114
|
+
- **Source**: [John Van Sickle - FFmpeg Static Builds](https://johnvansickle.com/ffmpeg/)
|
|
115
|
+
- **URLs**:
|
|
116
|
+
- x86_64: `https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz`
|
|
117
|
+
- arm64: `https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-arm64-static.tar.xz`
|
|
118
|
+
- **Description**: Latest versions of FFmpeg for Linux kernels 3.2.0+, statically linked
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
### Alternative Sources
|
|
122
|
+
|
|
123
|
+
The following sources provide FFmpeg static builds but are not currently supported by this package. They could be considered for future releases:
|
|
124
|
+
|
|
125
|
+
- **[FFmpeg Martin Riedl](https://ffmpeg.martin-riedl.de/)**
|
|
126
|
+
- **Platforms**: macOS, Linux
|
|
127
|
+
- **Architectures**: x86_64, ARM64
|
|
128
|
+
- **Description**: Regularly updated static builds with comprehensive codec support
|
|
129
|
+
|
|
130
|
+
- **[BtbN FFmpeg Builds](https://github.com/BtbN/FFmpeg-Builds)**
|
|
131
|
+
- **Platforms**: Windows, Linux
|
|
132
|
+
- **Architectures**: x86_64, ARM64, x86 (Windows only)
|
|
133
|
+
- **Description**: GitHub Actions-built binaries with automated releases
|
|
134
|
+
|
|
135
|
+
- **[EverMeet FFmpeg](https://evermeet.cx/ffmpeg/)**
|
|
136
|
+
- **Platforms**: macOS only
|
|
137
|
+
- **Architectures**: x86_64
|
|
138
|
+
- **Description**: Long-standing macOS static builds provider
|
|
139
|
+
|
|
140
|
+
- **[FreeBSD FFmpeg Static](https://github.com/Thefrank/ffmpeg-static-freebsd/)**
|
|
141
|
+
- **Platforms**: FreeBSD only
|
|
142
|
+
- **Architectures**: Various
|
|
143
|
+
- **Description**: Static builds specifically for FreeBSD systems
|
|
144
|
+
|
|
145
|
+
- **[John Van Sickle Extended](https://johnvansickle.com/ffmpeg/)**
|
|
146
|
+
- **Additional Architectures**: i686, armhf, armel (beyond the currently supported x86_64 and ARM64)
|
|
147
|
+
- **Description**: Comprehensive Linux support including older and embedded architectures
|
|
148
|
+
|
|
149
|
+
## Caching
|
|
150
|
+
|
|
151
|
+
Downloaded binaries are cached in the package's `binaries/` directory to avoid re-downloading. Each virtual environment gets its own copy of the binaries.
|
|
152
|
+
|
|
153
|
+
The cache is organized by platform and architecture (e.g., `linux-amd64`, `windows-amd64`, `osx-arm64`).
|
|
154
|
+
|
|
155
|
+
### Cache Management
|
|
156
|
+
|
|
157
|
+
```python
|
|
158
|
+
from portable_ffmpeg import clear_cache
|
|
159
|
+
|
|
160
|
+
# Clear all cached binaries
|
|
161
|
+
clear_cache()
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Or use the command line:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
clear_cache
|
|
168
|
+
```
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# Portable FFmpeg
|
|
2
|
+
|
|
3
|
+
Downloads static ffmpeg builds for Windows, macOS, and Linux.
|
|
4
|
+
|
|
5
|
+
- Supports Windows, macOS, and Linux
|
|
6
|
+
- Supports x86_64 architecture on all platforms, ARM64 on macOS and Linux
|
|
7
|
+
- Automatic platform detection and binary caching
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
### Python API
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
from portable_ffmpeg import get_ffmpeg
|
|
15
|
+
ffmpeg_path, ffprobe_path = get_ffmpeg()
|
|
16
|
+
print(ffmpeg_path) # Path to ffmpeg executable
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Command Line Interface
|
|
20
|
+
|
|
21
|
+
After installation, you can use `static_ffmpeg` and `static_ffprobe` directly from the command line:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Use static ffmpeg
|
|
25
|
+
static_ffmpeg -i input.mp4 output.mp3
|
|
26
|
+
|
|
27
|
+
# Use static ffprobe
|
|
28
|
+
static_ffprobe -v quiet -print_format json -show_format input.mp4
|
|
29
|
+
|
|
30
|
+
# Print paths to the binaries
|
|
31
|
+
print_paths
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The CLI commands automatically download and cache the appropriate static binaries for your platform.
|
|
35
|
+
|
|
36
|
+
### PATH Management
|
|
37
|
+
|
|
38
|
+
You can also programmatically manage your PATH:
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
from portable_ffmpeg import add_to_path, remove_from_path
|
|
42
|
+
|
|
43
|
+
# Add FFmpeg binaries to PATH
|
|
44
|
+
add_to_path()
|
|
45
|
+
|
|
46
|
+
# Add only if FFmpeg is not already available (weak mode)
|
|
47
|
+
add_to_path(weak=True)
|
|
48
|
+
|
|
49
|
+
# Remove from PATH
|
|
50
|
+
remove_from_path()
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Sources of Static Builds
|
|
54
|
+
|
|
55
|
+
This package downloads static FFmpeg binaries from the following trusted sources:
|
|
56
|
+
|
|
57
|
+
### Windows (x86_64 only)
|
|
58
|
+
|
|
59
|
+
- **Source**: [CODEX FFMPEG @ gyan.dev](https://www.gyan.dev/ffmpeg/builds/)
|
|
60
|
+
- **URL**: `https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-essentials.zip`
|
|
61
|
+
- **Description**: Official Windows builds, 64-bit static binaries licensed as GPLv3
|
|
62
|
+
|
|
63
|
+
### macOS
|
|
64
|
+
|
|
65
|
+
#### Intel (x86_64)
|
|
66
|
+
|
|
67
|
+
- **Source**: [OSXExperts.net](http://www.osxexperts.net/)
|
|
68
|
+
- **URLs**:
|
|
69
|
+
- FFmpeg: `https://www.osxexperts.net/ffmpeg71intel.zip`
|
|
70
|
+
- FFprobe: `https://www.osxexperts.net/ffprobe71intel.zip`
|
|
71
|
+
- **Description**: Static FFmpeg 7.1 binaries for macOS Intel processors
|
|
72
|
+
|
|
73
|
+
#### Apple Silicon (arm64)
|
|
74
|
+
|
|
75
|
+
- **Source**: [OSXExperts.net](http://www.osxexperts.net/)
|
|
76
|
+
- **URLs**:
|
|
77
|
+
- FFmpeg: `https://www.osxexperts.net/ffmpeg711arm.zip`
|
|
78
|
+
- FFprobe: `https://www.osxexperts.net/ffprobe711arm.zip`
|
|
79
|
+
- **Description**: Static FFmpeg 7.1.1 binaries optimized for Apple Silicon processors
|
|
80
|
+
|
|
81
|
+
### Linux (x86_64 and arm64)
|
|
82
|
+
|
|
83
|
+
- **Source**: [John Van Sickle - FFmpeg Static Builds](https://johnvansickle.com/ffmpeg/)
|
|
84
|
+
- **URLs**:
|
|
85
|
+
- x86_64: `https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz`
|
|
86
|
+
- arm64: `https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-arm64-static.tar.xz`
|
|
87
|
+
- **Description**: Latest versions of FFmpeg for Linux kernels 3.2.0+, statically linked
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
### Alternative Sources
|
|
91
|
+
|
|
92
|
+
The following sources provide FFmpeg static builds but are not currently supported by this package. They could be considered for future releases:
|
|
93
|
+
|
|
94
|
+
- **[FFmpeg Martin Riedl](https://ffmpeg.martin-riedl.de/)**
|
|
95
|
+
- **Platforms**: macOS, Linux
|
|
96
|
+
- **Architectures**: x86_64, ARM64
|
|
97
|
+
- **Description**: Regularly updated static builds with comprehensive codec support
|
|
98
|
+
|
|
99
|
+
- **[BtbN FFmpeg Builds](https://github.com/BtbN/FFmpeg-Builds)**
|
|
100
|
+
- **Platforms**: Windows, Linux
|
|
101
|
+
- **Architectures**: x86_64, ARM64, x86 (Windows only)
|
|
102
|
+
- **Description**: GitHub Actions-built binaries with automated releases
|
|
103
|
+
|
|
104
|
+
- **[EverMeet FFmpeg](https://evermeet.cx/ffmpeg/)**
|
|
105
|
+
- **Platforms**: macOS only
|
|
106
|
+
- **Architectures**: x86_64
|
|
107
|
+
- **Description**: Long-standing macOS static builds provider
|
|
108
|
+
|
|
109
|
+
- **[FreeBSD FFmpeg Static](https://github.com/Thefrank/ffmpeg-static-freebsd/)**
|
|
110
|
+
- **Platforms**: FreeBSD only
|
|
111
|
+
- **Architectures**: Various
|
|
112
|
+
- **Description**: Static builds specifically for FreeBSD systems
|
|
113
|
+
|
|
114
|
+
- **[John Van Sickle Extended](https://johnvansickle.com/ffmpeg/)**
|
|
115
|
+
- **Additional Architectures**: i686, armhf, armel (beyond the currently supported x86_64 and ARM64)
|
|
116
|
+
- **Description**: Comprehensive Linux support including older and embedded architectures
|
|
117
|
+
|
|
118
|
+
## Caching
|
|
119
|
+
|
|
120
|
+
Downloaded binaries are cached in the package's `binaries/` directory to avoid re-downloading. Each virtual environment gets its own copy of the binaries.
|
|
121
|
+
|
|
122
|
+
The cache is organized by platform and architecture (e.g., `linux-amd64`, `windows-amd64`, `osx-arm64`).
|
|
123
|
+
|
|
124
|
+
### Cache Management
|
|
125
|
+
|
|
126
|
+
```python
|
|
127
|
+
from portable_ffmpeg import clear_cache
|
|
128
|
+
|
|
129
|
+
# Clear all cached binaries
|
|
130
|
+
clear_cache()
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Or use the command line:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
clear_cache
|
|
137
|
+
```
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "portable-ffmpeg"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Downloads static ffmpeg builds for Windows, macOS, and Linux"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
authors = [
|
|
7
|
+
{ name = "Marko Bausch", email = "60338487+mrkbac@users.noreply.github.com" },
|
|
8
|
+
]
|
|
9
|
+
license = { text = "MIT" }
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
dependencies = []
|
|
12
|
+
keywords = [
|
|
13
|
+
"ffmpeg",
|
|
14
|
+
"ffprobe",
|
|
15
|
+
"video",
|
|
16
|
+
"audio",
|
|
17
|
+
"multimedia",
|
|
18
|
+
"static",
|
|
19
|
+
"portable",
|
|
20
|
+
]
|
|
21
|
+
classifiers = [
|
|
22
|
+
"Development Status :: 4 - Beta",
|
|
23
|
+
"Intended Audience :: Developers",
|
|
24
|
+
"License :: OSI Approved :: MIT License",
|
|
25
|
+
"Operating System :: OS Independent",
|
|
26
|
+
"Programming Language :: Python :: 3",
|
|
27
|
+
"Programming Language :: Python :: 3.10",
|
|
28
|
+
"Programming Language :: Python :: 3.11",
|
|
29
|
+
"Programming Language :: Python :: 3.12",
|
|
30
|
+
"Programming Language :: Python :: 3.13",
|
|
31
|
+
"Topic :: Multimedia :: Video",
|
|
32
|
+
"Topic :: Multimedia :: Sound/Audio",
|
|
33
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
[project.urls]
|
|
37
|
+
Homepage = "https://github.com/mrkbac/portable-ffmpeg"
|
|
38
|
+
Repository = "https://github.com/mrkbac/portable-ffmpeg"
|
|
39
|
+
Issues = "https://github.com/mrkbac/portable-ffmpeg/issues"
|
|
40
|
+
|
|
41
|
+
[project.optional-dependencies]
|
|
42
|
+
dev = ["pytest>=8.4.0", "pytest-cov", "ruff", "pyright", "pre-commit"]
|
|
43
|
+
|
|
44
|
+
[project.scripts]
|
|
45
|
+
static_ffmpeg = "portable_ffmpeg:run_ffmpeg"
|
|
46
|
+
static_ffprobe = "portable_ffmpeg:run_ffprobe"
|
|
47
|
+
print_paths = "portable_ffmpeg:print_paths"
|
|
48
|
+
clear_cache = "portable_ffmpeg:clear_cache"
|
|
49
|
+
|
|
50
|
+
[build-system]
|
|
51
|
+
requires = ["hatchling"]
|
|
52
|
+
build-backend = "hatchling.build"
|
|
53
|
+
|
|
54
|
+
[tool.ruff]
|
|
55
|
+
target-version = "py310"
|
|
56
|
+
line-length = 100
|
|
57
|
+
|
|
58
|
+
[tool.ruff.lint]
|
|
59
|
+
select = ['ALL']
|
|
60
|
+
ignore = [
|
|
61
|
+
"S310", # Audit URL open (expected for downloading binaries)
|
|
62
|
+
"S103", # os.chmod setting permissive mask (need executable permissions)
|
|
63
|
+
"S603", # subprocess call: check for execution of untrusted input (expected for CLI entry points)
|
|
64
|
+
"COM812", # Trailing comma missing (conflicts with formatter)
|
|
65
|
+
"PLR2004", # Magic values (acceptable in some cases)
|
|
66
|
+
"T201", # print statement used
|
|
67
|
+
"ERA001", # Commented-out code
|
|
68
|
+
]
|
|
69
|
+
[tool.ruff.lint.per-file-ignores]
|
|
70
|
+
# relaxes in tests
|
|
71
|
+
"tests/*" = [
|
|
72
|
+
"S101", # Use of assert detected (legitimate in tests)
|
|
73
|
+
"BLE001", # Broad exception catching (acceptable in tests)
|
|
74
|
+
"PT011", # Broad pytest.raises (sometimes acceptable)
|
|
75
|
+
"PERF203", # try-except in loop (acceptable in tests)
|
|
76
|
+
"PLR2004", # Magic values (acceptable in tests)
|
|
77
|
+
"D401", # Imperative mood (less important in tests)
|
|
78
|
+
]
|
|
79
|
+
|
|
80
|
+
[dependency-groups]
|
|
81
|
+
dev = [
|
|
82
|
+
"pre-commit>=4.2.0",
|
|
83
|
+
"pyright>=1.1.402",
|
|
84
|
+
"pytest-asyncio>=1.0.0",
|
|
85
|
+
"pytest-cov>=6.2.1",
|
|
86
|
+
"pytest-mock>=3.14.1",
|
|
87
|
+
"ruff>=0.11.13",
|
|
88
|
+
]
|
|
89
|
+
|
|
90
|
+
[tool.pytest.ini_options]
|
|
91
|
+
markers = ["slow: marks tests as slow (deselect with '-m \"not slow\"')"]
|
|
92
|
+
addopts = "--strict-markers --strict-config"
|
|
93
|
+
|
|
94
|
+
[tool.coverage.report]
|
|
95
|
+
fail_under = 100
|
|
96
|
+
show_missing = true
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"""Run tests with coverage and generate summary for GitHub Actions."""
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import subprocess
|
|
5
|
+
import sys
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def main() -> None:
|
|
10
|
+
"""Run tests and generate summary based on arguments."""
|
|
11
|
+
print("Running tests with coverage...")
|
|
12
|
+
|
|
13
|
+
# Run pytest with coverage, capturing output
|
|
14
|
+
result = subprocess.run(
|
|
15
|
+
[ # noqa: S607
|
|
16
|
+
"pytest",
|
|
17
|
+
"--cov=src/portable_ffmpeg",
|
|
18
|
+
"--cov-report=term-missing",
|
|
19
|
+
"--cov-fail-under=95",
|
|
20
|
+
],
|
|
21
|
+
check=False,
|
|
22
|
+
capture_output=True,
|
|
23
|
+
text=True,
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
# Print output to console
|
|
27
|
+
if result.stdout:
|
|
28
|
+
print(result.stdout)
|
|
29
|
+
if result.stderr:
|
|
30
|
+
print(result.stderr, file=sys.stderr)
|
|
31
|
+
|
|
32
|
+
# Write summary to GitHub Actions if environment variable is set
|
|
33
|
+
if summary_file := os.environ.get("GITHUB_STEP_SUMMARY"):
|
|
34
|
+
print(f"Writing summary to {summary_file}")
|
|
35
|
+
with Path(summary_file).open("w") as f:
|
|
36
|
+
f.write("# Test Coverage Summary\n\n")
|
|
37
|
+
f.write("```text\n")
|
|
38
|
+
if result.stdout:
|
|
39
|
+
f.write(result.stdout)
|
|
40
|
+
else:
|
|
41
|
+
f.write("No coverage data available\n")
|
|
42
|
+
f.write("```\n")
|
|
43
|
+
|
|
44
|
+
# Exit with the same code as pytest
|
|
45
|
+
sys.exit(result.returncode)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
if __name__ == "__main__":
|
|
49
|
+
main()
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"""Static FFmpeg binaries for Windows, macOS, and Linux.
|
|
2
|
+
|
|
3
|
+
This package automatically downloads and manages static FFmpeg binaries
|
|
4
|
+
for cross-platform use without requiring system installation.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from .core import (
|
|
8
|
+
add_to_path,
|
|
9
|
+
clear_cache,
|
|
10
|
+
get_ffmpeg,
|
|
11
|
+
print_paths,
|
|
12
|
+
remove_from_path,
|
|
13
|
+
run_ffmpeg,
|
|
14
|
+
run_ffprobe,
|
|
15
|
+
)
|
|
16
|
+
from .enums import Architectures, FFmpegVersions, OperatingSystems
|
|
17
|
+
|
|
18
|
+
__all__ = [
|
|
19
|
+
"Architectures",
|
|
20
|
+
"FFmpegVersions",
|
|
21
|
+
"OperatingSystems",
|
|
22
|
+
"add_to_path",
|
|
23
|
+
"clear_cache",
|
|
24
|
+
"get_ffmpeg",
|
|
25
|
+
"print_paths",
|
|
26
|
+
"remove_from_path",
|
|
27
|
+
"run_ffmpeg",
|
|
28
|
+
"run_ffprobe",
|
|
29
|
+
]
|