Fix invalid rotation with CPU
parent
92413eaa29
commit
ff9c27a74e
16
stream.go
16
stream.go
|
@ -181,7 +181,7 @@ func (s *Stream) ServeChunk(w http.ResponseWriter, id int) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Stream) ServeFullVideo(w http.ResponseWriter, r *http.Request) error {
|
func (s *Stream) ServeFullVideo(w http.ResponseWriter, r *http.Request) error {
|
||||||
args := s.transcodeArgs(0)
|
args := s.transcodeArgs(0, false)
|
||||||
|
|
||||||
if s.m.probe.CodecName == CODEC_H264 && s.quality == QUALITY_MAX {
|
if s.m.probe.CodecName == CODEC_H264 && s.quality == QUALITY_MAX {
|
||||||
// try to just send the original file
|
// try to just send the original file
|
||||||
|
@ -351,7 +351,7 @@ func (s *Stream) restartAtChunk(w http.ResponseWriter, id int) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get arguments to ffmpeg
|
// Get arguments to ffmpeg
|
||||||
func (s *Stream) transcodeArgs(startAt float64) []string {
|
func (s *Stream) transcodeArgs(startAt float64, isHls bool) []string {
|
||||||
args := []string{
|
args := []string{
|
||||||
"-loglevel", "warning",
|
"-loglevel", "warning",
|
||||||
}
|
}
|
||||||
|
@ -376,6 +376,9 @@ func (s *Stream) transcodeArgs(startAt float64) []string {
|
||||||
args = append(args, strings.Split(extra, " ")...)
|
args = append(args, strings.Split(extra, " ")...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Disable autorotation
|
||||||
|
args = append(args, []string{"-noautorotate"}...)
|
||||||
|
|
||||||
// Input specs
|
// Input specs
|
||||||
args = append(args, []string{
|
args = append(args, []string{
|
||||||
"-i", s.m.path, // Input file
|
"-i", s.m.path, // Input file
|
||||||
|
@ -409,11 +412,12 @@ func (s *Stream) transcodeArgs(startAt float64) []string {
|
||||||
filter := fmt.Sprintf("%s,%s=%s", format, scaler, strings.Join(scalerArgs, ":"))
|
filter := fmt.Sprintf("%s,%s=%s", format, scaler, strings.Join(scalerArgs, ":"))
|
||||||
|
|
||||||
// Rotation is a mess: https://trac.ffmpeg.org/ticket/8329
|
// Rotation is a mess: https://trac.ffmpeg.org/ticket/8329
|
||||||
// 1/ autorotate=1 is needed, otherwise the sidecar metadata gets copied to the output
|
// 1/ -noautorotate copies the sidecar metadata to the output
|
||||||
// 2/ But autorotation doesn't seem to work with HW (at least not with VAAPI)
|
// 2/ autorotation doesn't seem to work with HW anyway (at least not with VAAPI)
|
||||||
|
// 3/ autorotation doesn't work with HLS streams
|
||||||
// So keep autorotation enabled, but manually rotate for HW anyway.
|
// So keep autorotation enabled, but manually rotate for HW anyway.
|
||||||
// Also, the sidecar metadata only exists for MOV/MP4, so it's not a problem for TS.
|
// Also, the sidecar metadata only exists for MOV/MP4, so it's not a problem for TS.
|
||||||
if CV == ENCODER_VAAPI || CV == ENCODER_NVENC {
|
if isHls {
|
||||||
transposer := "transpose"
|
transposer := "transpose"
|
||||||
if CV == ENCODER_VAAPI {
|
if CV == ENCODER_VAAPI {
|
||||||
transposer = "transpose_vaapi"
|
transposer = "transpose_vaapi"
|
||||||
|
@ -491,7 +495,7 @@ func (s *Stream) transcode(startId int) {
|
||||||
}
|
}
|
||||||
startAt := float64(startId * s.c.ChunkSize)
|
startAt := float64(startId * s.c.ChunkSize)
|
||||||
|
|
||||||
args := s.transcodeArgs(startAt)
|
args := s.transcodeArgs(startAt, true)
|
||||||
|
|
||||||
// Segmenting specs
|
// Segmenting specs
|
||||||
args = append(args, []string{
|
args = append(args, []string{
|
||||||
|
|
Loading…
Reference in New Issue