Skip to content

Update FFmpeg 7.0.1 #2287

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 1 commit into from
Jun 24, 2024
Merged

Update FFmpeg 7.0.1 #2287

merged 1 commit into from
Jun 24, 2024

Conversation

VietND96
Copy link
Member

@VietND96 VietND96 commented Jun 24, 2024

User description

Thanks for contributing to the Docker-Selenium project!
A PR well described will help maintainers to quickly review and merge it

Before submitting your PR, please check our contributing guidelines, applied for this repository.
Avoid large PRs, help reviewers by making them as simple and short as possible.

Description

Motivation and Context

Upgrade based image of video container to FFmpeg 7.0.1 (includes Ubuntu LTS 24.04)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the contributing document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

PR Type

Enhancement, Tests, Configuration changes


Description

  • Enhanced shutdown process to wait for ffmpeg and rclone processes.
  • Improved video recording and stopping mechanism, including a new stop_ffmpeg function and increased ffmpeg thread count.
  • Enhanced GraphQL query reliability and video file naming.
  • Updated FFmpeg version to 7.0.1 and added FFMPEG_TAG_PREV_VERSION variable.
  • Updated base image to Ubuntu 24.04 LTS.
  • Simplified deployment and nightly build conditions in GitHub Actions.
  • Changed commands in various Docker Compose files to use /bin/bash -c for bootstrap.sh.

Changes walkthrough 📝

Relevant files
Enhancement
3 files
entry_point.sh
Enhance shutdown process to wait for `ffmpeg` and `rclone`

Video/entry_point.sh

  • Added wait commands for ffmpeg and rclone processes during shutdown.
  • +2/-0     
    video.sh
    Improve video recording and stopping mechanism                     

    Video/video.sh

  • Introduced stop_ffmpeg function to gracefully stop ffmpeg.
  • Modified stop_recording to use stop_ffmpeg.
  • Changed ffmpeg thread count from 1 to 2.
  • Added --noproxy "*" to curl commands.
  • +20/-6   
    video_graphQLQuery.sh
    Enhance GraphQL query reliability and video file naming   

    Video/video_graphQLQuery.sh

  • Added loop to retry GraphQL query until capabilities are found.
  • Added --noproxy "*" to curl command.
  • Improved handling of video file name and session ID.
  • +20/-5   
    Configuration changes
    9 files
    update_tag_in_docs_and_files.sh
    Update FFmpeg tag version in documentation and files         

    update_tag_in_docs_and_files.sh

    • Added command to update FFMPEG_TAG_PREV_VERSION in files.
    +4/-0     
    deploy.yml
    Simplify deployment condition in GitHub Actions                   

    .github/workflows/deploy.yml

    • Simplified if condition for deployment.
    +1/-1     
    nightly.yml
    Simplify nightly build condition in GitHub Actions             

    .github/workflows/nightly.yml

    • Simplified if condition for nightly build.
    +1/-1     
    Makefile
    Update FFmpeg version to 7.0.1                                                     

    Makefile

  • Updated FFmpeg version to 7.0.1.
  • Added FFMPEG_TAG_PREV_VERSION variable.
  • +3/-2     
    Dockerfile
    Update base image to Ubuntu 24.04 LTS                                       

    Video/Dockerfile

    • Updated Ubuntu version from jammy to noble.
    +3/-3     
    docker-compose-v3-test-node-docker.yaml
    Use `/bin/bash -c` for bootstrap command                                 

    tests/docker-compose-v3-test-node-docker.yaml

    • Changed command to use /bin/bash -c for bootstrap.sh.
    +1/-1     
    docker-compose-v3-test-node-relay.yml
    Use `/bin/bash -c` for bootstrap command                                 

    tests/docker-compose-v3-test-node-relay.yml

    • Changed command to use /bin/bash -c for bootstrap.sh.
    +1/-1     
    docker-compose-v3-test-parallel.yml
    Use `/bin/bash -c` for bootstrap command                                 

    tests/docker-compose-v3-test-parallel.yml

    • Changed command to use /bin/bash -c for bootstrap.sh.
    +1/-1     
    docker-compose-v3-test-video.yml
    Use `/bin/bash -c` for bootstrap command and add sleep     

    tests/docker-compose-v3-test-video.yml

  • Changed command to use /bin/bash -c for bootstrap.sh and added sleep.
  • +1/-1     

    💡 PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    Signed-off-by: Viet Nguyen Duc <nguyenducviet4496@gmail.com>
    Copy link
    Contributor

    PR Reviewer Guide 🔍

    ⏱️ Estimated effort to review [1-5] 4
    🧪 Relevant tests No
    🔒 Security concerns - Sensitive Information Exposure:
    The use of `--noproxy "*"` in curl commands might bypass important proxy configurations, potentially exposing sensitive requests directly to the internet.
    ⚡ Key issues to review Possible Bug:
    The use of wait with pgrep in the entry_point.sh script might not handle process termination correctly if the processes do not exist, potentially leading to hanging scripts.
    Resource Management:
    The stop_ffmpeg function in video.sh uses a loop to kill and wait for the ffmpeg process. This could be optimized to avoid potential infinite loops or excessive delays in process termination.
    Security Concern:
    The use of -k in curl commands across various scripts disables SSL certificate verification, which might expose the system to man-in-the-middle attacks. Consider handling SSL certificates more securely.
    Performance Concern:
    Increasing the number of threads for ffmpeg from 1 to 2 in video.sh might not be optimal without benchmarks to justify the change, especially on systems with limited resources.

    Copy link
    Contributor

    PR Code Suggestions ✨

    CategorySuggestion                                                                                                                                    Score
    Best practice
    Use $() instead of backticks for command substitution

    Using backticks for command substitution is deprecated. It's better to use $() for command
    substitution to improve readability and avoid potential issues.

    Video/entry_point.sh [20-21]

    -wait `pgrep -f ffmpeg | tr '\n' ' '`
    -wait `pgrep -f rclone | tr '\n' ' '`
    +wait $(pgrep -f ffmpeg | tr '\n' ' ')
    +wait $(pgrep -f rclone | tr '\n' ' ')
     
    • Apply this suggestion
    Suggestion importance[1-10]: 8

    Why: The suggestion correctly identifies and fixes deprecated syntax with a modern alternative, improving readability and reducing potential issues.

    8
    Use pkill -F to kill the supervisor process by its PID file

    In the graceful_exit function, consider using pkill -F to kill the supervisor process by
    its PID file, which is more readable and less error-prone.

    Video/video.sh [132]

    -kill -SIGTERM "$(cat /var/run/supervisor/supervisord.pid)"
    +pkill -F /var/run/supervisor/supervisord.pid -SIGTERM
     
    • Apply this suggestion
    Suggestion importance[1-10]: 7

    Why: The suggestion improves readability and reduces error-proneness by using pkill -F instead of kill with a subshell command to read the PID.

    7
    Performance
    Combine redundant pgrep checks in the stop_ffmpeg function

    The stop_ffmpeg function can be optimized by combining the two pgrep checks into a single
    loop iteration, reducing redundancy and improving performance.

    Video/video.sh [93-99]

     if [ -n "$FFMPEG_PID" ]; then
       kill -SIGTERM $FFMPEG_PID
       wait $FFMPEG_PID
    -fi
    -if ! pgrep -f ffmpeg > /dev/null; then
    -    break
    +else
    +  break
     fi
     
    • Apply this suggestion
    Suggestion importance[1-10]: 6

    Why: The suggestion correctly identifies an optimization in the loop to reduce redundancy, although the impact on overall performance might be limited.

    6
    Possible issue
    Wrap the session ID in double quotes in the GraphQL query to avoid issues with special characters

    To avoid potential issues with special characters in the session ID, consider wrapping the
    session ID in double quotes when using it in the GraphQL query.

    Video/video_graphQLQuery.sh [21]

    ---data '{"query":"{ session (id: \"'${SESSION_ID}'\") { id, capabilities, startTime, uri, nodeId, nodeUri, sessionDurationMillis, slot { id, stereotype, lastStarted } } } "}'
    +--data "{\"query\":\"{ session (id: \\\"${SESSION_ID}\\\") { id, capabilities, startTime, uri, nodeId, nodeUri, sessionDurationMillis, slot { id, stereotype, lastStarted } } } \"}"
     
    • Apply this suggestion
    Suggestion importance[1-10]: 5

    Why: The suggestion addresses a potential issue with special characters in session IDs, but the existing code already correctly handles the session ID in double quotes.

    5

    @VietND96 VietND96 merged commit 0424655 into SeleniumHQ:trunk Jun 24, 2024
    14 checks passed
    @VietND96 VietND96 added this to the 4.23 milestone Jul 19, 2024
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    1 participant