diff --git a/ffmpeg/ffmpeg.go b/ffmpeg/ffmpeg.go index 1cc8302c1a..9352cf6229 100755 --- a/ffmpeg/ffmpeg.go +++ b/ffmpeg/ffmpeg.go @@ -9,6 +9,7 @@ import ( "os" "path" "path/filepath" + "runtime" "strconv" "strings" "sync" @@ -461,18 +462,18 @@ func configEncoder(inOpts *TranscodeOptionsIn, outOpts TranscodeOptions) (string if outDev != "" { upload = upload + "=device=" + outDev } - return encoder, upload + ",scale_npp", "super", nil + return encoder, upload + "," + hwScale(), hwScaleAlgo(), nil } case Nvidia: switch outOpts.Accel { case Software: - return encoder, "scale_npp", "super", nil + return encoder, hwScale(), hwScaleAlgo(), nil case Nvidia: // If we encode on a different device from decode then need to transfer if outDev != "" && outDev != inDev { return "", "", "", ErrTranscoderDev // XXX not allowed } - return encoder, "scale_npp", "super", nil + return encoder, hwScale(), hwScaleAlgo(), nil } case Netint: switch outOpts.Accel { @@ -1134,6 +1135,24 @@ func ffmpegStrEscape(origStr string) string { return outStr } +func hwScale() string { + if runtime.GOOS == "windows" { + // we don't build windows binaries with CUDA SDK, so need to use scale_cuda instead of scale_npp + return "scale_cuda" + } else { + return "scale_npp" + } +} + +func hwScaleAlgo() string { + if runtime.GOOS == "windows" { + // we don't build windows binaries with CUDA SDK, so need to use the default scale algorithm + return "" + } else { + return "super" + } +} + func FfmpegSetLogLevel(level int) { C.av_log_set_level(C.int(level)) }