Metadata: Add test for mov video JSON files #3559
Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
parent
8ed9f3f409
commit
5822a26b8c
3 changed files with 127 additions and 0 deletions
|
@ -12,6 +12,35 @@ import (
|
|||
)
|
||||
|
||||
func TestJSON(t *testing.T) {
|
||||
t.Run("mov.json", func(t *testing.T) {
|
||||
data, err := JSON("testdata/mov.json", "")
|
||||
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// t.Logf("DATA: %#v", data)
|
||||
|
||||
assert.Equal(t, "20230602_100151_361985AB.mov", data.FileName)
|
||||
assert.Equal(t, CodecHvc1, data.Codec)
|
||||
assert.Equal(t, int64(1420), data.Duration.Milliseconds())
|
||||
assert.Equal(t, "1.42s", data.Duration.String())
|
||||
assert.Equal(t, "2023-06-02 12:01:51 +0000 UTC", data.TakenAtLocal.String())
|
||||
assert.Equal(t, "2023-06-02 10:01:51 +0000 UTC", data.TakenAt.String())
|
||||
assert.Equal(t, 0, data.TakenNs)
|
||||
assert.Equal(t, "Europe/Berlin", data.TimeZone)
|
||||
assert.Equal(t, 1920, data.Width)
|
||||
assert.Equal(t, 1440, data.Height)
|
||||
assert.Equal(t, 1920, data.ActualWidth())
|
||||
assert.Equal(t, 1440, data.ActualHeight())
|
||||
assert.Equal(t, 1, data.Orientation)
|
||||
assert.Equal(t, float32(52.5035), data.Lat)
|
||||
assert.Equal(t, float32(13.4098), data.Lng)
|
||||
assert.Equal(t, "Apple", data.CameraMake)
|
||||
assert.Equal(t, "iPhone 12 mini", data.CameraModel)
|
||||
assert.Equal(t, "", data.LensModel)
|
||||
})
|
||||
|
||||
t.Run("iphone-mov.json", func(t *testing.T) {
|
||||
data, err := JSON("testdata/iphone-mov.json", "")
|
||||
|
||||
|
|
97
internal/meta/testdata/mov.json
vendored
Normal file
97
internal/meta/testdata/mov.json
vendored
Normal file
|
@ -0,0 +1,97 @@
|
|||
[{
|
||||
"SourceFile": "/go/src/github.com/photoprism/photoprism/storage/originals/live/HEIC_PRIVATE_issue3559/20230602_100151_361985AB.mov",
|
||||
"ExifToolVersion": 12.56,
|
||||
"FileName": "20230602_100151_361985AB.mov",
|
||||
"Directory": "/go/src/github.com/photoprism/photoprism/storage/originals/live/HEIC_PRIVATE_issue3559",
|
||||
"FileSize": 2732986,
|
||||
"FileModifyDate": "2023:06:02 23:21:14+00:00",
|
||||
"FileAccessDate": "2023:08:15 10:42:20+00:00",
|
||||
"FileInodeChangeDate": "2023:08:15 10:42:20+00:00",
|
||||
"FilePermissions": 100664,
|
||||
"FileType": "MOV",
|
||||
"FileTypeExtension": "MOV",
|
||||
"MIMEType": "video/quicktime",
|
||||
"MajorBrand": "qt ",
|
||||
"MinorVersion": "0.0.0",
|
||||
"CompatibleBrands": ["qt "],
|
||||
"MediaDataSize": 2725185,
|
||||
"MediaDataOffset": 36,
|
||||
"MovieHeaderVersion": 0,
|
||||
"CreateDate": "2023:06:02 10:01:51",
|
||||
"ModifyDate": "2023:06:02 10:01:52",
|
||||
"TimeScale": 600,
|
||||
"Duration": 1.41666666666667,
|
||||
"PreferredRate": 1,
|
||||
"PreferredVolume": 1,
|
||||
"PreviewTime": 0,
|
||||
"PreviewDuration": 0,
|
||||
"PosterTime": 0,
|
||||
"SelectionTime": 0,
|
||||
"SelectionDuration": 0,
|
||||
"CurrentTime": 0,
|
||||
"NextTrackID": 6,
|
||||
"TrackHeaderVersion": 0,
|
||||
"TrackCreateDate": "2023:06:02 10:01:51",
|
||||
"TrackModifyDate": "2023:06:02 10:01:52",
|
||||
"TrackID": 1,
|
||||
"TrackDuration": 1.41666666666667,
|
||||
"TrackLayer": 0,
|
||||
"TrackVolume": 0,
|
||||
"ImageWidth": 1920,
|
||||
"ImageHeight": 1440,
|
||||
"CleanApertureDimensions": "1744 1308",
|
||||
"ProductionApertureDimensions": "1920 1440",
|
||||
"EncodedPixelsDimensions": "1920 1440",
|
||||
"GraphicsMode": 64,
|
||||
"OpColor": "32768 32768 32768",
|
||||
"CompressorID": "hvc1",
|
||||
"SourceImageWidth": 1920,
|
||||
"SourceImageHeight": 1440,
|
||||
"XResolution": 72,
|
||||
"YResolution": 72,
|
||||
"CompressorName": "HEVC",
|
||||
"BitDepth": 24,
|
||||
"VideoFrameRate": 28.9411764705882,
|
||||
"Balance": 0,
|
||||
"AudioFormat": "lpcm",
|
||||
"AudioChannels": 3,
|
||||
"AudioBitsPerSample": 16,
|
||||
"AudioSampleRate": 1,
|
||||
"MatrixStructure": "1 0 0 0 1 0 0 0 1",
|
||||
"ContentDescribes": 1,
|
||||
"MediaHeaderVersion": 0,
|
||||
"MediaCreateDate": "2023:06:02 10:01:51",
|
||||
"MediaModifyDate": "2023:06:02 10:01:52",
|
||||
"MediaTimeScale": 600,
|
||||
"MediaDuration": "0.00166666666666667",
|
||||
"MediaLanguageCode": "und",
|
||||
"GenMediaVersion": 0,
|
||||
"GenFlags": "0 0 0",
|
||||
"GenGraphicsMode": 64,
|
||||
"GenOpColor": "32768 32768 32768",
|
||||
"GenBalance": 0,
|
||||
"HandlerClass": "dhlr",
|
||||
"HandlerVendorID": "appl",
|
||||
"HandlerDescription": "Core Media Data Handler",
|
||||
"MetaFormat": "mebx",
|
||||
"HandlerType": "mdta",
|
||||
"LocationAccuracyHorizontal": 40.000000,
|
||||
"LivePhotoAuto": 1,
|
||||
"ContentIdentifier": "5AF5B6DF-4739-4C8D-BDE7-AED7893D6468",
|
||||
"LivePhotoVitalityScore": 0.939396440982819,
|
||||
"LivePhotoVitalityScoringVersion": 4,
|
||||
"GPSCoordinates": "52.5035 13.4098 36.608",
|
||||
"Make": "Apple",
|
||||
"Model": "iPhone 12 mini",
|
||||
"Software": "16.4.1",
|
||||
"CreationDate": "2023:06:02 12:01:51+02:00",
|
||||
"ImageSize": "1920 1440",
|
||||
"Megapixels": 2.7648,
|
||||
"AvgBitrate": 15389280,
|
||||
"GPSAltitude": 36.608,
|
||||
"GPSAltitudeRef": 0,
|
||||
"GPSLatitude": 52.5035,
|
||||
"GPSLongitude": 13.4098,
|
||||
"Rotation": 0,
|
||||
"GPSPosition": "52.5035 13.4098"
|
||||
}]
|
|
@ -7,6 +7,7 @@ import (
|
|||
const CodecUnknown = ""
|
||||
const CodecAv1 = string(video.CodecAV1)
|
||||
const CodecAvc1 = string(video.CodecAVC)
|
||||
const CodecHvc1 = string(video.CodecHEVC)
|
||||
const CodecJpeg = "jpeg"
|
||||
const CodecHeic = "heic"
|
||||
const CodecXMP = "xmp"
|
||||
|
|
Loading…
Reference in a new issue