From 9feec11d5840068518e8d5ca403acf7ae317bd4a Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Sun, 21 Jun 2026 13:06:20 -0700 Subject: [PATCH 01/11] ffmpeg: use shared libraries --- SConstruct | 3 ++- pyproject.toml | 2 +- system/loggerd/SConscript | 7 ++----- tools/cabana/SConscript | 4 +--- tools/jotpluggler/SConscript | 4 ++-- tools/replay/SConscript | 4 +--- uv.lock | 4 ++-- 7 files changed, 11 insertions(+), 17 deletions(-) diff --git a/SConstruct b/SConstruct index 0427d462949f67..bad8b4df517930 100644 --- a/SConstruct +++ b/SConstruct @@ -43,6 +43,7 @@ assert arch in [ pkg_names = ['acados', 'bzip2', 'capnproto', 'catch2', 'eigen', 'ffmpeg', 'json11', 'libjpeg', 'libyuv', 'ncurses', 'zeromq', 'zstd'] pkgs = [importlib.import_module(name) for name in pkg_names] acados = pkgs[pkg_names.index('acados')] +ffmpeg = pkgs[pkg_names.index('ffmpeg')] acados_include_dirs = [ acados.INCLUDE_DIR, os.path.join(acados.INCLUDE_DIR, "blasfeo", "include"), @@ -124,7 +125,7 @@ env = Environment( "#rednose/helpers", [x.LIB_DIR for x in pkgs], ], - RPATH=[], + RPATH=[ffmpeg.LIB_DIR], CYTHONCFILESUFFIX=".cpp", COMPILATIONDB_USE_ABSPATH=True, REDNOSE_ROOT="#", diff --git a/pyproject.toml b/pyproject.toml index 1e8ecb0232a602..bb1f8b5a9c6430 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,7 +32,7 @@ dependencies = [ "catch2 @ git+https://github.com/commaai/dependencies.git@release-catch2#subdirectory=catch2", "acados @ git+https://github.com/commaai/dependencies.git@release-acados#subdirectory=acados", "eigen @ git+https://github.com/commaai/dependencies.git@release-eigen#subdirectory=eigen", - "ffmpeg @ git+https://github.com/commaai/dependencies.git@release-ffmpeg#subdirectory=ffmpeg", + "ffmpeg @ git+https://github.com/commaai/dependencies.git@shared-ffmpeg#subdirectory=ffmpeg", "libjpeg @ git+https://github.com/commaai/dependencies.git@release-libjpeg#subdirectory=libjpeg", "libyuv @ git+https://github.com/commaai/dependencies.git@release-libyuv#subdirectory=libyuv", "zstd @ git+https://github.com/commaai/dependencies.git@release-zstd#subdirectory=zstd", diff --git a/system/loggerd/SConscript b/system/loggerd/SConscript index a638704dcad992..1be0a7f22700f7 100644 --- a/system/loggerd/SConscript +++ b/system/loggerd/SConscript @@ -1,8 +1,8 @@ Import('env', 'arch', 'messaging', 'common', 'visionipc') libs = [common, messaging, visionipc, - 'avformat', 'avcodec', 'swresample', 'avutil', 'x264', - 'pthread', 'z', 'm', 'zstd'] + 'avformat', 'avcodec', 'swresample', 'avutil', + 'pthread', 'm', 'zstd'] frameworks = [] src = ['logger.cc', 'zstd_writer.cc', 'video_writer.cc', 'encoder/encoder.cc', 'encoder/jpeg_encoder.cc'] @@ -14,9 +14,6 @@ else: if arch == "Darwin": frameworks += ['VideoToolbox', 'CoreMedia', 'CoreFoundation', 'CoreVideo'] -if arch != "Darwin": - libs += ['va', 'va-drm', 'drm'] - logger_lib = env.Library('logger', src) libs.insert(0, logger_lib) diff --git a/tools/cabana/SConscript b/tools/cabana/SConscript index 04389a9ebf30ad..19881f181e28cb 100644 --- a/tools/cabana/SConscript +++ b/tools/cabana/SConscript @@ -75,9 +75,7 @@ cabana_env = qt_env.Clone() cabana_env['CPPPATH'] += [libusb.INCLUDE_DIR] cabana_env['LIBPATH'] += [libusb.LIB_DIR] -cabana_libs = [cereal, messaging, visionipc, replay_lib, 'avformat', 'avcodec', 'swresample', 'avutil', 'x264', 'z', 'bz2', 'zstd', 'yuv', 'usb-1.0'] + base_libs -if arch != "Darwin": - cabana_libs += ['va', 'va-drm', 'drm'] +cabana_libs = [cereal, messaging, visionipc, replay_lib, 'avformat', 'avcodec', 'swresample', 'avutil', 'bz2', 'zstd', 'yuv', 'usb-1.0'] + base_libs opendbc_path = '-DOPENDBC_FILE_PATH=\'"%s"\'' % (cabana_env.Dir("../../opendbc/dbc").abspath) cabana_env['CXXFLAGS'] += [opendbc_path] diff --git a/tools/jotpluggler/SConscript b/tools/jotpluggler/SConscript index 078e173959aeb9..44aefbd6efc1b2 100644 --- a/tools/jotpluggler/SConscript +++ b/tools/jotpluggler/SConscript @@ -100,11 +100,11 @@ event_extractors = jot_env.Command("generated_event_extractors.h", [ ) libs = [replay_lib, common, messaging, visionipc, cereal, File(f"{imgui.LIB_DIR}/libimgui.a"), File(f"{imgui.LIB_DIR}/libglfw3.a"), - "avformat", "avcodec", "avutil", "x264", "yuv", "z", "bz2", "zstd", "m", "pthread", "usb-1.0"] + "avformat", "avcodec", "avutil", "yuv", "bz2", "zstd", "m", "pthread", "usb-1.0"] if arch == "Darwin": jot_env["FRAMEWORKS"] = ["OpenGL", "Cocoa", "IOKit", "CoreFoundation", "CoreVideo", "CoreMedia", "VideoToolbox"] else: - libs += ["GL", "dl", "va", "va-drm", "drm"] + libs += ["GL", "dl"] program = jot_env.Program("jotpluggler", jot_env.Glob("*.cc"), LIBS=libs) jot_env.Depends(program, generated_dbc_stamp) diff --git a/tools/replay/SConscript b/tools/replay/SConscript index d047415f58dedf..438a225dffdebd 100644 --- a/tools/replay/SConscript +++ b/tools/replay/SConscript @@ -12,9 +12,7 @@ if arch != "Darwin": replay_lib_src.append("qcom_decoder.cc") replay_lib = replay_env.Library("replay", replay_lib_src, LIBS=base_libs, FRAMEWORKS=base_frameworks) Export('replay_lib') -replay_libs = [replay_lib, 'avformat', 'avcodec', 'swresample', 'avutil', 'x264', 'z', 'bz2', 'zstd', 'yuv', 'ncurses'] + base_libs -if arch != "Darwin": - replay_libs += ['va', 'va-drm', 'drm'] +replay_libs = [replay_lib, 'avformat', 'avcodec', 'swresample', 'avutil', 'bz2', 'zstd', 'yuv', 'ncurses'] + base_libs replay_env.Program("replay", ["main.cc"], LIBS=replay_libs, FRAMEWORKS=base_frameworks) if GetOption('extras'): diff --git a/uv.lock b/uv.lock index dc51d2a45ef8bc..aae62d5d06f784 100644 --- a/uv.lock +++ b/uv.lock @@ -395,7 +395,7 @@ wheels = [ [[package]] name = "ffmpeg" version = "7.1.0" -source = { git = "https://github.com/commaai/dependencies.git?subdirectory=ffmpeg&rev=release-ffmpeg#f5153626027621f8ac0cdec056d254d3a1ef6acd" } +source = { git = "https://github.com/commaai/dependencies.git?subdirectory=ffmpeg&rev=shared-ffmpeg#8800b8f87c4266754122a807412ad26966b87757" } [[package]] name = "fonttools" @@ -845,7 +845,7 @@ requires-dist = [ { name = "crcmod-plus" }, { name = "cython" }, { name = "eigen", git = "https://github.com/commaai/dependencies.git?subdirectory=eigen&rev=release-eigen" }, - { name = "ffmpeg", git = "https://github.com/commaai/dependencies.git?subdirectory=ffmpeg&rev=release-ffmpeg" }, + { name = "ffmpeg", git = "https://github.com/commaai/dependencies.git?subdirectory=ffmpeg&rev=shared-ffmpeg" }, { name = "gcc-arm-none-eabi", git = "https://github.com/commaai/dependencies.git?subdirectory=gcc-arm-none-eabi&rev=release-gcc-arm-none-eabi" }, { name = "git-lfs", git = "https://github.com/commaai/dependencies.git?subdirectory=git-lfs&rev=release-git-lfs" }, { name = "hypothesis", marker = "extra == 'testing'", specifier = "==6.47.*" }, From 0a37035b12d6ed49ec29fc505a9544c8658b70f6 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Sun, 21 Jun 2026 13:20:30 -0700 Subject: [PATCH 02/11] trigger CI --- uv.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uv.lock b/uv.lock index aae62d5d06f784..1b735f6986946a 100644 --- a/uv.lock +++ b/uv.lock @@ -395,7 +395,7 @@ wheels = [ [[package]] name = "ffmpeg" version = "7.1.0" -source = { git = "https://github.com/commaai/dependencies.git?subdirectory=ffmpeg&rev=shared-ffmpeg#8800b8f87c4266754122a807412ad26966b87757" } +source = { git = "https://github.com/commaai/dependencies.git?subdirectory=ffmpeg&rev=shared-ffmpeg#88aac20ee03f5a0b77826058782f946f22a4042f" } [[package]] name = "fonttools" From b6bc052cea4df9d89cc72e27ae1b9b8be4cfce14 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Sun, 21 Jun 2026 14:19:20 -0700 Subject: [PATCH 03/11] trigger CI --- uv.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uv.lock b/uv.lock index 1b735f6986946a..a2f6b2e70fa2a7 100644 --- a/uv.lock +++ b/uv.lock @@ -395,7 +395,7 @@ wheels = [ [[package]] name = "ffmpeg" version = "7.1.0" -source = { git = "https://github.com/commaai/dependencies.git?subdirectory=ffmpeg&rev=shared-ffmpeg#88aac20ee03f5a0b77826058782f946f22a4042f" } +source = { git = "https://github.com/commaai/dependencies.git?subdirectory=ffmpeg&rev=shared-ffmpeg#a15fc4b86bd9736f5eaadf6ffc56bee15c1d3ef8" } [[package]] name = "fonttools" From 0c36f83ab8d4dee1e64efc047414d2f7ba8511ad Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Sun, 21 Jun 2026 16:22:05 -0700 Subject: [PATCH 04/11] trigger CI From 4f3c3e9092df6d856f5096799863779222908c75 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Tue, 23 Jun 2026 14:28:42 -0700 Subject: [PATCH 05/11] ffmpeg: relock shared dependency --- pyproject.toml | 2 +- uv.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index bb1f8b5a9c6430..2251dc424acc6c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,7 +32,7 @@ dependencies = [ "catch2 @ git+https://github.com/commaai/dependencies.git@release-catch2#subdirectory=catch2", "acados @ git+https://github.com/commaai/dependencies.git@release-acados#subdirectory=acados", "eigen @ git+https://github.com/commaai/dependencies.git@release-eigen#subdirectory=eigen", - "ffmpeg @ git+https://github.com/commaai/dependencies.git@shared-ffmpeg#subdirectory=ffmpeg", + "ffmpeg @ git+https://github.com/commaai/dependencies.git@ffmpeg-shared#subdirectory=ffmpeg", "libjpeg @ git+https://github.com/commaai/dependencies.git@release-libjpeg#subdirectory=libjpeg", "libyuv @ git+https://github.com/commaai/dependencies.git@release-libyuv#subdirectory=libyuv", "zstd @ git+https://github.com/commaai/dependencies.git@release-zstd#subdirectory=zstd", diff --git a/uv.lock b/uv.lock index a2f6b2e70fa2a7..69360cdb2fb248 100644 --- a/uv.lock +++ b/uv.lock @@ -395,7 +395,7 @@ wheels = [ [[package]] name = "ffmpeg" version = "7.1.0" -source = { git = "https://github.com/commaai/dependencies.git?subdirectory=ffmpeg&rev=shared-ffmpeg#a15fc4b86bd9736f5eaadf6ffc56bee15c1d3ef8" } +source = { git = "https://github.com/commaai/dependencies.git?subdirectory=ffmpeg&rev=ffmpeg-shared#8b4a004a7acbe6348c75fa7670d20ab77daa6875" } [[package]] name = "fonttools" @@ -845,7 +845,7 @@ requires-dist = [ { name = "crcmod-plus" }, { name = "cython" }, { name = "eigen", git = "https://github.com/commaai/dependencies.git?subdirectory=eigen&rev=release-eigen" }, - { name = "ffmpeg", git = "https://github.com/commaai/dependencies.git?subdirectory=ffmpeg&rev=shared-ffmpeg" }, + { name = "ffmpeg", git = "https://github.com/commaai/dependencies.git?subdirectory=ffmpeg&rev=ffmpeg-shared" }, { name = "gcc-arm-none-eabi", git = "https://github.com/commaai/dependencies.git?subdirectory=gcc-arm-none-eabi&rev=release-gcc-arm-none-eabi" }, { name = "git-lfs", git = "https://github.com/commaai/dependencies.git?subdirectory=git-lfs&rev=release-git-lfs" }, { name = "hypothesis", marker = "extra == 'testing'", specifier = "==6.47.*" }, From ff649fa7533d3a07771c3b78ab13e656c87246c9 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Tue, 23 Jun 2026 14:34:36 -0700 Subject: [PATCH 06/11] ci: refresh device venv on dependency changes --- Jenkinsfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 92bc61521e14da..9c868096c49d75 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -95,6 +95,11 @@ def deviceStage(String stageName, String deviceType, List extra_env, def steps) device(device_ip, "set time", "date -s '" + date + "'") device(device_ip, "git checkout", extra + "\n" + readFile("selfdrive/test/setup_device_ci.sh")) } + if (branch != "master" && !branch.contains("__jenkins_loop_") && hasPathChanged(gitDiff, ["pyproject.toml", "uv.lock"])) { + timeout(time: 600, unit: 'SECONDS') { + device(device_ip, "sync python deps", "UV_PROJECT_ENVIRONMENT=/usr/local/venv uv sync --frozen --all-extras") + } + } steps.each { item -> def name = item[0] def cmd = item[1] From b5a3471c42901f41ba374a6af41f5263bf96efc5 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Tue, 23 Jun 2026 14:39:10 -0700 Subject: [PATCH 07/11] ci: refresh ffmpeg on device builds --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9c868096c49d75..a4b1c93ce96760 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -95,9 +95,9 @@ def deviceStage(String stageName, String deviceType, List extra_env, def steps) device(device_ip, "set time", "date -s '" + date + "'") device(device_ip, "git checkout", extra + "\n" + readFile("selfdrive/test/setup_device_ci.sh")) } - if (branch != "master" && !branch.contains("__jenkins_loop_") && hasPathChanged(gitDiff, ["pyproject.toml", "uv.lock"])) { - timeout(time: 600, unit: 'SECONDS') { - device(device_ip, "sync python deps", "UV_PROJECT_ENVIRONMENT=/usr/local/venv uv sync --frozen --all-extras") + if (branch == "shared-ffmpeg") { + timeout(time: 1200, unit: 'SECONDS') { + device(device_ip, "sync ffmpeg dependency", "uv pip install --python /usr/local/venv/bin/python --reinstall --no-deps 'ffmpeg @ git+https://github.com/commaai/dependencies.git@ffmpeg-shared#subdirectory=ffmpeg'") } } steps.each { item -> From 3a0d0c195bc3b086596e60f26679624608852a8c Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Tue, 23 Jun 2026 14:41:09 -0700 Subject: [PATCH 08/11] ci: detect shared ffmpeg dependency --- Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index a4b1c93ce96760..66f5260bdfe018 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -86,6 +86,7 @@ def deviceStage(String stageName, String deviceType, List extra_env, def steps) def extra = extra_env.collect { "export ${it}" }.join('\n'); def branch = env.BRANCH_NAME ?: 'master'; def gitDiff = sh returnStdout: true, script: 'curl -s -H "Authorization: Bearer ${GITHUB_COMMENTS_TOKEN}" https://api.github.com/repos/commaai/openpilot/compare/master...${GIT_BRANCH} | jq .files[].filename || echo "/"', label: 'Getting changes' + def usesSharedFfmpeg = sh returnStatus: true, script: "grep -q 'dependencies.git@ffmpeg-shared#subdirectory=ffmpeg' pyproject.toml" lock(resource: "", label: deviceType, inversePrecedence: true, variable: 'device_ip', quantity: 1, resourceSelectStrategy: 'random') { docker.image('ghcr.io/commaai/alpine-ssh').inside('--user=root') { @@ -95,7 +96,7 @@ def deviceStage(String stageName, String deviceType, List extra_env, def steps) device(device_ip, "set time", "date -s '" + date + "'") device(device_ip, "git checkout", extra + "\n" + readFile("selfdrive/test/setup_device_ci.sh")) } - if (branch == "shared-ffmpeg") { + if (usesSharedFfmpeg == 0) { timeout(time: 1200, unit: 'SECONDS') { device(device_ip, "sync ffmpeg dependency", "uv pip install --python /usr/local/venv/bin/python --reinstall --no-deps 'ffmpeg @ git+https://github.com/commaai/dependencies.git@ffmpeg-shared#subdirectory=ffmpeg'") } From 99a643ab0e7fdc272584510d923a96f398c24f7b Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Tue, 23 Jun 2026 14:44:25 -0700 Subject: [PATCH 09/11] ci: allow ffmpeg wheel build warnings --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 66f5260bdfe018..4d35e15861ed05 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -98,7 +98,7 @@ def deviceStage(String stageName, String deviceType, List extra_env, def steps) } if (usesSharedFfmpeg == 0) { timeout(time: 1200, unit: 'SECONDS') { - device(device_ip, "sync ffmpeg dependency", "uv pip install --python /usr/local/venv/bin/python --reinstall --no-deps 'ffmpeg @ git+https://github.com/commaai/dependencies.git@ffmpeg-shared#subdirectory=ffmpeg'") + device(device_ip, "sync ffmpeg dependency", "PYTHONWARNINGS=default uv pip install --python /usr/local/venv/bin/python --reinstall --no-deps 'ffmpeg @ git+https://github.com/commaai/dependencies.git@ffmpeg-shared#subdirectory=ffmpeg'") } } steps.each { item -> From b104c80336e25e1ced69c02d2fd028ca5b7d2119 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Tue, 23 Jun 2026 14:53:11 -0700 Subject: [PATCH 10/11] ffmpeg: relock build requirements --- uv.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uv.lock b/uv.lock index 69360cdb2fb248..6cce668939fc8f 100644 --- a/uv.lock +++ b/uv.lock @@ -395,7 +395,7 @@ wheels = [ [[package]] name = "ffmpeg" version = "7.1.0" -source = { git = "https://github.com/commaai/dependencies.git?subdirectory=ffmpeg&rev=ffmpeg-shared#8b4a004a7acbe6348c75fa7670d20ab77daa6875" } +source = { git = "https://github.com/commaai/dependencies.git?subdirectory=ffmpeg&rev=ffmpeg-shared#1c0a0ba350db10e978eaf0eed25c409325bd40c5" } [[package]] name = "fonttools" From 74356d84a7d1d17016b3c7a6689ff39ff779d8c1 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Tue, 23 Jun 2026 15:00:23 -0700 Subject: [PATCH 11/11] ffmpeg: relock ccache fallback --- uv.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uv.lock b/uv.lock index 6cce668939fc8f..19110ba4399e16 100644 --- a/uv.lock +++ b/uv.lock @@ -395,7 +395,7 @@ wheels = [ [[package]] name = "ffmpeg" version = "7.1.0" -source = { git = "https://github.com/commaai/dependencies.git?subdirectory=ffmpeg&rev=ffmpeg-shared#1c0a0ba350db10e978eaf0eed25c409325bd40c5" } +source = { git = "https://github.com/commaai/dependencies.git?subdirectory=ffmpeg&rev=ffmpeg-shared#e203a394c138c5c06ae071664c39ded35dbbc943" } [[package]] name = "fonttools"