mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 12:24:38 +03:00
Fix hw transcoding not detecting filtering errors (#4934)
This commit is contained in:
@@ -82,7 +82,11 @@ func (f *FFMpeg) InitHWSupport(ctx context.Context) {
|
|||||||
f.hwCodecSupport = hwCodecSupport
|
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
|
var args Args
|
||||||
args = append(args, "-hide_banner")
|
args = append(args, "-hide_banner")
|
||||||
args = args.LogLevel(LogLevelWarning)
|
args = args.LogLevel(LogLevelWarning)
|
||||||
@@ -91,7 +95,7 @@ func (f *FFMpeg) hwCanFullHWTranscode(ctx context.Context, vf *models.VideoFile,
|
|||||||
args = args.Input(vf.Path)
|
args = args.Input(vf.Path)
|
||||||
args = args.Duration(0.1)
|
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 = append(args, CodecInit(codec)...)
|
||||||
args = args.VideoFilter(videoFilter)
|
args = args.VideoFilter(videoFilter)
|
||||||
|
|
||||||
|
|||||||
@@ -330,7 +330,7 @@ func (s *runningStream) makeStreamArgs(sm *StreamManager, segment int) Args {
|
|||||||
|
|
||||||
codec := HLSGetCodec(sm, s.streamType.Name)
|
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 = sm.encoder.hwDeviceInit(args, codec, fullhw)
|
||||||
args = append(args, extraInputArgs...)
|
args = append(args, extraInputArgs...)
|
||||||
|
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ func (o TranscodeOptions) makeStreamArgs(sm *StreamManager) Args {
|
|||||||
|
|
||||||
codec := o.FileGetCodec(sm, maxTranscodeSize)
|
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 = sm.encoder.hwDeviceInit(args, codec, fullhw)
|
||||||
args = append(args, extraInputArgs...)
|
args = append(args, extraInputArgs...)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user