Make transpose optional and configurable

Close #15
Close #16
Close #17
monorepo
Varun Patil 2023-08-03 13:06:31 -07:00
parent f2d1a66a2a
commit 7a67cf56e2
3 changed files with 12 additions and 7 deletions

View File

@ -38,4 +38,7 @@ type Config struct {
NVENC bool `json:"nvenc"` NVENC bool `json:"nvenc"`
NVENCTemporalAQ bool `json:"nvencTemporalAQ"` NVENCTemporalAQ bool `json:"nvencTemporalAQ"`
NVENCScale string `json:"nvencScale"` // cuda, npp NVENCScale string `json:"nvencScale"` // cuda, npp
// Use transpose for streaming
UseTranspose bool `json:"useTranspose"`
} }

View File

@ -13,7 +13,7 @@ import (
) )
const ( const (
VERSION = "0.1.7" VERSION = "0.1.9"
) )
type Handler struct { type Handler struct {

View File

@ -376,8 +376,10 @@ func (s *Stream) transcodeArgs(startAt float64, isHls bool) []string {
args = append(args, strings.Split(extra, " ")...) args = append(args, strings.Split(extra, " ")...)
} }
// Disable autorotation // Disable autorotation (see transpose comments below)
args = append(args, []string{"-noautorotate"}...) if isHls && s.c.UseTranspose {
args = append(args, []string{"-noautorotate"}...)
}
// Input specs // Input specs
args = append(args, []string{ args = append(args, []string{
@ -413,11 +415,11 @@ func (s *Stream) transcodeArgs(startAt float64, isHls bool) []string {
// Rotation is a mess: https://trac.ffmpeg.org/ticket/8329 // Rotation is a mess: https://trac.ffmpeg.org/ticket/8329
// 1/ -noautorotate copies the sidecar metadata to the output // 1/ -noautorotate copies the sidecar metadata to the output
// 2/ autorotation doesn't seem to work with HW anyway (at least not with VAAPI) // 2/ autorotation doesn't seem to work with some types of HW (at least not with VAAPI)
// 3/ autorotation doesn't work with HLS streams // 3/ autorotation doesn't work with HLS streams
// So keep autorotation enabled, but manually rotate for HW anyway. // 4/ VAAPI cannot transport on AMD GPUs
// Also, the sidecar metadata only exists for MOV/MP4, so it's not a problem for TS. // So: give the user to disable autorotation for HLS and use a manual transpose
if isHls { if isHls && s.c.UseTranspose {
transposer := "transpose" transposer := "transpose"
if CV == ENCODER_VAAPI { if CV == ENCODER_VAAPI {
transposer = "transpose_vaapi" transposer = "transpose_vaapi"