Skip to content

[build-tools] Look up ffmpeg on PATH instead of running it - #4582

Merged
gwdp merged 1 commit into
mainfrom
gwdp/ffmpeg-path-check
Oct 9, 2026
Merged

gwdp merged 1 commit into
mainfrom
gwdp/ffmpeg-path-check

Conversation

@gwdp

@gwdp gwdp commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Why

Follow-up to #4577. That PR made the Appium step wait for the ffmpeg setup before Appium starts, so iOS recording works on images without ffmpeg. Images that already ship ffmpeg should not pay for that setup.

The setup checks for ffmpeg by running ffmpeg -version and waits for it. On macos-tahoe-26.6-xcode-27.1, which ships Homebrew ffmpeg-full, the first run on a fresh VM took 12.8 s in one probe and 23.7 s in another while the binary loads its 83 libraries. Later runs take 0.06 s. The Android session host waits for the same check.

How

  • Find ffmpeg on the step's PATH without running it: the first entry that is an executable file. An empty entry means the current directory, as it does for spawn. Device-session tools, such as XCUITest's screen recording, resolve ffmpeg the same way.
  • When ffmpeg is on PATH, or after an install, run ffmpeg -version once in the background and do not wait for it. The binary then loads while Appium installs, so the first recording does not pay the cold start. A failed warm-up is ignored.

LLM Authorship

  • Gabe asked to remove the cold ffmpeg -version from the session setup on the Xcode 27.1 image, and chose the PATH lookup with a background warm-up. Claude Code wrote the change.
  • AI review found that empty PATH entries were skipped. They now resolve to the current directory, and a test covers it.
  • A second AI review noted that an executable ffmpeg that cannot start passes the lookup. This is a known tradeoff, explained in the review thread.
  • Gabe reviewed the final diff and can answer questions.

Test Plan

  • EAS workflow on macos-tahoe-26.6-xcode-27.1: the first ffmpeg -version took 12.76 s, and the next two took 0.06 s and 0.07 s.

  • EAS workflow on the same image: a background ffmpeg -version started with the Appium install took 23.7 s and finished before the Appium install did (36.1 s).

  • build-tools unit tests in src/steps: 1337 passed. The ffmpeg tests build PATH in Jest's in-memory file system. They cover an executable on PATH, a file that is not executable, a directory named ffmpeg, an empty PATH entry, the Homebrew and apt installs, and warm-ups that reject or throw.

  • The same lookup on a real macOS file system found /opt/homebrew/bin/ffmpeg, which is a relative symlink into the Homebrew Cellar. The in-memory file system cannot test symlinks, because it checks the link's own mode.

  • yarn build, tsc, oxlint, and oxfmt are clean.

  • EAS workflow on the session runner classes: this branch's built build-tools ran next to the deployed worker's dist, and called ensureFfmpegInstalledOnceAsync. The control ran the deployed version.

    Image Setup returned Warm-up done Next ffmpeg -version
    macos-tahoe-26.6-xcode-27.1, deployed (control) 12.77 s – 0.05 s
    macos-tahoe-26.6-xcode-27.1, this branch 0.16 s 12.01 s 0.06 s
    macos-tahoe-26.5-xcode-26.6, this branch (Homebrew install) 8.30 s 10.34 s 0.03 s
    ubuntu-26.04-jdk-17-ndk-r27b-sdk-58, this branch 0.27 s 0.68 s 0.05 s
  • Not run: a hosted session with this branch deployed.

Generated with T3 Code, using Claude Code.

@gwdp
gwdp force-pushed the gwdp/ffmpeg-path-check branch 2 times, most recently from d2c88e7 to c9860c6 Compare October 8, 2026 23:34
@codecov

codecov Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.92%. Comparing base (800a0e0) to head (0e2fdfb).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4582      +/-   ##
==========================================
+ Coverage   73.92%   73.92%   +0.01%     
==========================================
  Files        1012     1012              
  Lines       49330    49346      +16     
  Branches    10650    10656       +6     
==========================================
+ Hits        36460    36476      +16     
  Misses      11878    11878              
  Partials      992      992              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@gwdp
gwdp force-pushed the gwdp/ffmpeg-path-check branch from c9860c6 to dd6102c Compare October 8, 2026 23:54
@gwdp

This comment has been minimized.

@devin-ai-integration

This comment has been minimized.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

Devin Review

@gwdp
gwdp requested a review from szdziedzic October 9, 2026 00:05
@gwdp
gwdp marked this pull request as ready for review October 9, 2026 00:05

@szdziedzic szdziedzic left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

awesome

The first run of the preinstalled ffmpeg-full on
macos-tahoe-26.6-xcode-27.1 takes about 13 s while it loads its
libraries, and the ffmpeg setup waited for that `ffmpeg -version`.
Find ffmpeg on PATH the way device-session tools do, and run it once in
the background so its first real use does not pay the cold start.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gwdp
gwdp force-pushed the gwdp/ffmpeg-path-check branch from dd6102c to 0e2fdfb Compare October 9, 2026 18:20
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

✅ Thank you for adding the changelog entry!

@gwdp
gwdp merged commit 4aca8b1 into main Oct 9, 2026
11 checks passed
@gwdp
gwdp deleted the gwdp/ffmpeg-path-check branch October 9, 2026 18:31
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