M2TS: Extract embedded metadata with ExifTool #4982 #4892 #5040

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer
2025-06-11 19:22:20 +02:00
parent 6fa0ab4734
commit 86fe4404ef
7 changed files with 9 additions and 9 deletions

View File

@@ -10,7 +10,6 @@ import (
"github.com/photoprism/photoprism/pkg/clean"
"github.com/photoprism/photoprism/pkg/fs"
"github.com/photoprism/photoprism/pkg/media"
)
// ToJson uses exiftool to export metadata to a json file.
@@ -34,8 +33,9 @@ func (w *Convert) ToJson(f *MediaFile, force bool) (jsonName string, err error)
// Command arguments.
var args []string
// Also extract embedded metadata from videos and live photos.
if f.IsVideo() || f.MetaData().MediaType == media.Live {
// Extract embedded metadata from MPEG-2 transport stream and AVCHD video files
// see https://exiftool.org/exiftool_pod.html#ee-NUM--extractEmbedded for details.
if f.IsM2TS() {
args = []string{"-n", "-ee", "-m", "-api", "LargeFileSupport", "-j", f.FileName()}
} else {
args = []string{"-n", "-m", "-api", "LargeFileSupport", "-j", f.FileName()}

View File

@@ -822,7 +822,7 @@ func (m *MediaFile) IsAvifS() bool {
func (m *MediaFile) IsM2TS() bool {
if t := fs.FileType(m.fileName); t == fs.VideoM2TS {
return true
} else if t == fs.VideoMp4 || t == fs.VideoAvcHD {
} else if t == fs.VideoMp4 || t == fs.VideoAVCHD {
return m.HasMimeType(header.ContentTypeM2TS)
}

View File

@@ -159,7 +159,7 @@ var Extensions = FileExtensions{
".m2t": VideoM2TS,
".m2ts": VideoM2TS,
".mp2t": VideoM2TS,
".mts": VideoAvcHD,
".mts": VideoAVCHD,
".ogv": VideoTheora,
".ogg": VideoTheora,
".ogx": VideoTheora,

View File

@@ -52,7 +52,7 @@ var TypeInfo = TypeMap{
VideoMpeg: "Moving Picture Experts Group (MPEG)",
VideoMjpeg: "Motion JPEG",
VideoM2TS: "MPEG-2 Transport Stream (M2TS)",
VideoAvcHD: "Advanced Video Coding High Definition (AVCHD)",
VideoAVCHD: "Advanced Video Coding High Definition (AVCHD)",
VideoTheora: "Ogg Media (OGG)",
SidecarXMP: "Adobe Extensible Metadata Platform",
SidecarAppleXml: "Apple Image Edits XML",

View File

@@ -88,7 +88,7 @@ const (
Video3G2 Type = "3g2" // Similar to 3GP, consumes less space & bandwidth
VideoFlash Type = "flv" // Flash Video
VideoM2TS Type = "m2t" // MPEG-2 Transport Stream (M2TS)
VideoAvcHD Type = "mts" // AVCHD (Advanced Video Coding High Definition)
VideoAVCHD Type = "mts" // AVCHD (Advanced Video Coding High Definition)
VideoTheora Type = "ogv" // Ogg container format maintained by the Xiph.Org, free and open
VideoASF Type = "asf" // Advanced Systems/Streaming Format (ASF)
VideoAVI Type = "avi" // Microsoft Audio Video Interleave (AVI)

View File

@@ -30,7 +30,7 @@ func MimeType(filename string) (mimeType string) {
// formats, which otherwise cannot be reliably distinguished:
switch fileType {
// MPEG-2 Transport Stream
case VideoM2TS, VideoAvcHD:
case VideoM2TS, VideoAVCHD:
return header.ContentTypeM2TS
// Apple QuickTime Container
case VideoMov:

View File

@@ -57,7 +57,7 @@ var Formats = map[fs.Type]Type{
fs.Video3G2: Video,
fs.VideoFlash: Video,
fs.VideoM2TS: Video,
fs.VideoAvcHD: Video,
fs.VideoAVCHD: Video,
fs.VideoTheora: Video,
fs.VideoASF: Video,
fs.VideoWMV: Video,