|
|
|
@ -19,6 +19,10 @@ func Stream(w http.ResponseWriter, r *http.Request, absPath, ffmpegPath string) |
|
|
|
|
|
|
|
cmd := exec.Command( |
|
|
|
ffmpegPath, |
|
|
|
// Use all CPU cores for decoding the H.265 input.
|
|
|
|
// This is a global ffmpeg option and must come before -i.
|
|
|
|
// "0" means auto-detect (= number of cores available to the process).
|
|
|
|
"-threads", "0", |
|
|
|
"-loglevel", "error", |
|
|
|
"-i", absPath, |
|
|
|
// Transcode H.265 → H.264 for universal browser support.
|
|
|
|
@ -33,6 +37,8 @@ func Stream(w http.ResponseWriter, r *http.Request, absPath, ffmpegPath string) |
|
|
|
// without this the picture looks washed out.
|
|
|
|
// -an drops the audio track; security camera clips rarely carry useful
|
|
|
|
// audio and stripping it halves the work for the encoder.
|
|
|
|
// libx264 picks its own thread count automatically (matching -threads 0
|
|
|
|
// above), so no separate -x264-params threads= is needed.
|
|
|
|
"-c:v", "libx264", |
|
|
|
"-preset", "ultrafast", |
|
|
|
"-crf", "28", |
|
|
|
|