Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hwCanFullHWTranscode not detecting no filter errors #4934

Merged
merged 1 commit into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions pkg/ffmpeg/codec_hardware.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ func (f *FFMpeg) InitHWSupport(ctx context.Context) {
f.hwCodecSupport = hwCodecSupport
}

func (f *FFMpeg) hwCanFullHWTranscode(ctx context.Context, vf *models.VideoFile, codec VideoCodec) bool {
func (f *FFMpeg) hwCanFullHWTranscode(ctx context.Context, codec VideoCodec, vf *models.VideoFile, reqHeight int) bool {
if codec == VideoCodecCopy {
return false
}

var args Args
args = append(args, "-hide_banner")
args = args.LogLevel(LogLevelWarning)
Expand All @@ -91,7 +95,7 @@ func (f *FFMpeg) hwCanFullHWTranscode(ctx context.Context, vf *models.VideoFile,
args = args.Input(vf.Path)
args = args.Duration(0.1)

videoFilter := f.hwMaxResFilter(codec, vf.Width, vf.Height, minHeight, true)
videoFilter := f.hwMaxResFilter(codec, vf.Width, vf.Height, reqHeight, true)
args = append(args, CodecInit(codec)...)
args = args.VideoFilter(videoFilter)

Expand Down
2 changes: 1 addition & 1 deletion pkg/ffmpeg/stream_segmented.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ func (s *runningStream) makeStreamArgs(sm *StreamManager, segment int) Args {

codec := HLSGetCodec(sm, s.streamType.Name)

fullhw := sm.config.GetTranscodeHardwareAcceleration() && sm.encoder.hwCanFullHWTranscode(sm.context, s.vf, codec)
fullhw := sm.config.GetTranscodeHardwareAcceleration() && sm.encoder.hwCanFullHWTranscode(sm.context, codec, s.vf, s.maxTranscodeSize)
args = sm.encoder.hwDeviceInit(args, codec, fullhw)
args = append(args, extraInputArgs...)

Expand Down
2 changes: 1 addition & 1 deletion pkg/ffmpeg/stream_transcode.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func (o TranscodeOptions) makeStreamArgs(sm *StreamManager) Args {

codec := o.FileGetCodec(sm, maxTranscodeSize)

fullhw := sm.config.GetTranscodeHardwareAcceleration() && sm.encoder.hwCanFullHWTranscode(sm.context, o.VideoFile, codec)
fullhw := sm.config.GetTranscodeHardwareAcceleration() && sm.encoder.hwCanFullHWTranscode(sm.context, codec, o.VideoFile, maxTranscodeSize)
args = sm.encoder.hwDeviceInit(args, codec, fullhw)
args = append(args, extraInputArgs...)

Expand Down
Loading