Skip to content

The agent that grows with you

fix(pm): take Linux ffmpeg from BtbN, not martin-riedl

ethernet5ed85fc6207b
diff --git a/pm/lock.json b/pm/lock.json
index a560ab87a4f..76e72f22b4f 100644
--- a/pm/lock.json
+++ b/pm/lock.json
@@ -120,16 +120,16 @@
"url": "https://ffmpeg.martin-riedl.de/download/macos/amd64/1787081194_9.0.1/ffmpeg.zip"
},
"linux-arm64": {
- "sha256": "92cff3dec20d996bb5b8a918b156b64301338e7c28046053c82d0935cf7c6eb2",
- "url": "https://ffmpeg.martin-riedl.de/download/linux/arm64/1787072884_9.0.1/ffmpeg.zip"
+ "sha256": "2de63f615df3a46ac26921ac0314f501c3536aaf9fd5197ffe03dd17cd01a404",
+ "url": "https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2026-09-10-15-31/ffmpeg-n9.0.1-27-g9b0578816c-linuxarm64-gpl-9.0.tar.xz"
},
"linux-arm64-bionic": {
"sha256": "1ec37f4f092521cb785e0ccfa2d82cc4a79ec8d2a4864f5eefc50a314f2d5dec",
"url": "https://packages.termux.dev/apt/termux-main/pool/main/f/ffmpeg/ffmpeg_8.1.2-5_aarch64.deb"
},
"linux-x64": {
- "sha256": "18bec7d5c2ab3b24d277466b758394e109b0479133b98d155c5540ed3013fa74",
- "url": "https://ffmpeg.martin-riedl.de/download/linux/amd64/1787074600_9.0.1/ffmpeg.zip"
+ "sha256": "70b162b63517038ff18c8a50f4ea11f919a071f945c5881e87b0b2cd7173f8c7",
+ "url": "https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2026-09-10-15-31/ffmpeg-n9.0.1-27-g9b0578816c-linux64-gpl-9.0.tar.xz"
},
"win32-arm64": {
"sha256": "0f241c74c576f68dbd375f7557c2d08740783d7b8c6f892031c3830df18f672f",
diff --git a/pm/packages.py b/pm/packages.py
index 6bc9287580a..31445d6debe 100644
--- a/pm/packages.py
+++ b/pm/packages.py
@@ -663,10 +663,14 @@ class Ffmpeg(_BionicDebArm, BinaryPackage, DebPackage):
optional=False: ffmpeg is a required runtime tool. Sealed bundles ship
it baked into the payload (post_update skips provisioning sealed
installs — the artifact is atomic); dev installs get it re-ensured by
- step_provision_runtimes when the pin bumps. Windows: BtbN/FFmpeg-Builds
- (dated autobuild tag; ships ffprobe too). Linux + macOS:
- ffmpeg.martin-riedl.de (uniform ZIP, published sha256; single-binary —
- no ffprobe)."""
+ step_provision_runtimes when the pin bumps. Windows + Linux:
+ BtbN/FFmpeg-Builds (dated autobuild tag; ships ffprobe too).
+ macOS: ffmpeg.martin-riedl.de (uniform ZIP, published sha256;
+ single-binary — no ffprobe).
+
+ Linux deliberately does NOT use martin-riedl: that build is compiled
+ without x11grab (confirmed on the pinned 9.0.1 amd64 binary), and
+ x11grab is how screen capture on X11 works."""
name = "ffmpeg"
deb_package = "ffmpeg"
@@ -675,14 +679,20 @@ class Ffmpeg(_BionicDebArm, BinaryPackage, DebPackage):
def main_rel(self, target: str) -> str:
return "bin/ffmpeg"
- # The posix (martin-riedl) and win32 (BtbN) build streams have no shared
- # release cadence — they drift in PATCH. The lockfile version label is
- # major.minor; each target's exact patch lives in its artifact urls.
+ # macOS (martin-riedl, the only remaining posix stream) and Windows/Linux
+ # (BtbN) have no shared release cadence — they drift in PATCH. The lockfile
+ # version label is major.minor; each target's exact patch lives in its
+ # artifact urls.
version_style = "minor"
- # martin-riedl (posix) zips are a single `ffmpeg` file at the zip root;
- # BtbN (win32) zips carry bin/ffmpeg.exe under one top-level dir that
- # flatten hoists.
- binary_rel = {"win32": "bin/ffmpeg.exe", "posix": "ffmpeg"}
+ # martin-riedl (macOS) zips are a single `ffmpeg` at the zip root; BtbN
+ # ships bin/ffmpeg (Linux, .tar.xz) and bin/ffmpeg.exe (Windows, .zip)
+ # under one top-level dir that flatten hoists.
+ binary_rel = {
+ "win32": "bin/ffmpeg.exe",
+ "linux-x64": "bin/ffmpeg",
+ "linux-arm64": "bin/ffmpeg",
+ "posix": "ffmpeg",
+ }
flatten = True
# BtbN autobuild n9.0.1-11-ge47273f4d9 rejects `--version`
# ("Unrecognized option '-version'", exit 2880417800); `-version` works
@@ -693,7 +703,7 @@ class Ffmpeg(_BionicDebArm, BinaryPackage, DebPackage):
if target == "linux-arm64-bionic":
return f"https://packages.termux.dev/apt/termux-main/pool/main/f/ffmpeg/ffmpeg_{version}_aarch64.deb"
osname, arch = target.split("-")
- if osname == "win32":
+ if osname in ("win32", "linux"):
artifact = btbn_index().get(target, {}).get(version)
if artifact is not None:
tag, asset = artifact
@@ -701,16 +711,15 @@ class Ffmpeg(_BionicDebArm, BinaryPackage, DebPackage):
else:
epoch = martin_riedl_index().get(target, {}).get(version)
if epoch is not None:
- osdir = "macos" if osname == "darwin" else "linux"
source_arch = "amd64" if arch == "x64" else arch
- return f"https://ffmpeg.martin-riedl.de/download/{osdir}/{source_arch}/{epoch}_{version}/ffmpeg.zip"
+ return f"https://ffmpeg.martin-riedl.de/download/macos/{source_arch}/{epoch}_{version}/ffmpeg.zip"
# Existing installs read exact URLs from the lockfile. Re-pinning
# must never silently substitute a different version or target.
raise InstallError(self.name, f"no advertised {version} artifact for {target}",
"retry when the upstream index is available, or keep the existing pin")
def latest_versions(self, target: str, locked=None) -> list[str]:
- if target.startswith("win32"):
+ if target in ("win32-x64", "win32-arm64", "linux-x64", "linux-arm64"):
return btbn_versions(target)
return martin_riedl_versions(target)
diff --git a/pm/update.py b/pm/update.py
index 1e73528b591..1ef4cbd9ac1 100644
--- a/pm/update.py
+++ b/pm/update.py
@@ -403,9 +403,9 @@ def martin_riedl_versions(target: str) -> list[str]:
def btbn_index() -> dict[str, dict[str, tuple[str, str]]]:
- """Newest static GPL Windows asset per target/version, as (tag, name).
+ """Newest static GPL asset per target/version, as (tag, name).
- Releases also contain Linux, shared and LGPL builds. Retain target
+ Releases also contain macOS, shared and LGPL builds. Retain target
identity here so discovery and pinning select the same artifact.
"""
out: dict[str, dict[str, tuple[str, str]]] = {}
@@ -421,12 +421,18 @@ def btbn_index() -> dict[str, dict[str, tuple[str, str]]]:
continue
for asset in release.get("assets", []):
name = asset.get("name", "")
+ # Windows ships .zip, Linux .tar.xz. `gpl-shared`/`lgpl` differ
+ # in the segment after the arch, so requiring "-gpl-<ver>" right
+ # after it excludes both.
m = re.fullmatch(
- r"ffmpeg-n(\d+\.\d+\.\d+)-.+-win(64|arm64)-gpl-\d+\.\d+\.zip", name
+ r"ffmpeg-n(\d+\.\d+\.\d+)-.+-"
+ r"(win|linux)(64|arm64)-gpl-\d+\.\d+\.(?:zip|tar\.xz)",
+ name,
)
if m:
- version, arch = m.groups()
- target = "win32-x64" if arch == "64" else "win32-arm64"
+ version, osname, arch = m.groups()
+ os_key = "win32" if osname == "win" else "linux"
+ target = f"{os_key}-{'x64' if arch == '64' else 'arm64'}"
out.setdefault(target, {}).setdefault(version, (tag, name))
if len(data) < 30:
break
@@ -434,7 +440,7 @@ def btbn_index() -> dict[str, dict[str, tuple[str, str]]]:
def btbn_versions(target: str) -> list[str]:
- """Release versions with a supported Windows asset for this target."""
+ """Release versions with a supported BtbN asset for this target."""
return list(btbn_index().get(target, {}))
diff --git a/tests/pm/test_ffmpeg_resolution.py b/tests/pm/test_ffmpeg_resolution.py
index 4fe2843bda9..d18a52d6ec1 100644
--- a/tests/pm/test_ffmpeg_resolution.py
+++ b/tests/pm/test_ffmpeg_resolution.py
@@ -14,6 +14,9 @@ def indexes(monkeypatch):
version = "9.1.2"
assets = [
f"ffmpeg-n{version}-1-gabcdef-linux64-gpl-9.1.tar.xz",
+ f"ffmpeg-n{version}-1-gabcdef-linuxarm64-gpl-9.1.tar.xz",
+ f"ffmpeg-n{version}-1-gabcdef-linux64-gpl-shared-9.1.tar.xz",
+ f"ffmpeg-n{version}-1-gabcdef-linux64-lgpl-9.1.tar.xz",
f"ffmpeg-n{version}-1-gabcdef-win64-gpl-shared-9.1.zip",
f"ffmpeg-n{version}-1-gabcdef-win64-lgpl-9.1.zip",
f"ffmpeg-n{version}-1-gabcdef-win64-gpl-9.1.zip",
@@ -42,9 +45,12 @@ def test_resolved_version_fetches_its_exact_target_asset(indexes, target):
# URL resolution and update discovery must agree about target identities.
url = package.fetch_url(version, target)
assert version in package.latest_versions(target)
- if target.startswith("win32"):
+ if target.startswith(("win32", "linux")):
arch = "64" if target.endswith("-x64") else "arm64"
- expected = f"ffmpeg-n{version}-1-gabcdef-win{arch}-gpl-9.1.zip"
+ if target.startswith("win32"):
+ expected = f"ffmpeg-n{version}-1-gabcdef-win{arch}-gpl-9.1.zip"
+ else:
+ expected = f"ffmpeg-n{version}-1-gabcdef-linux{arch}-gpl-9.1.tar.xz"
assert url == f"https://github.com/BtbN/FFmpeg-Builds/releases/download/{tag}/{expected}"
else:
assert url == f"https://ffmpeg.martin-riedl.de/download/{paths[target]}"
diff --git a/tests/pm/test_pm_core.py b/tests/pm/test_pm_core.py
index bae19abfa9e..e8d530dd6f2 100644
--- a/tests/pm/test_pm_core.py
+++ b/tests/pm/test_pm_core.py
@@ -666,17 +666,21 @@ def test_probe_args_override_used_by_verify(tmp_path):
assert "--version" not in reason
-def test_ffmpeg_posix_layout_resolves_at_entry_root(tmp_path):
- """martin-riedl zips are a single `ffmpeg` file at the zip root — the
- package must resolve it there (bin/ffmpeg is the BtbN win32 layout)."""
+def test_ffmpeg_binary_rel_follows_the_build_source(tmp_path):
+ """BtbN (Windows `.zip`, Linux `.tar.xz`) ships bin/ffmpeg under one
+ top-level dir; martin-riedl's macOS zip is a single `ffmpeg` at the root."""
from pm.registry import get_package
ffmpeg = get_package("ffmpeg")
entry = tmp_path / "entry"
entry.mkdir()
(entry / "ffmpeg").write_bytes(b"x")
- assert ffmpeg.binary(entry, "linux-arm64") == entry / "ffmpeg"
+ (entry / "bin").mkdir()
+ (entry / "bin" / "ffmpeg").write_bytes(b"x")
assert ffmpeg.binary(entry, "darwin-x64") == entry / "ffmpeg"
+ assert ffmpeg.binary(entry, "darwin-arm64") == entry / "ffmpeg"
+ assert ffmpeg.binary(entry, "linux-x64") == entry / "bin" / "ffmpeg"
+ assert ffmpeg.binary(entry, "linux-arm64") == entry / "bin" / "ffmpeg"
assert ffmpeg.probe_args == ["-version"]
diff --git a/tests/pm/test_update_request_reuse.py b/tests/pm/test_update_request_reuse.py
index bb157a44555..969f2a57af1 100644
--- a/tests/pm/test_update_request_reuse.py
+++ b/tests/pm/test_update_request_reuse.py
@@ -97,11 +97,15 @@ def test_resolution_reuses_successful_responses_but_refreshes_next_operation(ups
f'<a href="/download/{osname}/{arch}/{generation}_{version}/ffmpeg.zip">build</a>'
for osname in ("linux", "macos") for arch in ("amd64", "arm64")
)
+ btbn_assets = []
+ for arch in ("64", "arm64"):
+ btbn_assets.append(
+ {"name": f"ffmpeg-n{version}-1-gabcdef-win{arch}-gpl-9.1.zip"})
+ # Linux comes from BtbN too (Windows .zip, Linux .tar.xz).
+ btbn_assets.append(
+ {"name": f"ffmpeg-n{version}-1-gabcdef-linux{arch}-gpl-9.1.tar.xz"})
payloads["/repos/BtbN/FFmpeg-Builds/releases?per_page=30&page=1"] = [{
- "tag_name": f"autobuild-{generation}", "assets": [
- {"name": f"ffmpeg-n{version}-1-gabcdef-win{arch}-gpl-9.1.zip"}
- for arch in ("64", "arm64")
- ],
+ "tag_name": f"autobuild-{generation}", "assets": btbn_assets,
}]
RangeHandler.payloads = {path: (value if isinstance(value, str) else json.dumps(value)).encode()
for path, value in payloads.items()}