Skip to content

render: Make ffmpeg an optional dependency #591

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

3v1n0
Copy link

@3v1n0 3v1n0 commented Feb 28, 2025

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

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
@3v1n0 3v1n0 requested a review from a team as a code owner February 28, 2025 16:02
@3v1n0 3v1n0 requested review from bashbunni and removed request for a team February 28, 2025 16:02
Copy link
Member

@caarlos0 caarlos0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the pr!

@@ -16,6 +23,16 @@ type FilterComplexBuilder struct {
prevStageName string
}

func checkFFMpegDependency() error {
haveFFMpegOnce.Do(func() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could use sync.OnceValue

Comment on lines +236 to +238
if err := checkFFMpegDependency(); err != nil {
return err
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 🤔

@caarlos0 caarlos0 requested a review from Copilot March 28, 2025 12:48
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants