photoprism/internal/ffmpeg/encoders.go
Michael Mayer 92e6c4fe1e Download: Add Disabled, Originals, MediaRaw & MediaSidecar Flags #2234
Extends DownloadSettings with 4 additional options:
- Name: File name pattern for downloaded files (existed)
- Disabled: Disables downloads
- Originals: Only download files stored in "originals" folder
- MediaRaw: Include RAW image files
- MediaSidecar: Include metadata sidecar files (JSON, XMP, YAML)
2022-04-15 09:42:07 +02:00

63 lines
2.5 KiB
Go

package ffmpeg
import "github.com/photoprism/photoprism/pkg/clean"
// AvcEncoder represents a supported FFmpeg AVC encoder name.
type AvcEncoder string
// String returns the FFmpeg AVC encoder name as string.
func (name AvcEncoder) String() string {
return string(name)
}
// Supported FFmpeg AVC encoders.
const (
SoftwareEncoder AvcEncoder = "libx264" // SoftwareEncoder see https://trac.ffmpeg.org/wiki/HWAccelIntro.
IntelEncoder AvcEncoder = "h264_qsv" // IntelEncoder is the Intel Quick Sync H.264 encoder.
AppleEncoder AvcEncoder = "h264_videotoolbox" // AppleEncoder is the Apple Video Toolbox H.264 encoder.
VAAPIEncoder AvcEncoder = "h264_vaapi" // VAAPIEncoder is the Video Acceleration API H.264 encoder.
NvidiaEncoder AvcEncoder = "h264_nvenc" // NvidiaEncoder is the NVIDIA H.264 encoder.
Video4LinuxEncoder AvcEncoder = "h264_v4l2m2m" // Video4LinuxEncoder is the Video4Linux H.264 encoder.
)
// AvcEncoders is the list of supported H.264 encoders with aliases.
var AvcEncoders = map[string]AvcEncoder{
"": SoftwareEncoder,
"default": SoftwareEncoder,
"software": SoftwareEncoder,
string(SoftwareEncoder): SoftwareEncoder,
"intel": IntelEncoder,
"qsv": IntelEncoder,
string(IntelEncoder): IntelEncoder,
"apple": AppleEncoder,
"osx": AppleEncoder,
"mac": AppleEncoder,
"macos": AppleEncoder,
"darwin": AppleEncoder,
string(AppleEncoder): AppleEncoder,
"vaapi": VAAPIEncoder,
"libva": VAAPIEncoder,
string(VAAPIEncoder): VAAPIEncoder,
"nvidia": NvidiaEncoder,
"nvenc": NvidiaEncoder,
"cuda": NvidiaEncoder,
string(NvidiaEncoder): NvidiaEncoder,
"v4l2": Video4LinuxEncoder,
"v4l": Video4LinuxEncoder,
"video4linux": Video4LinuxEncoder,
"rp4": Video4LinuxEncoder,
"raspberry": Video4LinuxEncoder,
"raspberrypi": Video4LinuxEncoder,
string(Video4LinuxEncoder): Video4LinuxEncoder,
}
// FindEncoder finds an FFmpeg encoder by name.
func FindEncoder(s string) AvcEncoder {
if encoder, ok := AvcEncoders[s]; ok {
return encoder
} else {
log.Warnf("ffmpeg: unsupported encoder %s", clean.Log(s))
}
return SoftwareEncoder
}