cap video resolution to save on memory
This commit is contained in:
@@ -240,10 +240,18 @@ func transcodeMediaParticle(ctx context.Context, depotSvc depot.Service, doc *fi
|
|||||||
tmpPath,
|
tmpPath,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// Cap encoder parallelism and lookahead to keep memory bounded — screen
|
||||||
|
// recordings come in at native display resolution (often 1440p–4K) and
|
||||||
|
// libx264's per-thread lookahead/reference buffers blow past the worker's
|
||||||
|
// memory limit otherwise. Output is also downscaled to 1080p max, which
|
||||||
|
// mobile playback won't notice; the original WebM stays in GCS untouched.
|
||||||
args = []string{
|
args = []string{
|
||||||
"-y", "-i", sourceURL,
|
"-y", "-i", sourceURL,
|
||||||
|
"-vf", "scale='min(1920,iw)':-2:flags=lanczos",
|
||||||
"-c:v", "libx264", "-preset", "veryfast", "-crf", "23",
|
"-c:v", "libx264", "-preset", "veryfast", "-crf", "23",
|
||||||
"-pix_fmt", "yuv420p", "-profile:v", "baseline", "-level", "3.1",
|
"-pix_fmt", "yuv420p", "-profile:v", "baseline", "-level", "3.1",
|
||||||
|
"-x264-params", "rc-lookahead=20:ref=2",
|
||||||
|
"-threads", "2", "-filter_threads", "2",
|
||||||
"-c:a", "aac", "-b:a", "128k",
|
"-c:a", "aac", "-b:a", "128k",
|
||||||
"-movflags", "+faststart",
|
"-movflags", "+faststart",
|
||||||
tmpPath,
|
tmpPath,
|
||||||
|
|||||||
Reference in New Issue
Block a user