photoprism/internal/ffmpeg/config.go
Michael Mayer cb232be687 Video: Remove vpp_qsv=framerate from Intel QSV filter #4030 #4052
Signed-off-by: Michael Mayer <michael@photoprism.app>
2024-02-07 17:37:59 +01:00

25 lines
890 B
Go

package ffmpeg
import "fmt"
// Options represents transcoding options.
type Options struct {
Bin string
Encoder AvcEncoder
Size int
Bitrate string
MapVideo string
MapAudio string
}
// VideoFilter returns the FFmpeg video filter string based on the size limit in pixels and the pixel format.
func (o Options) VideoFilter(format PixelFormat) string {
// scale specifies the FFmpeg downscale filter, see http://trac.ffmpeg.org/wiki/Scaling.
if format == "" {
return fmt.Sprintf("scale='if(gte(iw,ih), min(%d, iw), -2):if(gte(iw,ih), -2, min(%d, ih))'", o.Size, o.Size)
} else if format == FormatQSV {
return fmt.Sprintf("scale_qsv=w='if(gte(iw,ih), min(%d, iw), -1)':h='if(gte(iw,ih), -1, min(%d, ih))'", o.Size, o.Size)
} else {
return fmt.Sprintf("scale='if(gte(iw,ih), min(%d, iw), -2):if(gte(iw,ih), -2, min(%d, ih))',format=%s", o.Size, o.Size, format)
}
}