diff --git a/transcode/encode.go b/transcode/encode.go index 1260821..77fc8a8 100644 --- a/transcode/encode.go +++ b/transcode/encode.go @@ -7,6 +7,7 @@ import ( "os" "os/exec" "regexp" + "runtime" "strconv" "strings" ) @@ -57,11 +58,14 @@ func ExportSegments( ) filterComplex := strings.Join(filterParts, ";") + numCpus := runtime.NumCPU() + cmd := exec.Command("ffmpeg", "-i", inputPath, "-filter_complex", filterComplex, "-map", "[outv]", "-map", "[outa]", + "-threads", strconv.Itoa(numCpus), // around 80% compression "-c:v", "libx264", "-crf", "28", "-preset", "veryfast", "-c:a", "aac", "-b:a", "128k",