num cpu
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
@@ -57,11 +58,14 @@ func ExportSegments(
|
|||||||
)
|
)
|
||||||
filterComplex := strings.Join(filterParts, ";")
|
filterComplex := strings.Join(filterParts, ";")
|
||||||
|
|
||||||
|
numCpus := runtime.NumCPU()
|
||||||
|
|
||||||
cmd := exec.Command("ffmpeg",
|
cmd := exec.Command("ffmpeg",
|
||||||
"-i", inputPath,
|
"-i", inputPath,
|
||||||
"-filter_complex", filterComplex,
|
"-filter_complex", filterComplex,
|
||||||
"-map", "[outv]",
|
"-map", "[outv]",
|
||||||
"-map", "[outa]",
|
"-map", "[outa]",
|
||||||
|
"-threads", strconv.Itoa(numCpus),
|
||||||
// around 80% compression
|
// around 80% compression
|
||||||
"-c:v", "libx264", "-crf", "28", "-preset", "veryfast",
|
"-c:v", "libx264", "-crf", "28", "-preset", "veryfast",
|
||||||
"-c:a", "aac", "-b:a", "128k",
|
"-c:a", "aac", "-b:a", "128k",
|
||||||
|
|||||||
Reference in New Issue
Block a user