Documentation
¶
Index ¶
- Variables
- func ConvertFile(ctx context.Context, source, targetExt, codec, hwaccel, outputDir string, ...) (string, error)
- func ConvertImage(ctx context.Context, source, targetExt, outputDir string) (string, error)
- func ConvertVideo(ctx context.Context, source, targetExt, codec, hwaccel, outputDir string, ...) (string, error)
- func GetCompatibleTargets(sourcePath string) []string
- func IsValidTargetExt(ext string) bool
- type FileEntry
- type HWAccelProfile
- type ScanResult
- type VideoContainerConfig
Constants ¶
This section is empty.
Variables ¶
var ImageConversions map[string][]string
ImageConversions maps source image extension to list of target extensions.
var VideoContainers = []VideoContainerConfig{ { Name: "MP4", Codecs: []string{"h264", "h265", "av1"}, Extensions: []string{".mp4", ".m4a", ".m4p", ".m4b", ".m4r", ".m4v"}, }, { Name: "Matroska", Codecs: []string{"h264", "h265", "av1", "vp9"}, Extensions: []string{".mkv", ".mk3d", ".mka", ".mks"}, }, { Name: "WebM", Codecs: []string{"vp8", "vp9", "av1"}, Extensions: []string{".webm"}, }, }
VideoContainers lists the three supported output video containers.
var VideoConversions map[string][]string
VideoConversions maps source video extension to list of all canonical video output extensions.
Functions ¶
func ConvertFile ¶
func ConvertFile(ctx context.Context, source, targetExt, codec, hwaccel, outputDir string, av1CRF int) (string, error)
ConvertFile is the high-level converter — routes to image or video handler.
func ConvertImage ¶
ConvertImage converts an image file using the imaging library or ffmpeg.
func ConvertVideo ¶
func ConvertVideo(ctx context.Context, source, targetExt, codec, hwaccel, outputDir string, av1CRF int) (string, error)
ConvertVideo converts a video file using ffmpeg with optional GPU hardware acceleration.
func GetCompatibleTargets ¶
GetCompatibleTargets returns the list of extensions a source can convert to.
func IsValidTargetExt ¶
IsValidTargetExt reports whether ext is a recognised image or video output extension.
Types ¶
type FileEntry ¶
type FileEntry struct {
Path string `json:"path"`
Name string `json:"name"`
Filename string `json:"filename"` // Alias for frontend compatibility
Ext string `json:"ext"`
Size int64 `json:"size"`
SizeFormatted string `json:"size_formatted"`
Type string `json:"type"`
Targets []string `json:"targets"`
}
FileEntry describes one file found during scanning.
type HWAccelProfile ¶
type HWAccelProfile struct {
Name string `json:"name"`
Type string `json:"type"` // "nvenc", "qsv", "amf", "vaapi", "videotoolbox"
Encoders []string `json:"encoders"`
}
HWAccelProfile defines a detected hardware acceleration encoder profile.
func DetectAvailableHWAccels ¶
func DetectAvailableHWAccels(ctx context.Context) []HWAccelProfile
DetectAvailableHWAccels probes available GPU hardware encoders (cached via sync.Once).
type ScanResult ¶
type ScanResult struct {
Folder string `json:"folder"`
Summary map[string]int `json:"summary"`
Files []FileEntry `json:"files"`
Total int `json:"total"`
TotalCount int `json:"total_count"`
TotalSize int64 `json:"total_size"`
TotalSizeFormatted string `json:"total_size_formatted"`
}
ScanResult holds the output of a folder scan.
func ScanFolder ¶
func ScanFolder(folder string, includeSubfolders bool, filterType string, excludeFolders ...string) (*ScanResult, error)
ScanFolder walks folder and returns an inventory of convertible media files.
type VideoContainerConfig ¶
type VideoContainerConfig struct {
Name string `json:"name"`
Codecs []string `json:"codecs"`
Extensions []string `json:"extensions"`
}
VideoContainerConfig describes a supported output video container.