Skip to content
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

Pin FFmpeg version to 7.0 #286

Merged
merged 1 commit into from
Oct 4, 2024
Merged

Pin FFmpeg version to 7.0 #286

merged 1 commit into from
Oct 4, 2024

Conversation

MartelliEnrico
Copy link
Contributor

@MartelliEnrico MartelliEnrico commented Oct 2, 2024

With the latest version of Ffmpeg the duration of transcoded videos has changed, breaking some tests.

Copy link
Contributor

coderabbitai bot commented Oct 2, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

The changes in this pull request involve updates to the MediaHelperTest class, where the expected duration values for three video conversion test cases have been modified. The tests affected are convertShortAndLowFpsVideo, convertVerticalWebmVideo, and convertGifVideo, with their expected durations adjusted to reflect more accurate outcomes. Additionally, the workflow configuration in .github/workflows/unit-test.yml has been updated to specify the ffmpeg version and reformat certain parameters. The Dockerfile has also been modified to specify the ffmpeg version during the build process.

Changes

File Path Change Summary
src/test/java/com/github/stickerifier/stickerify/media/MediaHelperTest.java Updated expected duration values for three test cases: convertShortAndLowFpsVideo (from 1_000L to 900L), convertVerticalWebmVideo (from 2_000L to 1_970L), and convertGifVideo (from 1_000L to 900L).
.github/workflows/unit-test.yml Updated Setup FFmpeg to specify ffmpeg-version: '7.0.2' and reformatted parameters to use single quotes.
Dockerfile Updated FROM mwader/static-ffmpeg to FROM mwader/static-ffmpeg:7.0.2 for version specificity.

Sequence Diagram(s)

sequenceDiagram
    participant Tester
    participant MediaHelper

    Tester->>MediaHelper: Run convertShortAndLowFpsVideo
    MediaHelper->>Tester: Return duration (900L)

    Tester->>MediaHelper: Run convertVerticalWebmVideo
    MediaHelper->>Tester: Return duration (1_970L)

    Tester->>MediaHelper: Run convertGifVideo
    MediaHelper->>Tester: Return duration (900L)
Loading

Possibly related PRs

  • Divide custom exception into specific ones #261: The changes in MediaHelperTest.java regarding the assertion of exceptions align with the modifications in MediaHelper.java, where exception handling was refined to use MediaException instead of TelegramApiException.
  • Produce lossless WebP images #265: The updates in MediaHelper.java to handle WebP images directly relate to the changes in MediaHelperTest.java, which also involve testing the handling of WebP images, indicating a direct connection in functionality.
  • Test current animated WebP behaviour #275: The modifications in MediaHelperTest.java to test animated WebP images are directly related to the changes in MediaHelper.java, which also involve handling WebP images, thus ensuring that the tests reflect the new functionality introduced in the main PR.

Suggested labels

unit test, dependencies

Poem

🐇 In the land of tests, where videos play,
Durations adjusted, in a precise way.
From a thousand to nine hundred, they now align,
With each little change, our code will shine!
Hopping along, with each test we run,
Celebrating accuracy, oh what fun! 🎉


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between fb0d7c1 and f3dff0a.

📒 Files selected for processing (2)
  • .github/workflows/unit-test.yml (2 hunks)
  • Dockerfile (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .github/workflows/unit-test.yml
🔇 Additional comments (2)
Dockerfile (2)

Line range hint 1-21: Summary: Effective solution to ffmpeg regression

The change in this Dockerfile effectively addresses the reported regression with ffmpeg 7.1 by pinning the version to 7.0.2. This targeted modification is an appropriate solution to the specific issue described in the PR objectives.

The rest of the Dockerfile remains unchanged, maintaining its well-structured multi-stage build process. This approach minimises the risk of introducing new issues while solving the immediate problem.

To further improve this PR:

  1. Consider adding a brief comment explaining the reason for using ffmpeg 7.0.2 specifically.
  2. Update the project documentation to reflect this change, if necessary.
  3. Create a plan for monitoring future ffmpeg releases to ensure timely updates when the regression in 7.1 is resolved.

18-18: Approval: Good fix, but let's verify the solution

The change to pin the ffmpeg version to 7.0.2 is a sensible approach to address the regression introduced by ffmpeg 7.1. This should resolve the issues with video duration and failing tests.

However, to ensure the fix is complete:

  1. Please confirm that all tests now pass with this change.
  2. It would be beneficial to add a comment explaining why this specific version is used, to prevent accidental updates in the future.

To verify if this change resolves the issue, please run the following script:


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 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.

@MartelliEnrico MartelliEnrico added the hacktoberfest The issue is suitable for Hacktoberfest label Oct 2, 2024
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

🧹 Outside diff range and nitpick comments (1)
src/test/java/com/github/stickerifier/stickerify/media/MediaHelperTest.java (1)

207-207: Precise adjustment to expected video duration is appropriate.

The change from 2000L to 1970L milliseconds for the expected duration in the convertVerticalWebmVideo test is a good adjustment to align with Ffmpeg 7.1's output. This precise tuning demonstrates attention to detail and should help prevent false negatives in the test.

Consider adding a comment explaining why this specific duration (1970L) was chosen. This could help future maintainers understand the reasoning behind this precise value. For example:

// 1970L: Precise duration after conversion with Ffmpeg 7.1
assertVideoConsistency(result, 288, 512, 30F, 1970L);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 12d5562 and fb0d7c1.

📒 Files selected for processing (1)
  • src/test/java/com/github/stickerifier/stickerify/media/MediaHelperTest.java (2 hunks)
🔇 Additional comments (3)
src/test/java/com/github/stickerifier/stickerify/media/MediaHelperTest.java (3)

Line range hint 1-391: Summary of changes

The modifications in this file consistently adjust the expected durations in video conversion tests to accommodate the behaviour changes in Ffmpeg 7.1. These changes appear to comprehensively address the regression issue mentioned in the PR objectives.

Key points:

  1. Short video durations have been reduced from 1000L to 900L milliseconds.
  2. A precise adjustment was made for the vertical video test (2000L to 1970L milliseconds).
  3. The changes are consistent across different video types (WebM, GIF).

These adjustments should resolve the failing tests caused by the Ffmpeg 7.1 update. The approach taken seems systematic and well-considered.


191-191: Adjustment to expected video duration looks appropriate.

The change from 1000L to 900L milliseconds for the expected duration in the convertShortAndLowFpsVideo test appears to be a necessary adjustment to accommodate the behaviour of Ffmpeg 7.1. This modification aligns with the PR objective of fixing the regression.

To ensure this change is consistent across the codebase, please run the following script:

This will help identify any other tests that might require similar adjustments.


215-215: Consistent adjustment to expected GIF video duration.

The change from 1000L to 900L milliseconds for the expected duration in the convertGifVideo test is consistent with the earlier adjustment in the convertShortAndLowFpsVideo test. This consistency suggests a systematic change in Ffmpeg 7.1's behaviour for short video conversions.

To ensure this change is applied consistently, please run the following script:

This will help verify that all relevant tests have been updated consistently and identify any tests that might have been overlooked.

✅ Verification successful

Consistent adjustment to expected GIF video duration verified.

All relevant assertVideoConsistency method calls in MediaHelperTest.java have been updated to use 900L for expectedDuration. No instances of 1000L remain.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for consistent duration changes across different video types.

echo "Checking for 900L durations:"
rg --type java '900L.*expectedDuration' src/test/java

echo "\nChecking for remaining 1000L durations that might need updating:"
rg --type java '1000L.*expectedDuration' src/test/java

Length of output: 322


Script:

#!/bin/bash
# Description: Check for expectedDuration assignments in test files with flexible spacing.

echo "Searching for 'expectedDuration' set to 900L:"
rg --type java 'expectedDuration\s*=\s*900L' src/test/java

echo "\nSearching for 'expectedDuration' set to 1000L:"
rg --type java 'expectedDuration\s*=\s*1000L' src/test/java

echo "\nListing all 'expectedDuration' assignments:"
rg --type java 'expectedDuration\s*=\s*\d+L' src/test/java

Length of output: 510


Script:

#!/bin/bash
# Description: List all 'expectedDuration' assignments and usages in test files.

echo "Listing all 'expectedDuration' assignments and usages:"
rg --type java 'expectedDuration' src/test/java

Length of output: 607


Script:

#!/bin/bash
# Description: Find all calls to assertVideoConsistency and display their expectedDuration arguments.

echo "Listing all 'assertVideoConsistency' method calls with their arguments:"
rg --type java 'assertVideoConsistency\s*\(' src/test/java | grep -oP 'assertVideoConsistency\s*\([^)]*\)'

Length of output: 773

@MartelliEnrico MartelliEnrico force-pushed the fix-ffmpeg-7.1-regression branch from fb0d7c1 to f3dff0a Compare October 4, 2024 07:21
@rob93c rob93c changed the title Fix Ffmpeg 7.1 regression Pin FFmpeg version to 7.0 Oct 4, 2024
@rob93c rob93c added the cicd The change affects CI/CD flows label Oct 4, 2024
@rob93c rob93c added the docker This marks issues revolving around Docker label Oct 4, 2024
@rob93c rob93c merged commit 8313c40 into main Oct 4, 2024
6 checks passed
@rob93c rob93c deleted the fix-ffmpeg-7.1-regression branch October 4, 2024 12:49
@coderabbitai coderabbitai bot mentioned this pull request Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cicd The change affects CI/CD flows docker This marks issues revolving around Docker hacktoberfest The issue is suitable for Hacktoberfest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants