From 33906e16825a9f66ab7c7ba434749be99189cb57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Leszko?= Date: Fri, 8 Sep 2023 09:34:50 +0200 Subject: [PATCH] Rename profile.CRF to profile.Quality --- ffmpeg/ffmpeg.go | 8 ++++---- ffmpeg/videoprofile.go | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ffmpeg/ffmpeg.go b/ffmpeg/ffmpeg.go index 8d5c769d4c..2a536675ea 100755 --- a/ffmpeg/ffmpeg.go +++ b/ffmpeg/ffmpeg.go @@ -697,16 +697,16 @@ func createCOutputParams(input *TranscodeOptionsIn, ps []TranscodeOptions) ([]C. "preset": "slow", "tier": "high", } - if p.Profile.CRF != 0 { - if p.Profile.CRF <= 63 { - p.VideoEncoder.Opts["crf"] = strconv.Itoa(int(p.Profile.CRF)) + if p.Profile.Quality != 0 { + if p.Profile.Quality <= 63 { + p.VideoEncoder.Opts["crf"] = strconv.Itoa(int(p.Profile.Quality)) } else { glog.Warning("Cannot use CRF param, value out of range (0-63)") } // There's no direct numerical correspondence between CQ and CRF. // From some experiments, it seems that setting CQ = CRF + 7 gives similar visual effects. - cq := p.Profile.CRF + 7 + cq := p.Profile.Quality + 7 if cq <= 51 { p.VideoEncoder.Opts["cq"] = strconv.Itoa(int(cq)) } else { diff --git a/ffmpeg/videoprofile.go b/ffmpeg/videoprofile.go index c70935c265..f6416af76a 100644 --- a/ffmpeg/videoprofile.go +++ b/ffmpeg/videoprofile.go @@ -98,10 +98,10 @@ type VideoProfile struct { Encoder VideoCodec ColorDepth ColorDepthBits ChromaFormat ChromaSubsampling - // CRF is used to set CRF and CQ + // Quality is used to set CRF and CQ // If set, then constant rate factor is used instead of constant bitrate - // If both CRF and Bitrate are set, then Bitrate is used only as max bitrate - CRF uint + // If both Quality and Bitrate are set, then Bitrate is used only as max bitrate + Quality uint } // Some sample video profiles @@ -235,7 +235,7 @@ type JsonProfile struct { Encoder string `json:"encoder"` ColorDepth ColorDepthBits `json:"colorDepth"` ChromaFormat ChromaSubsampling `json:"chromaFormat"` - CRF uint `json:"crf"` + Quality uint `json:"quality"` } func ParseProfilesFromJsonProfileArray(profiles []JsonProfile) ([]VideoProfile, error) { @@ -281,7 +281,7 @@ func ParseProfilesFromJsonProfileArray(profiles []JsonProfile) ([]VideoProfile, ColorDepth: profile.ColorDepth, // profile.ChromaFormat of 0 is default ChromaSubsampling420 ChromaFormat: profile.ChromaFormat, - CRF: profile.CRF, + Quality: profile.Quality, } parsedProfiles = append(parsedProfiles, prof) }