Skip to content

Commit 5444557

Browse files
committed
docs: enhance TODO with static library distribution plan
- A comprehensive static library distribution implementation plan using GitHub Releases - Detailed phased approach for automating library downloads on first import - Documentation updates for installation in various environments - Testing plan with validation procedures - Additional project onboarding information
1 parent eed62e5 commit 5444557

1 file changed

Lines changed: 203 additions & 1 deletion

File tree

docs/TODO.md

Lines changed: 203 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
--enable-libvmaf enable vmaf filter via libvmaf [no]
88
--enable-whisper enable whisper filter [no]
99
- [x] Rename to ffmpeg-statigo
10-
- [ ] How to embed/distribute the static FFmpeg library?
10+
- [x] How to embed/distribute the static FFmpeg library?
1111
- [x] Review default codecs:
1212
- https://ffmpeg.martin-riedl.de/
1313
- https://github.com/markus-perl/ffmpeg-build-script/blob/master/build-ffmpeg
@@ -19,6 +19,208 @@
1919
- [ ] Expose platform specific headers.
2020
- [ ] Cleanup internal packages.
2121

22+
---
23+
24+
# Static Library Distribution Implementation Plan
25+
26+
**Decision:** GitHub Releases + Auto-Download approach
27+
28+
**Rationale:**
29+
- Git LFS is NOT idiomatic for Go modules - `go get` doesn't fetch LFS files
30+
- Research found zero examples of popular Go CGO libraries using LFS
31+
- mattn/go-sqlite3 (canonical example) bundles C source directly, not via LFS
32+
- GitHub Releases provide unlimited bandwidth vs LFS 10 GiB/month limit
33+
- Platform-specific downloads (100MB) vs downloading all platforms (400MB)
34+
35+
## Phase 1: GitHub Actions - Release Workflow
36+
37+
**Goal:** Create/updated automated workflow to build and publish static libraries as GitHub Release assets. See the existing GitHub: `.github/workflows` and update as appropriated.
38+
39+
**Testing:**
40+
```bash
41+
# Test via workflow_dispatch before tagging
42+
gh workflow run release.yml -f tag=v0.1.0-test
43+
44+
# Once validated, create actual release
45+
git tag v0.1.0
46+
git push origin v0.1.0
47+
```
48+
49+
## Phase 2: Library Download Infrastructure
50+
51+
**Goal:** Implement automatic library download on first import, perhaps via a new file `lib/fetch.go`. See `internal/builder/download.go` for the Go modules already used in the project to download tarballs. The download must be able to resolve the download that matches it's internal tagged release and get the correct architecture version of the library.
52+
53+
**Testing:**
54+
```bash
55+
# Remove existing libraries to test download
56+
rm -rf lib/linux_amd64 lib/darwin_arm64
57+
58+
# Import will trigger download
59+
go build ./examples/metadata
60+
```
61+
62+
### Update .gitignore
63+
64+
**File:** `.gitignore`
65+
66+
Add the following:
67+
68+
```
69+
lib/*/
70+
!lib/fetch.go
71+
!lib/README.md
72+
```
73+
74+
### Create Library Directory README
75+
76+
**File:** `lib/README.md`
77+
78+
```markdown
79+
# FFmpeg Static Libraries
80+
81+
This directory contains platform-specific FFmpeg static libraries.
82+
83+
## Automatic Download
84+
85+
Libraries are automatically downloaded on first import of the `ffmpeg-statigo` package.
86+
No manual intervention required.
87+
88+
## Manual Download
89+
90+
If automatic download fails:
91+
92+
# Linux amd64
93+
wget https://github.com/linuxmatters/ffmpeg-statigo/releases/download/v0.1.0/ffmpeg-linux-amd64.tar.gz
94+
tar -xzf ffmpeg-linux-amd64.tar.gz
95+
96+
# macOS arm64
97+
wget https://github.com/linuxmatters/ffmpeg-statigo/releases/download/v0.1.0/ffmpeg-darwin-arm64.tar.gz
98+
tar -xzf ffmpeg-darwin-arm64.tar.gz
99+
100+
## Verification
101+
102+
# Verify libraries exist and are valid
103+
ls -lh lib/*/libffmpeg.a
104+
105+
# Each library should be ~75-100MB
106+
107+
## Structure
108+
109+
lib/
110+
├── linux_amd64/
111+
│ └── libffmpeg.a
112+
├── linux_arm64/
113+
│ └── libffmpeg.a
114+
├── darwin_amd64/
115+
│ └── libffmpeg.a
116+
└── darwin_arm64/
117+
└── libffmpeg.a
118+
```
119+
120+
## Phase 3: Update Existing Workflows
121+
122+
**Goal:** Modify ffmpeg.yml to NOT commit libraries to git
123+
124+
### Update FFmpeg Build Workflow
125+
126+
**File:** `.github/workflows/ffmpeg.yml`
127+
128+
**Changes:**
129+
1. Remove pull request creation step
130+
2. Libraries only built for validation, not committed
131+
3. Actual release happens via release.yml workflow
132+
133+
## Phase 4: Update Documentation
134+
135+
### Update README.md
136+
137+
**Add Installation Section:**
138+
139+
```markdown
140+
## Installation
141+
142+
go get github.com/linuxmatters/ffmpeg-statigo
143+
144+
**No additional steps required.** FFmpeg static libraries are automatically downloaded on first import.
145+
146+
### Manual Installation
147+
148+
If you need to download libraries manually:
149+
150+
# Download for your platform
151+
wget https://github.com/linuxmatters/ffmpeg-statigo/releases/download/v0.1.0/ffmpeg-linux-amd64.tar.gz
152+
153+
# Extract to lib directory
154+
tar -xzf ffmpeg-linux-amd64.tar.gz
155+
156+
# Verify checksum
157+
wget https://github.com/linuxmatters/ffmpeg-statigo/releases/download/v0.1.0/ffmpeg-linux-amd64.tar.gz.sha256
158+
sha256sum -c ffmpeg-linux-amd64.tar.gz.sha256
159+
160+
### Offline / Air-Gapped Environments
161+
162+
For environments without internet access:
163+
164+
1. Download libraries on a connected machine
165+
2. Transfer tarball to air-gapped environment
166+
3. Extract to `lib/` directory before building
167+
4. Set build tag: `go build -tags libffmpeg_bundled`
168+
169+
## Phase 5: Testing & Validation
170+
171+
### Pre-Release Testing Checklist
172+
173+
- [ ] Test automatic download on clean checkout
174+
175+
```bash
176+
cd /tmp
177+
git clone https://github.com/linuxmatters/ffmpeg-statigo.git
178+
cd ffmpeg-statigo
179+
go build ./examples/metadata
180+
# Should auto-download libraries
181+
```
182+
183+
- [ ] Test manual download instructions
184+
185+
```bash
186+
rm -rf lib/*/
187+
# Follow README manual download steps
188+
go build ./examples/metadata
189+
```
190+
191+
- [ ] Test checksum validation
192+
193+
```bash
194+
# Corrupt tarball and verify download fails
195+
```
196+
197+
- [ ] Test all platforms via GitHub Actions
198+
199+
```bash
200+
gh workflow run release.yml -f tag=v0.1.0-rc1
201+
```
202+
203+
- [ ] Test Go module import
204+
```bash
205+
cd /tmp/test-project
206+
go mod init test
207+
go get github.com/linuxmatters/ffmpeg-statigo@v0.1.0-rc1
208+
```
209+
210+
## Success Criteria
211+
212+
-`go get github.com/linuxmatters/ffmpeg-statigo` works without manual steps
213+
- ✅ Libraries automatically download on first import
214+
- ✅ No static libraries committed to git repository
215+
- ✅ Release workflow creates GitHub Release with all platform libraries
216+
- ✅ Checksums verify download integrity
217+
- ✅ Clear error messages if download fails
218+
- ✅ Manual fallback documented and tested
219+
- ✅ CI/CD workflows updated and tested
220+
- ✅ Documentation complete and accurate
221+
222+
---
223+
22224
# Onboard
23225

24226
This is a hard fork of the [ffmpeg-go](https://github.com/csnewman/ffmpeg-go) project, now called **ffmpeg-statigo**.

0 commit comments

Comments
 (0)