Use copy for H264
parent
b1aba2284f
commit
a2a8fda91e
10
stream.go
10
stream.go
|
@ -16,6 +16,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
ENCODER_COPY = "copy"
|
||||||
ENCODER_X264 = "libx264"
|
ENCODER_X264 = "libx264"
|
||||||
ENCODER_VAAPI = "h264_vaapi"
|
ENCODER_VAAPI = "h264_vaapi"
|
||||||
ENCODER_NVENC = "h264_nvenc"
|
ENCODER_NVENC = "h264_nvenc"
|
||||||
|
@ -363,6 +364,10 @@ func (s *Stream) transcodeArgs(startAt float64) []string {
|
||||||
// encoder selection
|
// encoder selection
|
||||||
CV := ENCODER_X264
|
CV := ENCODER_X264
|
||||||
|
|
||||||
|
if s.m.probe.CodecName == CODEC_H264 && s.quality == QUALITY_MAX {
|
||||||
|
// Use original stream
|
||||||
|
CV = ENCODER_COPY
|
||||||
|
} else {
|
||||||
// Check whether hwaccel should be used
|
// Check whether hwaccel should be used
|
||||||
if s.c.VAAPI {
|
if s.c.VAAPI {
|
||||||
CV = ENCODER_VAAPI
|
CV = ENCODER_VAAPI
|
||||||
|
@ -373,6 +378,7 @@ func (s *Stream) transcodeArgs(startAt float64) []string {
|
||||||
extra := "-hwaccel cuda"
|
extra := "-hwaccel cuda"
|
||||||
args = append(args, strings.Split(extra, " ")...)
|
args = append(args, strings.Split(extra, " ")...)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Input specs
|
// Input specs
|
||||||
args = append(args, []string{
|
args = append(args, []string{
|
||||||
|
@ -404,8 +410,11 @@ func (s *Stream) transcodeArgs(startAt float64) []string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply filter
|
// Apply filter
|
||||||
|
if CV != ENCODER_COPY {
|
||||||
filter := fmt.Sprintf("%s,%s=%s", format, scaler, strings.Join(scalerArgs, ":"))
|
filter := fmt.Sprintf("%s,%s=%s", format, scaler, strings.Join(scalerArgs, ":"))
|
||||||
args = append(args, []string{"-vf", filter}...)
|
args = append(args, []string{"-vf", filter}...)
|
||||||
|
args = append(args, []string{"-profile:v", "main"}...)
|
||||||
|
}
|
||||||
|
|
||||||
// Apply bitrate cap if not max quality
|
// Apply bitrate cap if not max quality
|
||||||
if s.quality != QUALITY_MAX {
|
if s.quality != QUALITY_MAX {
|
||||||
|
@ -419,7 +428,6 @@ func (s *Stream) transcodeArgs(startAt float64) []string {
|
||||||
args = append(args, []string{
|
args = append(args, []string{
|
||||||
"-map", "0:v:0",
|
"-map", "0:v:0",
|
||||||
"-c:v", CV,
|
"-c:v", CV,
|
||||||
"-profile:v", "main",
|
|
||||||
}...)
|
}...)
|
||||||
|
|
||||||
// Device specific output args
|
// Device specific output args
|
||||||
|
|
Loading…
Reference in New Issue