Skip to content

fix(media-server): accept older video and audio codecs in imports again - #4201

Merged
richiemcilroy merged 5 commits into
mainfrom
fix/media-legacy-decoders
Nov 13, 2026
Merged

richiemcilroy merged 5 commits into
mainfrom
fix/media-legacy-decoders

Conversation

@richiemcilroy

@richiemcilroy richiemcilroy commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

The media server's codec allowlist refuses older formats that regular Cap imports used to transcode. This allows them again.

What was refused

The allowlist applies to every FFmpeg and ffprobe the server runs, so it covers regular Cap imports as well as Cap Infra uploads. It accepted H.264, HEVC, VP8, VP9, AV1, ProRes, MPEG-4 Part 2 and Motion JPEG video. Anything else was answered "This video format is not supported", including:

  • MPEG-1 and MPEG-2 video (DVD and broadcast)
  • Windows Media video 7, 8 and 9, and VC-1
  • early MPEG-4 (DivX 3 and its predecessors)
  • Flash video (Sorenson H.263) and H.263 from phones
  • Theora
  • MP2, WMA, AMR and ADPCM audio, even next to H.264 video

Change

media-input-policy.ts adds these to the accepted video codecs and to the decoder list. Their FFmpeg decoders are mature and long fuzzed. They decode on the CPU: GPU decoding is chosen only for the codecs in the encoder's own list, so no new GPU decoder is added.

Cinepak, DV, Indeo and raw video stay refused, and the refusal tests now use Cinepak.

Measured

The same 14 synthetic fixtures were probed with the server's own probe and transcoded with its hardened spawn. Three versions were run: the commit before the allowlist, main, and this branch.

File Before the allowlist main This branch
H.264 + MP2, Matroska ok refused ok
H.264 + WMA 2, Matroska ok refused ok
MPEG-2 + MP2, Matroska ok refused ok
WMV 8 + WMA 2, Matroska ok refused ok
H.263 + AAC, 3GP ok refused ok
MPEG-2 in MPEG-TS refused refused refused
AVI, ASF/WMV, MPEG-PS, FLV containers (6 files) refused refused refused

The container rows were refused before the allowlist too: the probe's parser does not read those containers. This change restores what worked before and nothing more.

Tests

  • legacy-codecs.integration.test.ts makes one fixture per family with the local FFmpeg, then probes it and transcodes it to H.264 and AAC through the hardened spawn. A family whose encoder the local FFmpeg lacks (AMR, Theora on some builds) is skipped there. On main, all 10 that run fail. On this branch they pass.
  • media-input-policy.test.ts and media-probe-hardening.test.ts: the lists include the new names, and Cinepak is refused by both the codec check and FFmpeg's own decoder list.
  • Full media server suite: no new failures against main. The same 29 tests fail on both locally, because of tools this machine does not have.

The server no longer holds the root group on GPU nodes

The entrypoint gives the server the group of each GPU device so it can open them. On NVIDIA nodes the devices are owned by root:root with mode 666, so the server was given group 0 as well. A device anyone may read and write needs no group, so group 0 is now skipped for those devices. A root-owned device that is not open to everyone still gets the group, as before, and the entrypoint's existing check that the user can open each device is unchanged.

Checked in a container with the old and new entrypoint and a stand-in device:

Device Before After
root:root, 666 groups 1000 0 groups 1000, device opens
root:44, 660 groups 1000 44 groups 1000 44
root:root, 660 groups 1000 0 groups 1000 0

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge, with no new findings or unresolved earlier findings.

Summary

This PR restores older video and audio codecs for imports while keeping the existing container and input limits.

  • Regular imports can use older video and audio codecs again.
  • Open GPU devices no longer add group 0 to the server.

Reviews (5) · Last reviewed commit: "chore(media-server): keep only comments ..." · Reviewed by Greptile

The codec allowlist refused MPEG-1/2, Windows Media, early MPEG-4, Flash
video, H.263 and Theora, and MP2, WMA, AMR and ADPCM audio. Regular Cap
imports of these in Matroska, MP4, MOV and 3GP transcoded before the list
existed. Their FFmpeg decoders are mature, so they are allowed again.
Cinepak, DV, Indeo and raw video stay refused.
@richiemcilroy

Copy link
Copy Markdown
Member Author

@greptileai review

The image builds name each test file they run, so the new file did not run
there. The standalone build is the image the encoders use, so the older
formats are now probed and transcoded with that image's FFmpeg on both
architectures.
@richiemcilroy

Copy link
Copy Markdown
Member Author

hey @greptileai, please re-review the PR

@vercel
vercel Bot temporarily deployed to Preview – cap-status November 13, 2026 11:53 Inactive
@vercel

vercel Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
cap-status Skipped Skipped Nov 13, 2026 1:13pm UTC

@richiemcilroy
richiemcilroy marked this pull request as ready for review November 13, 2026 13:07
… devices

NVIDIA nodes own their devices as root:root with mode 666, so the
entrypoint added group 0 to the server's groups. A device anyone may read
and write needs no group, so group 0 is skipped for it. A root-owned
device that is not open to everyone still gets the group, as before.
@sandchest-com

sandchest-com Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Sandchest · Sandchest couldn't finish reviewing 8e856b1. Comment /sandchest review to try again; nothing was charged.

Details · earlier results on this pull request no longer apply to the latest commit.

@richiemcilroy

Copy link
Copy Markdown
Member Author

@greptileai review

@capy-ai capy-ai 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.

Capy found no issues.

View 1 other finding in Capy.

Open in Capy

@vercel
vercel Bot temporarily deployed to Preview – cap-status November 13, 2026 13:13 Inactive
@richiemcilroy

Copy link
Copy Markdown
Member Author

hey @greptileai, please re-review the PR

@capy-ai capy-ai 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.

Capy found no issues.

View 1 other finding in Capy.

Open in Capy

@richiemcilroy

Copy link
Copy Markdown
Member Author

/sandchest review

@richiemcilroy
richiemcilroy merged commit 74b7315 into main Nov 13, 2026
46 checks passed

This branch was successfully deployed

1 active (outdated) and 1 inactive deployments
Preview – cap-status — 8e856b1b Deployed Nov 13, 2026 by vercel[bot]
Preview – cap-web — c483e168 Deployed Nov 13, 2026 by vercel[bot]
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.

1 participant