render: Make ffmpeg an optional dependency#591
Open
3v1n0 wants to merge 2 commits intocharmbracelet:mainfrom
Open
render: Make ffmpeg an optional dependency#5913v1n0 wants to merge 2 commits intocharmbracelet:mainfrom
3v1n0 wants to merge 2 commits intocharmbracelet:mainfrom
Conversation
As per commit 92db33b ffmpeg is not required anymore by VHS unless some rendering is enabled. For example we only use VHS as a testing tool and we rely on text output only, so having the whole ffmpeg installed isn't required. So do this check at rendering time instead of as a pre-requisite
2 tasks
caarlos0
reviewed
Mar 28, 2025
| } | ||
|
|
||
| func checkFFMpegDependency() error { | ||
| haveFFMpegOnce.Do(func() { |
Comment on lines
+236
to
+238
| if err := checkFFMpegDependency(); err != nil { | ||
| return err | ||
| } |
Member
There was a problem hiding this comment.
could move this before the for loop, then the sync.Once stuff isn't even needed.
coudl copy the if from main.go:309 there and that's it I think 🤔
There was a problem hiding this comment.
Pull Request Overview
This PR makes the ffmpeg dependency optional by deferring its check to rendering time, allowing users relying solely on text output to avoid installing ffmpeg. Key changes include:
- Adding a runtime ffmpeg dependency check in the Render method.
- Removing the global ffmpeg dependency check from ensureDependencies in main.go.
- Introducing a cached ffmpeg dependency check function in ffmpeg.go.
- Updating README.md to reflect that ffmpeg is optional if text output is used.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| vhs.go | Added a runtime dependency check for ffmpeg during rendering. |
| main.go | Removed the mandatory ffmpeg dependency check at startup. |
| ffmpeg.go | Introduced a cached checkFFMpegDependency function. |
| README.md | Updated installation instructions to clarify optional use. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As per commit 92db33b ffmpeg is not required anymore by VHS unless some rendering is enabled.
For example we only use VHS as a testing tool and we rely on text output only, so having the whole ffmpeg installed isn't required.
So do this check at rendering time instead of as a pre-requisite