Add "format" back into NVENC transcode profile

monorepo
MB-Finski 2022-11-29 23:03:35 +02:00 committed by GitHub
parent 0dd14fabe2
commit a7b7fa5360
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 12 deletions

View File

@ -315,6 +315,7 @@ func (s *Stream) transcode(startId int) {
scale = fmt.Sprintf("scale_vaapi=w=%d:h=%d:force_original_aspect_ratio=decrease", s.width, s.height) scale = fmt.Sprintf("scale_vaapi=w=%d:h=%d:force_original_aspect_ratio=decrease", s.width, s.height)
} else if CV == "h264_nvenc" { } else if CV == "h264_nvenc" {
// NVENC // NVENC
format = "format=nv12|cuda,hwupload"
scale = fmt.Sprintf("scale_cuda=w=%d:h=%d:force_original_aspect_ratio=decrease:passthrough=0", s.width, s.height) scale = fmt.Sprintf("scale_cuda=w=%d:h=%d:force_original_aspect_ratio=decrease:passthrough=0", s.width, s.height)
} else { } else {
// x264 // x264
@ -331,7 +332,7 @@ func (s *Stream) transcode(startId int) {
if CV == "h264_nvenc" { if CV == "h264_nvenc" {
// Due to a bug(?) in NVENC, passthrough=0 must be set // Due to a bug(?) in NVENC, passthrough=0 must be set
args = append(args, []string{ args = append(args, []string{
"-vf", "scale_cuda=passthrough=0", "-vf", fmt.Sprintf("%s,%s", format, "scale_cuda=passthrough=0"),
}...) }...)
} else { } else {
args = append(args, []string{ args = append(args, []string{
@ -339,17 +340,8 @@ func (s *Stream) transcode(startId int) {
}...) }...)
} }
} else { } else {
if CV == "h264_nvenc" { args = append(args, []string{
args = append(args, []string{ "-vf", fmt.Sprintf("%s,%s", format, scale),
"-vf", scale,
}...)
} else {
args = append(args, []string{
"-vf", fmt.Sprintf("%s,%s", format, scale),
}...)
}
// Common arguments
args = append(args, []string{
"-maxrate", fmt.Sprintf("%d", s.bitrate), "-maxrate", fmt.Sprintf("%d", s.bitrate),
"-bufsize", fmt.Sprintf("%d", s.bitrate*2), "-bufsize", fmt.Sprintf("%d", s.bitrate*2),
}...) }...)