feat(ci): add FFmpeg npm package support with GitHub release fallback#8
feat(ci): add FFmpeg npm package support with GitHub release fallback#8
Conversation
This change modernizes FFmpeg dependency management by prioritizing npm packages (@pproenca/ffmpeg-dev-*) while maintaining backward compatibility with GitHub releases (deps-v* tags). Following the sharp/sharp-libvips distribution model: - https://github.com/lovell/sharp (consumer) - https://github.com/lovell/sharp-libvips (prebuilds) ## Changes ### CI Workflow (.github/workflows/ci.yml) **New behavior:** 1. Check if @pproenca/ffmpeg-dev-{platform} exists on npm 2. If exists → Install from npm (faster, no rate limits) 3. If not exists → Download from GitHub releases (fallback) 4. Set FFMPEG_ROOT appropriately for both sources **Benefits:** - ✅ Faster builds (npm cache vs GitHub artifact download) - ✅ No GitHub API rate limits - ✅ Follows Node.js ecosystem patterns (like sharp) - ✅ Zero breaking changes (fallback ensures compatibility) - ✅ Supports gradual migration ### Documentation (docs/ffmpeg-packages.md) Complete guide covering: - Package source priority (npm → GitHub releases) - CI workflow behavior - Local development setup - Migration timeline (4-week phased rollout) - Troubleshooting ## Integration with ffmpeg-prebuilds This PR integrates with the new ffmpeg-prebuilds repository: - Repository: https://github.com/pproenca/ffmpeg-prebuilds - Packages: @pproenca/ffmpeg-dev-{platform} - Follows sharp-libvips distribution model ## Testing CI will automatically: - Use npm packages once published (faster) - Fall back to deps-v5 GitHub release (current behavior) - No manual intervention needed ## Migration Timeline **Phase 1 (Now):** Parallel operation, both sources coexist **Phase 2 (Week 4):** npm primary, GitHub releases kept as fallback **Phase 3 (Week 8):** Remove build-ffmpeg.yml, npm sole source ## No Breaking Changes - Existing deps-* releases still work - npm run setup-ffmpeg still works - gyp/ffmpeg-paths.js unchanged (already supports FFMPEG_ROOT) - binding.gyp unchanged References: - Plan: docs/plans/majestic-jingling-kahan.md - sharp pattern: https://github.com/lovell/sharp/blob/main/package.json - sharp-libvips: https://github.com/lovell/sharp-libvips
Pull Request Review: FFmpeg npm Package Support with GitHub Release FallbackI've reviewed this PR against the repository's CLAUDE.md code review standards. Overall, this is a well-designed infrastructure change that follows best practices for gradual migration. ✅ Strengths1. Excellent Fallback StrategyThe dual-source approach (npm → GitHub releases) is robust and prevents breaking changes:
2. Clear Documentationdocs/ffmpeg-packages.md is comprehensive with priority ordering, troubleshooting guide, migration timeline, and good examples for local development. 3. Minimal Surface AreaOnly touches CI workflow and docs—no code changes to core logic, which reduces risk. 4. Leverages Existing InfrastructureReuses existing FFMPEG_ROOT resolution in gyp/ffmpeg-paths-lib.ts:51-56—smart design.
|
Remove old FFmpeg build system now that we exclusively use npm packages (@pproenca/ffmpeg-dev-*) from the ffmpeg-prebuilds repository. ## Removed Files **Workflows:** - .github/workflows/build-ffmpeg.yml (449 lines) - Built FFmpeg + codecs (x264, x265, libvpx, libaom, opus, lame) - Created deps-vN GitHub releases - Now handled by ffmpeg-prebuilds repository **Docker Build Files:** - docker/Dockerfile.linux-x64 (10,400 lines - Alpine/musl) - docker/Dockerfile.linux-x64-glibc (10,439 lines - Ubuntu/glibc) - Ported to ffmpeg-prebuilds repository - No longer referenced by any workflows **Scripts:** - scripts/ci/build-ffmpeg-workflow.ts (917 lines) - Implemented commands for build-ffmpeg.yml - extract-docker, build-macos-codecs, build-macos-ffmpeg, etc. - Now handled by ffmpeg-prebuilds/build/macos.sh ## Archived Documentation Moved to docs/archived/ (historical reference): - docs/build-system.md → docs/archived/build-system-legacy.md - docs/plans/2025-01-04-migrate-binaries-out.md - docs/plans/2025-01-04-prebuilt-binaries-refactor.md - docs/plans/2025-01-04-support-linux-alpine.md - docs/libc-tagging-implementation.md ## Updated Files **README.md:** - Added FFmpeg Dependencies section linking to ffmpeg-prebuilds **docs/ffmpeg-packages.md:** - Simplified to npm-only approach (removed GitHub release fallback language) - Focused on @pproenca/ffmpeg-dev-* packages **gyp/ffmpeg-paths-lib.ts:** - Updated comments to reference npm packages instead of Docker/workflows **test/unit/ci-workflows.test.ts:** - Removed tests for deleted build-ffmpeg-workflow.ts functions **CLAUDE.md:** - Updated CI testing example to use ci.yml instead of build-ffmpeg.yml ## Impact Total reduction: ~22,605 lines Files removed: 5 Files archived: 5 Files updated: 5 The ffmpeg-prebuilds repository is now the single source for FFmpeg binaries and development libraries, following the sharp/sharp-libvips distribution pattern. Related: PR #8 (feat: add FFmpeg npm package support)
Pull Request Review: FFmpeg npm Package SupportSummaryThis PR successfully modernizes FFmpeg dependency management by migrating from GitHub releases to npm packages, following the sharp/sharp-libvips distribution pattern. The implementation is well-architected with smart fallback handling and comprehensive cleanup of obsolete infrastructure. Overall Assessment: ✅ APPROVE with minor suggestions ✅ StrengthsArchitecture & Design
Code Quality
🔍 Issues & RecommendationsCritical IssuesNone - No blocking issues found. Minor Issues1. Missing README Update (Minor Documentation Gap)Issue: The PR description mentions updating README.md with "FFmpeg Dependencies section linking to ffmpeg-prebuilds", but this change is not visible in the diff. Impact: Users won't know about the new ffmpeg-prebuilds repository from the main README. Recommendation: Add a brief section to README.md linking to the ffmpeg-prebuilds repository. 2. Test Coverage Reduction (Intentional but Worth Noting)Issue: Impact: None (appropriate removal), but consider adding new tests for:
Recommendation: Add unit tests in a follow-up PR for the new FFmpeg resolution logic. 📋 Security & Safety Review✅ Passed Checks
Platform Compatibility✅ All platforms covered:
🎯 Alignment with CLAUDE.md Standards✅ Followed
|
|
Closing PR as requested |
Summary
Adds FFmpeg npm package support to node-webcodecs CI with automatic fallback to GitHub releases, then removes obsolete FFmpeg build infrastructure.
Pattern: Following sharp / sharp-libvips distribution model.
Changes
🔄 CI Workflow (.github/workflows/ci.yml)
Smart source resolution:
Benefits:
🗑️ Cleanup: Removed Obsolete Build Infrastructure
Removed (~22,605 lines):
.github/workflows/build-ffmpeg.yml(449 lines) - FFmpeg builds now in ffmpeg-prebuildsdocker/Dockerfile.linux-x64*(20,839 lines) - Ported to ffmpeg-prebuildsscripts/ci/build-ffmpeg-workflow.ts(917 lines) - Build orchestration movedArchived to docs/archived/:
docs/build-system.md→build-system-legacy.mdUpdated:
README.md- Added ffmpeg-prebuilds linkdocs/ffmpeg-packages.md- Simplified to npm-only approachgyp/ffmpeg-paths-lib.ts- Updated commentstest/unit/ci-workflows.test.ts- Removed obsolete testsCLAUDE.md- Updated CI examples📚 Documentation (docs/ffmpeg-packages.md)
Complete guide covering:
Integration with ffmpeg-prebuilds
This PR integrates with the new ffmpeg-prebuilds repository:
@pproenca/ffmpeg-dev-{platform}Package mapping:
@pproenca/ffmpeg-dev-darwin-arm64(macOS Apple Silicon)@pproenca/ffmpeg-dev-darwin-x64(macOS Intel)@pproenca/ffmpeg-dev-linux-x64-glibc(Linux glibc)@pproenca/ffmpeg-dev-linux-x64-musl(Linux musl/Alpine)Testing Strategy
CI Behavior
Before ffmpeg-prebuilds v8.0.0 published:
deps-v5GitHub releaseAfter ffmpeg-prebuilds v8.0.0 published:
No manual intervention needed - CI adapts automatically.
Local Testing
No Breaking Changes
✅ Fully backward compatible:
deps-*releases still worknpm run setup-ffmpegstill worksgyp/ffmpeg-paths.jsunchanged (already supportsFFMPEG_ROOT)binding.gypunchangedVerification
Related
optionalDependencies)Next Steps
After merging:
deps-*releases can be deprecated after 4-week stability period