trigger.dev icon indicating copy to clipboard operation
trigger.dev copied to clipboard

adding ffmpeg v7

Open Rudra-Sankha-Sinhamahapatra opened this issue 10 months ago • 10 comments

Closes #1688

✅ Checklist

  • [x] I have followed every step in the contributing guide
  • [x] The PR title follows the convention.
  • [x] 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

  • New Features
    • Introduced support for FFmpeg 7.x in the build process, enhancing media processing during production deployments with automated configuration of necessary binaries.

🦋 Changeset detected

Latest commit: db0c7df5e234e8c302cbfe79593c15d7ac8b55cf

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

changeset-bot[bot] avatar Mar 08 '25 22:03 changeset-bot[bot]

"""

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

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.

coderabbitai[bot] avatar Mar 08 '25 22:03 coderabbitai[bot]

I am happy to hear if its needed or not

@coderabbitai is this pr looks good and ok?

🧩 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!

:white_check_mark: Actions performed

Comments resolved.

coderabbitai[bot] avatar Mar 09 '25 09:03 coderabbitai[bot]

@coderabbitai I have added space for formatting now

🧩 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?

:white_check_mark: Actions performed

Comments resolved.

coderabbitai[bot] avatar Mar 09 '25 09:03 coderabbitai[bot]

@coderabbitai I have fixed these formatting issues

🧩 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!

:white_check_mark: Actions performed

Comments resolved.

coderabbitai[bot] avatar Mar 09 '25 10:03 coderabbitai[bot]

Can someone check this pr

@ericallam @matt-aitken