photoprism/internal/ffmpeg/exclude.go
Michael Mayer 9e5b94189e Video: Recognize MagicYUV in the probe and exclude the VFW wrapper #5617
Recognize MagicYUV sample entries in the built-in go-mp4 probe and consider the
probe's codec in addition to the metadata codec when applying the FFmpeg exclude
list, so a video can be matched even when one detector misses it. Rename the
shared sample-entry scan limit to CodecHeadScanLimit.

Also exclude the Matroska Video for Windows wrapper (v_ms/vfw/fourcc) by default,
since its actual codec is not exposed by metadata and the format is uncommon.
2026-05-30 21:29:12 +00:00

34 lines
957 B
Go

package ffmpeg
import (
"sync/atomic"
"github.com/photoprism/photoprism/pkg/media/video"
)
// excludePtr atomically holds the active FFmpeg exclude list so updates
// from Config.Propagate do not tear concurrent reads on workers and CLI
// commands.
var excludePtr atomic.Pointer[video.Formats]
// DefaultExclude is the comma-separated list of container and codec formats
// that should not be processed by FFmpeg by default.
var DefaultExclude string
func init() {
f := video.NewFormats(video.CodecMagicYUV, video.CodecVFW)
excludePtr.Store(&f)
DefaultExclude = f.String()
}
// Exclude returns the current FFmpeg exclude list. The returned map must not
// be mutated; publish a new list via SetExclude instead.
func Exclude() video.Formats {
return *excludePtr.Load()
}
// SetExclude replaces the active FFmpeg exclude list atomically. The caller
// must not mutate f after the call.
func SetExclude(f video.Formats) {
excludePtr.Store(&f)
}