photoprism/internal/config/ffmpeg.go
Michael Mayer b32d9bf30c Videos: Improve FFmpeg parameters for Intel QSV #2222
This commit also removes PHOTOPRISM_FFMPEG_BUFFERS as it is only
used/required by Video4Linux. 64 seems to be a good value, so we pass
it statically as for the other encoders. Examples have been updated.
2022-04-05 16:48:53 +02:00

32 lines
749 B
Go

package config
// FFmpegBin returns the ffmpeg executable file name.
func (c *Config) FFmpegBin() string {
return findExecutable(c.options.FFmpegBin, "ffmpeg")
}
// FFmpegEnabled tests if FFmpeg is enabled for video transcoding.
func (c *Config) FFmpegEnabled() bool {
return !c.DisableFFmpeg()
}
// FFmpegEncoder returns the ffmpeg AVC encoder name.
func (c *Config) FFmpegEncoder() string {
if c.options.FFmpegEncoder == "" {
return "libx264"
}
return c.options.FFmpegEncoder
}
// FFmpegBitrate returns the ffmpeg bitrate limit in MBit/s.
func (c *Config) FFmpegBitrate() int {
switch {
case c.options.FFmpegBitrate <= 0:
return 50
case c.options.FFmpegBitrate >= 960:
return 960
default:
return c.options.FFmpegBitrate
}
}