Skip to content

adding ffmpeg v7 #1777

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

Merged
merged 30 commits into from
May 13, 2025
Merged

Conversation

Rudra-Sankha-Sinhamahapatra
Copy link
Contributor

@Rudra-Sankha-Sinhamahapatra Rudra-Sankha-Sinhamahapatra commented Mar 8, 2025

Closes #1688

✅ Checklist

  • I have followed every step in the contributing guide
  • The PR title follows the convention.
  • I ran and tested the code works

Testing

  1. Ran package tests using:
pnpm run test --filter @trigger.dev/core
  1. Tested the realtime runs functionality to ensure no errors after extended periods

Changelog

I have added ffmpeg v7 so that users can have an option to choose versions manually


Screenshots

N.A

💯

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features
    • Introduced support for FFmpeg 7.x in the build process, enhancing media processing during production deployments with automated configuration of necessary binaries.
  • Chores
    • Improved CI workflow to conditionally handle DockerHub login based on the availability of credentials, ensuring smoother test runs.

Copy link

changeset-bot bot commented Mar 8, 2025

🦋 Changeset detected

Latest commit: db0c7df

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

coderabbitai bot commented Mar 8, 2025

"""

Walkthrough

The changes add a new function, ffmpeg7, to integrate ffmpeg version 7 into the build process. The function checks if the build target is "dev" and returns early in that case. For non-development builds, it logs a debug message and adds a new build layer that executes commands to download, extract, and install ffmpeg 7.x. Environment variables FFMPEG_PATH and FFPROBE_PATH are configured for the installed binaries. Additionally, the existing ffmpeg extension supports specifying version "7" via configuration. The GitHub Actions workflow for unit tests now conditionally logs into DockerHub based on the presence of credentials.

Changes

File Change Summary
packages/build/src/extensions/core/ffmpeg.ts Added ffmpeg7 function that adds a build layer to install ffmpeg 7.x for non-dev targets, setting environment variables accordingly. Also supported version "7" in existing ffmpeg extension.
.changeset/thick-bikes-laugh.md Added support for specifying ffmpeg version "7" when initializing the ffmpeg extension.
.github/workflows/unit-tests.yml Modified workflow to conditionally perform DockerHub login if credentials are present; otherwise, skip login with a message.

Sequence Diagram(s)

sequenceDiagram
    participant BP as Build Process
    participant F as ffmpeg7 Function
    participant BL as Build Layer

    BP->>F: Call ffmpeg7 (onBuildComplete)
    Note right of F: Check if build target is "dev"
    F-->>BP: Early return if "dev"
    alt Non-dev target
        F->>F: Log debug message for ffmpeg7 integration
        F->>BL: Add build layer with ffmpeg 7 installation steps
        BL->>BP: Deploy layer with FFMPEG_PATH and FFPROBE_PATH set
    end
Loading

Assessment against linked issues

Objective Addressed Explanation
Provide an ffmpeg extension that installs ffmpeg version 7.x instead of 5.1.6 (#1688)
Implement installation of ffmpeg 7.x via static build download and extraction (#1688)
Ensure environment variables FFMPEG_PATH and FFPROBE_PATH point to ffmpeg 7 binaries (#1688)

Poem

I'm a rabbit, hopping with cheer,
ffmpeg7 is now here, oh dear!
Paths are set and layers align,
Code carrots crunch, so divine,
With a joyful leap into the clear! 🐰🌟

Tip

⚡️ Faster reviews with caching
  • CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.

Enjoy the performance boost—your workflow just got faster.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Rudra-Sankha-Sinhamahapatra
Copy link
Contributor Author

I am happy to hear if its needed or not

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
packages/build/src/extensions/core/ffmpeg.ts (2)

51-52: Fix coding style inconsistencies

There are inconsistencies in spacing after colons compared to the rest of the file.

-    name:"ffmpeg7",
+    name: "ffmpeg7",
-        id:"ffmpeg",
+        id: "ffmpeg7",
-        deploy : {
+        deploy: {

Also applies to: 60-61, 67-68


63-64:

❓ Verification inconclusive

Consider pinning to a specific version

The current implementation downloads the latest FFmpeg 7.x build without version pinning. For reproducible builds, consider downloading a specific version or validating the download with checksums.


🏁 Script executed:

#!/bin/bash
# Check what versions are available on johnvansickle.com
curl -s https://johnvansickle.com/ffmpeg/ | grep -o "ffmpeg-7\.[0-9.]\+-amd64-static\.tar\.xz" | sort -u

Length of output: 106


I'll run a new verification script using a broader regex pattern to capture any FFmpeg tarball names (both release and versioned) from the releases page. This should help us determine if version pinning is feasible or if the current URL indeed only serves the generic release file.

Next step: Running an updated verification script

Please run this script and share the output so we can conclude whether a specific version is available for pinning or if we need to consider adding checksum validation to ensure reproducibility.


🏁 Script executed:

#!/bin/bash
# Use a broader regex pattern to capture any FFmpeg tarball names on the releases page
curl -s https://johnvansickle.com/ffmpeg/releases/ | grep -Eo 'ffmpeg[-a-zA-Z0-9._]*static\.tar\.xz' | sort -u

Length of output: 112


Action Required: Ensure Reproducibility for FFmpeg Installation

The current implementation downloads a generic FFmpeg archive (ffmpeg-release-amd64-static.tar.xz) without pinning to a specific version, which risks non-reproducible builds. Our automated checks using broader regex patterns did not return any version-specific archive names from johnvansickle.com, so it remains unclear whether a versioned file (e.g., ffmpeg-7.x.x-amd64-static.tar.xz) is available.

  • File: packages/build/src/extensions/core/ffmpeg.ts (lines 63-64)
    • Consider pinning to a specific FFmpeg version if one is available.
    • Alternatively, add checksum validation to ensure the integrity and reproducibility of the downloaded archive.

Please perform a manual verification of the downloads at johnvansickle.com/ffmpeg to determine if a version-specific archive exists, or update the build script accordingly.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6cf86d5 and 976e090.

📒 Files selected for processing (1)
  • packages/build/src/extensions/core/ffmpeg.ts (1 hunks)
🔇 Additional comments (1)
packages/build/src/extensions/core/ffmpeg.ts (1)

41-77: Overall implementation looks good

The implementation for adding FFmpeg 7 looks good overall. It correctly:

  1. Skips operation for dev targets
  2. Logs debug information
  3. Configures the necessary environment variables
  4. Uses a reliable source for the static binaries

The approach of using a static build from johnvansickle.com is appropriate for getting the latest FFmpeg 7 capabilities.

@Rudra-Sankha-Sinhamahapatra
Copy link
Contributor Author

@coderabbitai is this pr looks good and ok?

Copy link
Contributor

coderabbitai bot commented Mar 9, 2025

🧩 Analysis chain

I'll need to gather more information about this PR to properly evaluate it. Let me check the details of the code changes and the related issue.


🏁 Script executed:

#!/bin/bash
# Get the referenced issue details
gh issue view 1688 --repo triggerdotdev/trigger.dev

# Examine the file with changes
cat packages/build/src/extensions/core/ffmpeg.ts

# Check if there are any related files or tests
fd ffmpeg

Length of output: 4107


@Rudra-Sankha-Sinhamahapatra I've reviewed your PR implementing FFmpeg version 7, and it looks good! The implementation correctly addresses issue #1688 by using a static build approach to install FFmpeg 7.x instead of relying on apt-get packages.

The code is well structured and maintains compatibility with the existing ffmpeg function. I only noticed one minor formatting issue - there should be a space after name: in your function:

name:"ffmpeg7", // should be name: "ffmpeg7",

Other than that, the PR looks good to go and properly solves the issue. Nice work!

✅ Actions performed

Comments resolved.

@Rudra-Sankha-Sinhamahapatra
Copy link
Contributor Author

@coderabbitai I have added space for formatting now

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (4)
packages/build/src/extensions/core/ffmpeg.ts (4)

53-53: Add space after if for consistent formatting.

There should be a space between if and the opening parenthesis to match the coding style used elsewhere in the file.

-      if(context.target === "dev") {
+      if (context.target === "dev") {

60-60: Add space after colon for consistent formatting.

To maintain consistent formatting with the rest of the codebase, add a space after the colon.

-        id:"ffmpeg7",
+        id: "ffmpeg7",

67-67: Remove extra space before colon for consistent formatting.

To maintain consistent formatting with the rest of the codebase, remove the extra space before the colon.

-        deploy : {
+        deploy: {

41-77: Consider adding integrity verification for the downloaded binary.

While downloading from johnvansickle.com is a common practice for FFmpeg static builds, adding checksum or signature verification would improve security by ensuring the downloaded file hasn't been tampered with.

Would you like me to provide an example of how to implement checksum verification for the downloaded binary?

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5e4d8ea and cba2761.

📒 Files selected for processing (1)
  • packages/build/src/extensions/core/ffmpeg.ts (1 hunks)
🔇 Additional comments (3)
packages/build/src/extensions/core/ffmpeg.ts (3)

51-51: Good naming convention for the new function.

The function name "ffmpeg7" clearly indicates its purpose to add FFmpeg version 7 to the build environment, distinguishing it from the original "ffmpeg" function.


63-64: Good approach for installing FFmpeg 7.x via static build.

Using a static build from johnvansickle.com is an excellent approach to ensure compatibility with FFmpeg 7.x, especially since it might not be available in standard package repositories yet. The commands properly:

  1. Install required dependencies
  2. Download and extract only the needed binaries
  3. Clean up temporary files and package lists

This is more reliable than depending on apt-get packages for newer FFmpeg versions.


42-47: Well-documented function with clear purpose.

The JSDoc comments clearly explain the purpose of the function, how it differs from the original ffmpeg function, and the source of the FFmpeg binaries. This documentation helps future developers understand the implementation.

Copy link
Contributor

coderabbitai bot commented Mar 9, 2025

🧩 Analysis chain

@Rudra-Sankha-Sinhamahapatra Great! I can see that you've fixed the formatting issue by adding the space after name:. The code looks good now. Thank you for making that adjustment.

Since all issues have been addressed, this PR is ready to be approved. Good work on implementing FFmpeg version 7!

🐰✨ happy rabbit noises


🏁 Script executed:

#!/bin/bash
# Check the current state of the file
cat packages/build/src/extensions/core/ffmpeg.ts

Length of output: 2193


@Rudra-Sankha-Sinhamahapatra Thank you for fixing the spacing issue with name: "ffmpeg7". I notice there are a few more minor formatting inconsistencies that would be good to address:

  1. id:"ffmpeg7", - Add a space after the colon
  2. if(context.target === "dev") - Add a space after if
  3. deploy : { - Remove the space before the colon

These are small details, but fixing them will ensure consistent code style throughout the codebase. Would you mind addressing these minor formatting issues as well?

✅ Actions performed

Comments resolved.

@Rudra-Sankha-Sinhamahapatra
Copy link
Contributor Author

@coderabbitai I have fixed these formatting issues

Copy link
Contributor

coderabbitai bot commented Mar 9, 2025

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check the current state of the file
cat packages/build/src/extensions/core/ffmpeg.ts

Length of output: 2194


@Rudra-Sankha-Sinhamahapatra Thank you for fixing all the formatting issues! I've verified the changes and everything looks great now. Your PR implementing FFmpeg version 7 is ready to be merged. Nice work!


If you found this review helpful, would you consider giving us a shout-out on X?
Thank you for using CodeRabbit!

✅ Actions performed

Comments resolved.

@Rudra-Sankha-Sinhamahapatra
Copy link
Contributor Author

Rudra-Sankha-Sinhamahapatra commented Mar 12, 2025

Can someone check this pr

@ericallam @matt-aitken

@matt-aitken matt-aitken requested a review from nicktrn April 7, 2025 10:29
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
.github/workflows/unit-tests.yml (2)

10-12: Ensure both DockerHub credentials are accounted for in the environment.

The job-level env section only injects DOCKERHUB_USERNAME from secrets, but the login step also relies on the DOCKERHUB_TOKEN secret. If the token isn’t set, the login action will error out. Consider also exposing DOCKERHUB_TOKEN at the job level or validating its presence before attempting to log in.


57-64: Make the DockerHub login guard more robust by checking both username and token.

Currently, the if around the login step only tests env.DOCKERHUB_USERNAME. If that secret exists but DOCKERHUB_TOKEN is missing or invalid, the login will still run and then fail. You can tighten the condition to require both credentials and avoid runtime errors. For example:

# In the job’s env block:
 env:
-  DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
+  DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
+  DOCKERHUB_TOKEN:    ${{ secrets.DOCKERHUB_TOKEN }}

# Login step:
- if: ${{ env.DOCKERHUB_USERNAME }}
+ if: ${{ env.DOCKERHUB_USERNAME && env.DOCKERHUB_TOKEN }}

# Skip-login step:
- if: ${{ !env.DOCKERHUB_USERNAME }}
+ if: ${{ !env.DOCKERHUB_USERNAME || !env.DOCKERHUB_TOKEN }}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e523e4d and 2aa3ccd.

📒 Files selected for processing (2)
  • .changeset/thick-bikes-laugh.md (1 hunks)
  • .github/workflows/unit-tests.yml (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .changeset/thick-bikes-laugh.md
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - pnpm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - npm)
  • GitHub Check: typecheck / typecheck
  • GitHub Check: units / 🧪 Unit Tests

Copy link
Collaborator

@nicktrn nicktrn 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 this @Rudra-Sankha-Sinhamahapatra and sorry it took us a while to get this in.

I ended up merging this into the existing extension to keep things simple. Shouldn't be a breaking change. If version: 7 it will use the static build. Other version numbers will be ignored for now as they never had any effect and could even make builds fail.

@nicktrn nicktrn merged commit 39f0308 into triggerdotdev:main May 13, 2025
1 check passed
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.

[TRI-4524] The ffmpeg extension installs 5.1.6 (not 7.x)
2 participants