Repository navigation
perf(media-server): GPU/NVENC farm support, lifecycle hardening and faster verify/upload - #2935
Open
richiemcilroy wants to merge 15 commits into
Open
richiemcilroy wants to merge 15 commits into
richiemcilroy wants to merge 15 commits into
Conversation
…heartbeat long steps and stop cancelled work
… match x264 size and vmaf
…d decoded-content hashes in remote verification
…ncoder attempt details behind the secret
…ontent-range totals and keep error bodies out of messages
…rst range is capped or unplaceable
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
… chunk instead of on return
Member
Author
|
@greptileai review |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Gets the media server ready to run on our own AWS boxes (g6.2xlarge with an L4, or plain CPU nodes) and makes it a lot faster there. Every speed change is opt-in through env vars, so the current Railway deploy behaves the same apart from the lifecycle fixes listed below.
What changed
Opt-in (default off, no change on Railway)
CAP_MEDIA_VIDEO_ENCODER=nvenc: encodes with h264_nvenc on the GPU. Defaults are p1, cq = crf + 8, no lookahead, and spatial AQ, which match x264 medium on file size and VMAF across our fixtures. If NVENC fails for any reason that isn't a cancel, the job falls back to libx264. Tuning knobs:CAP_NVENC_PRESET,CAP_NVENC_CQ_OFFSET,CAP_NVENC_LOOKAHEAD,CAP_NVENC_SPATIAL_AQ,CAP_NVENC_TEMPORAL_AQ,CAP_NVENC_GPU_DECODE_CODECS.MEDIA_SERVER_DOWNLOAD_CONCURRENCY/MEDIA_SERVER_DOWNLOAD_PART_MB: parallel ranged source downloads.MEDIA_SERVER_UPLOAD_CONCURRENCY: uploads multipart output parts in parallel (default 1, max 16).MEDIA_SERVER_PROCESS_DECODE_THREADS,MEDIA_SERVER_VERIFY_DECODE_THREADS,MEDIA_SERVER_VALIDATE_DECODE_THREADS: decode thread counts.MEDIA_SERVER_SHUTDOWN_GRACE_MS: on SIGTERM, stop taking new jobs, let in-flight work finish, and return 503 from/healthwhile draining (default 0, same shutdown as today).MEDIA_SERVER_PUBLIC_STATUS=false: puts job status reads behind the secret (public by default, same as today).MEDIA_SERVER_IDLE_TIMEOUT_SECONDSOn by default
/video/verify-recordingno longer computes the SHA-256 of every decoded raw frame, because that route throws the result away. The full-xerrordecode still runs, and the hash still runs whenever source evidence is passed in for comparison./healthincludesvideoEncoder.active. Runtime counters and NVENC attempt details only appear withx-media-server-secret, and they contain no job or video IDs. URLs are stripped from NVENC fallback reasons.Benchmarks
Median time from accept to the final webhook, with the same fixtures and S3 bucket. The GPU node is a g6.2xlarge (L4, 8 vCPU); Railway is production media.cap.so, run gently with one job at a time.
20-minute recordings on the GPU node:
No job failed in any run. Lifecycle was tested on the GPU node:
Testing
tscreports the same 7 errors as main and none in touched files.

Confidence Score: 5/5
The PR appears safe to merge; the follow-up changes address the earlier findings without introducing a new blocking issue.Summary
Adds opt-in GPU encoding and faster transfers, plus job cleanup and shutdown improvements.
Reviews (2) · Last reviewed commit: "fix(media-server): restore the audio str..." · Reviewed by Greptile