Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:add crude CR3 support #624

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

feat:add crude CR3 support #624

wants to merge 4 commits into from

Conversation

TSGames
Copy link

@TSGames TSGames commented Aug 23, 2023

This solves issue #374 by porting the Dotnet implementation to Java

Readout of a random CR3 file gave the following data:

-------------------------------------------------
 Using ImageMetadataReader-------------------------------------------------

[QuickTime] Major Brand - Unknown
[QuickTime] Minor Version - 1
[QuickTime] Compatible Brands - [Unknown, MP4� Base Media v1 [IS0 14496-12:2003]]
[Exif IFD0] Image Width - 6960 pixels
[Exif IFD0] Image Height - 4640 pixels
[Exif IFD0] Bits Per Sample - 8 8 8 bits/component/pixel
[Exif IFD0] Compression - JPEG (old-style)
[Exif IFD0] Make - Canon
[Exif IFD0] Model - Canon EOS R7
[Exif IFD0] Orientation - Left side, bottom (Rotate 270 CW)
[Exif IFD0] X Resolution - 72 dots per inch
[Exif IFD0] Y Resolution - 72 dots per inch
[Exif IFD0] Resolution Unit - Inch
[Exif IFD0] Date/Time - 2022:05:18 21:37:32
[Exif IFD0] Artist - 
[Exif IFD0] Copyright - 
[Canon Makernote] Unknown tag (0xc100) - 112
[Canon Makernote] Macro Mode - Normal
[Canon Makernote] Self Timer Delay - Self timer not used
[Canon Makernote] Quality - RAW
[Canon Makernote] Flash Mode - No flash fired
[Canon Makernote] Continuous Drive Mode - Single shot
[Canon Makernote] Unknown Camera Setting 2 - 0
[Canon Makernote] Focus Mode - One-shot
[Canon Makernote] Unknown Camera Setting 3 - 0
[Canon Makernote] Record Mode - Unknown (13)
[Canon Makernote] Image Size - Large
[Canon Makernote] Easy Shooting Mode - Manual
[Canon Makernote] Digital Zoom - No digital zoom
[Canon Makernote] Contrast - Normal
[Canon Makernote] Saturation - Normal
[Canon Makernote] Sharpness - Unknown (32767)
[Canon Makernote] Iso - Auto
[Canon Makernote] Metering Mode - Evaluative
[Canon Makernote] Focus Type - Auto
[Canon Makernote] AF Point Selected - Unknown (0)
[Canon Makernote] Exposure Mode - Av-priority
[Canon Makernote] Unknown Camera Setting 7 - 32767
[Canon Makernote] Lens Type - Unknown (61182)
[Canon Makernote] Long Focal Length - 105 1
[Canon Makernote] Short Focal Length - 24 1
[Canon Makernote] Focal Units per mm - 1
[Canon Makernote] Max Aperture - f/4,2
[Canon Makernote] Min Aperture - f/22,6
[Canon Makernote] Flash Activity - Flash did not fire
[Canon Makernote] Flash Details - Unknown (8)
[Canon Makernote] Focus Continuous - Single
[Canon Makernote] AE Setting - Normal AE
[Canon Makernote] Focus Mode - Single
[Canon Makernote] Display Aperture - 65535
[Canon Makernote] Zoom Source Width - 257
[Canon Makernote] Zoom Target Width - 0
[Canon Makernote] Unknown tag (0xc124) - 0
[Canon Makernote] Spot Metering Mode - Center
[Canon Makernote] Photo Effect - Off
[Canon Makernote] Manual Flash Output - Unknown (65535)
[Canon Makernote] Unknown tag (0xc128) - 65535
[Canon Makernote] Color Tone - 0
[Canon Makernote] Unknown tag (0xc12a) - 0
[Canon Makernote] Unknown tag (0xc12b) - 32767
[Canon Makernote] Unknown tag (0xc12c) - 0
[Canon Makernote] SRAW Quality - Unknown (65535)
[Canon Makernote] Unknown tag (0xc12e) - 0
[Canon Makernote] Unknown tag (0xc12f) - 0
[Canon Makernote] Unknown tag (0xc130) - 3
[Canon Makernote] Unknown tag (0xc131) - 65535
[Canon Makernote] Unknown tag (0xc132) - 0
[Canon Makernote] Unknown tag (0xc133) - 0
[Canon Makernote] Unknown tag (0xc134) - 0
[Canon Makernote] Unknown tag (0xc135) - 0
[Canon Makernote] Unknown tag (0xc136) - 65535
[Canon Makernote] Unknown tag (0xc137) - 65535
[Canon Makernote] Unknown tag (0xc200) - 2
[Canon Makernote] Unknown tag (0xc201) - 47
[Canon Makernote] Unknown tag (0xc202) - 2064
[Canon Makernote] Unknown tag (0xc203) - 20641
[Canon Makernote] Unknown tag (0x0003) - 0 0 0 0
[Canon Makernote] Unknown tag (0xc400) - 68
[Canon Makernote] Auto ISO - 0
[Canon Makernote] Base ISO - 352
[Canon Makernote] Measured EV - 4
[Canon Makernote] Target Aperture - 160
[Canon Makernote] Target Exposure Time - 180
[Canon Makernote] Exposure Compensation - 12
[Canon Makernote] White Balance - 0
[Canon Makernote] Slow Shutter - 3
[Canon Makernote] Sequence Number - 0
[Canon Makernote] Optical Zoom Code - 44
[Canon Makernote] Unknown tag (0xc40b) - 8
[Canon Makernote] Camera Temperature - 153
[Canon Makernote] Flash Guide Number - 0
[Canon Makernote] AF Points in Focus - 0
[Canon Makernote] Flash Exposure Compensation - 0
[Canon Makernote] Auto Exposure Bracketing - 0
[Canon Makernote] AEB Bracket Value - 0
[Canon Makernote] Control Mode - 1
[Canon Makernote] Focus Distance Upper - 8191
[Canon Makernote] Focus Distance Lower - 65535
[Canon Makernote] F Number - 160
[Canon Makernote] Exposure Time - 184
[Canon Makernote] Measured EV 2 - 65500
[Canon Makernote] Bulb Duration - 0
[Canon Makernote] Unknown tag (0xc419) - 0
[Canon Makernote] Camera Type - 248
[Canon Makernote] Auto Rotate - 3
[Canon Makernote] ND Filter - 0
[Canon Makernote] Self Timer 2 - 65535
[Canon Makernote] Unknown tag (0xc41e) - 65535
[Canon Makernote] Unknown tag (0xc41f) - 0
[Canon Makernote] Unknown tag (0xc420) - 0
[Canon Makernote] Flash Output - 0
[Canon Makernote] Image Type - Canon EOS R7
[Canon Makernote] Firmware Version - Firmware Version 1.0.1
[Canon Makernote] Owner Name - 
[Canon Makernote] Canon Model ID - 2147484772
[Canon Makernote] Thumbnail Image Valid Area - 0 159 6 113
[Canon Makernote] Unknown tag (0x0019) - 1
[Canon Makernote] AF Info Array 2 - [2736 values]
[Canon Makernote] Image Unique ID - 39 46 90 14 88 242 66 34 179 36 78 248 222 139 4 118
[Canon Makernote] Unknown tag (0x0032) - 44 1 5 240791076 574812760 4165870771 1980009438 0 0 0 0
[Canon Makernote] Unknown tag (0x0033) - 3227659809 574764882 4165870771 1980009438
[Canon Makernote] Unknown tag (0x0035) - 16 4294966996 27 0
[Canon Makernote] Unknown tag (0x0038) - [76 values]
[Canon Makernote] Unknown tag (0x003d) - 48 1 3 1 0 0 0 0 0 0 0 1
[Canon Makernote] Unknown tag (0x003f) - 17
[Canon Makernote] File Info Array - [83 values]
[Canon Makernote] Lens Model - RF24-105mm F4 L IS USM
[Canon Makernote] Serial Info Array - LQ0003404
[Canon Makernote] Dust Removal Data - [1024 values]
[Canon Makernote] Crop Info - 0 0 0 0
[Canon Makernote] Custom Functions Array 2 - [189 values]
[Canon Makernote] Aspect Information Array - 0 6960 4640 0 0
[Canon Makernote] Processing Information Array - [18 values]
[Canon Makernote] Measured Color Array - 12 1015 1024 1024 606 0
[Canon Makernote] Color Space - 1
[Canon Makernote] VRD Offset - 0
[Canon Makernote] Sensor Information Array - [17 values]
[Canon Makernote] Black Level - 135 135 135
[Canon Makernote] Unknown tag (0x4009) - 0 0 0
[Canon Makernote] Custom Picture Style File Name - 
[Canon Makernote] Unknown tag (0x4011) - [252 values]
[Canon Makernote] Unknown tag (0x4012) - 
[Canon Makernote] Color Info Array - 44 0 0 10 4294967295 0 10 0 10 0 10
[Canon Makernote] Vignetting Correction Array 2 - 40 0 1 0 1 1 1 0 1 1
[Canon Makernote] Lighting Optimizer Array - 60 0 0 0 0 0 1 0 1 1 1 0 1 0 0
[Canon Makernote] Lens Info Array - [30 values]
[Canon Makernote] Ambiance Info Array - 32 0 0 0 2147483647 0 1 1
[Canon Makernote] Unknown tag (0x4021) - 20 0 0 0 1
[Canon Makernote] Filter Info Array - [53 values]
[Canon Makernote] Unknown tag (0x4025) - 44 0 0 0 0 0 0 0 0 0 0
[Canon Makernote] Unknown tag (0x4027) - 24 329733 1275068448 0 13684944 131078
[Canon Makernote] Unknown tag (0x4028) - [27 values]
[Canon Makernote] Unknown tag (0x402c) - 8 0
[Canon Makernote] Unknown tag (0x4031) - [109 values]
[Canon Makernote] Unknown tag (0x4035) - [556 values]
[Canon Makernote] Unknown tag (0x4037) - [24 values]
[Canon Makernote] Unknown tag (0x4039) - 36 46 90 14 88 242 66 34 179 36 78 248 222 139 4 118
[Canon Makernote] Unknown tag (0x403a) - [256 values]
[Canon Makernote] Unknown tag (0x403c) - 12 1 4294967295
[Canon Makernote] Unknown tag (0x403f) - 12 0 0
[Canon Makernote] Unknown tag (0x4040) - 40 0 0 0 0 0 0 0 0 1
[Canon Makernote] Unknown tag (0x4049) - 8 0 0 0
[Canon Makernote] Unknown tag (0x404b) - 65535 65535
[Canon Makernote] Unknown tag (0x404f) - 10 0 0 0 0
[Canon Makernote] Unknown tag (0x4051) - [42 values]
[Canon Makernote] Unknown tag (0x4053) - 36 0 0 0 0 0 0 0 0
[Canon Makernote] Unknown tag (0x4054) - [128 values]
[Canon Makernote] Unknown tag (0x4056) - [195 values]
ERROR: Atom size too large.
ERROR: Atom size too small.
[Canon Makernote] Unknown tag (0x4058) - 20 1333788672 0 0 2
[File Type] Detected File Type Name - CRX
[File Type] Detected File Type Long Name - Canon Camera Raw
[File Type] Expected File Name Extension - cr3
[File] File Name - Y-JG-CANON-EOS-R7-0002.CR3
[File] File Size - 41496922 bytes
[File] File Modified Date - Di Aug 22 17:43:42 +02:00 2023

All credits to @dmitry-shechtman

@TSGames
Copy link
Author

TSGames commented Aug 24, 2023

Sorry, there was an error in the code that caused misaligning of the atoms and some headers (i.e. the ExifSubIFD not being read). I've updated the PR, here's now the full parse result:


-------------------------------------------------
 Using ImageMetadataReader-------------------------------------------------

[QuickTime] Major Brand - Unknown
[QuickTime] Minor Version - 1
[QuickTime] Compatible Brands - [Unknown, MP4� Base Media v1 [IS0 14496-12:2003]]
[QuickTime] Rotation - 0
[Exif IFD0] Image Width - 6000 pixels
[Exif IFD0] Image Height - 4000 pixels
[Exif IFD0] Bits Per Sample - 8 8 8 bits/component/pixel
[Exif IFD0] Compression - JPEG (old-style)
[Exif IFD0] Make - Canon
[Exif IFD0] Model - Canon EOS M50
[Exif IFD0] Orientation - Top, left side (Horizontal / normal)
[Exif IFD0] X Resolution - 72 dots per inch
[Exif IFD0] Y Resolution - 72 dots per inch
[Exif IFD0] Resolution Unit - Inch
[Exif IFD0] Date/Time - 2018:03:30 14:37:59
[Exif IFD0] Artist - 
[Exif IFD0] Copyright - 
[Exif SubIFD] Exposure Time - 1/640 sec
[Exif SubIFD] F-Number - f/8,0
[Exif SubIFD] Exposure Program - Aperture priority
[Exif SubIFD] ISO Speed Ratings - 100
[Exif SubIFD] Sensitivity Type - Recommended Exposure Index
[Exif SubIFD] Recommended Exposure Index - 100
[Exif SubIFD] Exif Version - 2.31
[Exif SubIFD] Date/Time Original - 2018:03:30 14:37:59
[Exif SubIFD] Date/Time Digitized - 2018:03:30 14:37:59
[Exif SubIFD] Time Zone - -04:00
[Exif SubIFD] Time Zone Original - -04:00
[Exif SubIFD] Time Zone Digitized - -04:00
[Exif SubIFD] Components Configuration - YCbCr
[Exif SubIFD] Shutter Speed Value - 1/663 sec
ERROR: End of data reached.
[Exif SubIFD] Aperture Value - f/8,0
[Exif SubIFD] Exposure Bias Value - 0 EV
[Exif SubIFD] Metering Mode - Multi-segment
[Exif SubIFD] Flash - Flash did not fire
[Exif SubIFD] Focal Length - 15 mm
[Exif SubIFD] User Comment - 
[Exif SubIFD] Sub-Sec Time - 65
[Exif SubIFD] Sub-Sec Time Original - 65
[Exif SubIFD] Sub-Sec Time Digitized - 65
[Exif SubIFD] FlashPix Version - 1.00
[Exif SubIFD] Color Space - sRGB
[Exif SubIFD] Exif Image Width - 6000 pixels
[Exif SubIFD] Exif Image Height - 4000 pixels
[Exif SubIFD] Focal Plane X Resolution - 307/2000000 inches
[Exif SubIFD] Focal Plane Y Resolution - 297/2000000 inches
[Exif SubIFD] Focal Plane Resolution Unit - Inches
[Exif SubIFD] Custom Rendered - Normal process
[Exif SubIFD] Exposure Mode - Auto exposure
[Exif SubIFD] White Balance Mode - Auto white balance
[Exif SubIFD] Scene Capture Type - Standard
[Exif SubIFD] Camera Owner Name - 
[Exif SubIFD] Body Serial Number - 632041002597
[Exif SubIFD] Lens Specification - 15-45mm
[Exif SubIFD] Lens Model - EF-M15-45mm f/3.5-6.3 IS STM
[Exif SubIFD] Lens Serial Number - 0000000000
[Canon Makernote] Unknown tag (0xc100) - 98
[Canon Makernote] Macro Mode - Normal
[Canon Makernote] Self Timer Delay - Self timer not used
[Canon Makernote] Quality - RAW
[Canon Makernote] Flash Mode - No flash fired
[Canon Makernote] Continuous Drive Mode - Single shot
[Canon Makernote] Unknown Camera Setting 2 - 0
[Canon Makernote] Focus Mode - Unknown (256)
[Canon Makernote] Unknown Camera Setting 3 - 0
[Canon Makernote] Record Mode - Unknown (13)
[Canon Makernote] Image Size - Large
[Canon Makernote] Easy Shooting Mode - Manual
[Canon Makernote] Digital Zoom - No digital zoom
[Canon Makernote] Contrast - Normal
[Canon Makernote] Saturation - Normal
[Canon Makernote] Sharpness - Unknown (32767)
[Canon Makernote] Iso - 16383
[Canon Makernote] Metering Mode - Evaluative
[Canon Makernote] Focus Type - Unknown (2)
[Canon Makernote] AF Point Selected - Unknown (0)
[Canon Makernote] Exposure Mode - Av-priority
[Canon Makernote] Unknown Camera Setting 7 - 65535
[Canon Makernote] Lens Type - Canon EF-M 15-45mm f/3.5-6.3 IS STM
[Canon Makernote] Long Focal Length - 45 1
[Canon Makernote] Short Focal Length - 15 1
[Canon Makernote] Focal Units per mm - 1
[Canon Makernote] Max Aperture - f/3,6
[Canon Makernote] Min Aperture - f/22,6
[Canon Makernote] Flash Activity - Flash did not fire
[Canon Makernote] Flash Details - Unknown (8)
[Canon Makernote] Focus Continuous - Single
[Canon Makernote] AE Setting - Normal AE
[Canon Makernote] Focus Mode - Unknown (65535)
[Canon Makernote] Display Aperture - 65535
[Canon Makernote] Zoom Source Width - 65535
[Canon Makernote] Zoom Target Width - 0
[Canon Makernote] Unknown tag (0xc124) - 0
[Canon Makernote] Spot Metering Mode - Center
[Canon Makernote] Photo Effect - Off
[Canon Makernote] Manual Flash Output - Unknown (65535)
[Canon Makernote] Unknown tag (0xc128) - 65535
[Canon Makernote] Color Tone - 0
[Canon Makernote] Unknown tag (0xc12a) - 0
[Canon Makernote] Unknown tag (0xc12b) - 32767
[Canon Makernote] Unknown tag (0xc12c) - 65535
[Canon Makernote] SRAW Quality - Unknown (65535)
[Canon Makernote] Unknown tag (0xc12e) - 0
[Canon Makernote] Unknown tag (0xc12f) - 0
[Canon Makernote] Unknown tag (0xc130) - 3
[Canon Makernote] Unknown tag (0xc200) - 0
[Canon Makernote] Unknown tag (0xc201) - 15
[Canon Makernote] Unknown tag (0xc202) - 25518
[Canon Makernote] Unknown tag (0xc203) - 18461
[Canon Makernote] Unknown tag (0x0003) - 100 0 0 0
[Canon Makernote] Unknown tag (0xc400) - 68
[Canon Makernote] Auto ISO - 0
[Canon Makernote] Base ISO - 160
[Canon Makernote] Measured EV - 328
[Canon Makernote] Target Aperture - 192
[Canon Makernote] Target Exposure Time - 300
[Canon Makernote] Exposure Compensation - 0
[Canon Makernote] White Balance - 0
[Canon Makernote] Slow Shutter - 3
[Canon Makernote] Sequence Number - 0
[Canon Makernote] Optical Zoom Code - 8
[Canon Makernote] Unknown tag (0xc40b) - 8
[Canon Makernote] Camera Temperature - 156
[Canon Makernote] Flash Guide Number - 0
[Canon Makernote] AF Points in Focus - 0
[Canon Makernote] Flash Exposure Compensation - 0
[Canon Makernote] Auto Exposure Bracketing - 0
[Canon Makernote] AEB Bracket Value - 0
[Canon Makernote] Control Mode - 1
[Canon Makernote] Focus Distance Upper - 0
[Canon Makernote] Focus Distance Lower - 0
[Canon Makernote] F Number - 192
[Canon Makernote] Exposure Time - 296
[Canon Makernote] Measured EV 2 - 170
[Canon Makernote] Bulb Duration - 0
[Canon Makernote] Unknown tag (0xc419) - 0
[Canon Makernote] Camera Type - 248
[Canon Makernote] Auto Rotate - 0
[Canon Makernote] ND Filter - 65535
[Canon Makernote] Self Timer 2 - 65535
[Canon Makernote] Unknown tag (0xc41e) - 65535
[Canon Makernote] Unknown tag (0xc41f) - 0
[Canon Makernote] Unknown tag (0xc420) - 0
[Canon Makernote] Flash Output - 0
[Canon Makernote] Image Type - Canon EOS M50
[Canon Makernote] Firmware Version - Firmware Version 1.0.0
[Canon Makernote] Owner Name - 
[Canon Makernote] Canon Model ID - 1042
[Canon Makernote] Thumbnail Image Valid Area - 0 159 6 113
[Canon Makernote] Unknown tag (0x0019) - 1
[Canon Makernote] AF Info Array 2 - [608 values]
[Canon Makernote] Image Unique ID - 191 81 136 89 18 244 118 178 44 187 87 134 169 78 134 135
[Canon Makernote] Unknown tag (0x0033) - 3456521088 2994094446 2253896492 2273726121
[Canon Makernote] Unknown tag (0x0035) - 16 4294967056 27 60
[Canon Makernote] Unknown tag (0x0038) - [76 values]
[Canon Makernote] Unknown tag (0x003d) - 48 1 4 0 0 0 0 0 0 0 0 1
[Canon Makernote] Unknown tag (0x003f) - 17
[Canon Makernote] File Info Array - [66 values]
[Canon Makernote] Lens Model - EF-M15-45mm f/3.5-6.3 IS STM
[Canon Makernote] Serial Info Array - CJ0255046
[Canon Makernote] Dust Removal Data - [1024 values]
[Canon Makernote] Crop Info - 0 0 0 0
[Canon Makernote] Custom Functions Array 2 - [35 values]
[Canon Makernote] Aspect Information Array - 0 6000 4000 0 0
[Canon Makernote] Processing Information Array - [18 values]
[Canon Makernote] Measured Color Array - 12 459 1024 1024 1088 0
[Canon Makernote] Color Space - 1
[Canon Makernote] VRD Offset - 0
[Canon Makernote] Sensor Information Array - [17 values]
[Canon Makernote] Black Level - 135 135 135
[Canon Makernote] Unknown tag (0x4009) - 0 0 0
[Canon Makernote] Custom Picture Style File Name - 
[Canon Makernote] Unknown tag (0x4011) - [252 values]
[Canon Makernote] Unknown tag (0x4012) - 
[Canon Makernote] Color Info Array - 44 0 0 10 4294967295 0 10 0 10 0 10
[Canon Makernote] Vignetting Correction Array 2 - 40 0 1 0 1 1 1 0 1 0
[Canon Makernote] Lighting Optimizer Array - 52 0 0 0 0 0 1 0 1 1 0 0 1
[Canon Makernote] Lens Info Array - [30 values]
[Canon Makernote] Ambiance Info Array - 32 0 0 0 2147483647 0 1 1
[Canon Makernote] Filter Info Array - [53 values]
[Canon Makernote] Unknown tag (0x4025) - 36 0 0 0 0 0 0 0 0
[Canon Makernote] Unknown tag (0x4027) - 24 394240 872415232 0 13684944 196609
[Canon Makernote] Unknown tag (0x402c) - 8 0
[Canon Makernote] Unknown tag (0x4035) - [556 values]
[Canon Makernote] Unknown tag (0x4037) - [24 values]
[Canon Makernote] Unknown tag (0x4039) - 191 81 136 89 18 244 118 178 44 187 87 134 169 78 134 135
[Canon Makernote] Unknown tag (0x403c) - 12 1 5
[GPS] GPS Version ID - 2.300
[QuickTime Video] Creation Time - Fr M�r 30 20:37:59 +02:00 2018
[QuickTime Video] Modification Time - Fr M�r 30 20:37:59 +02:00 2018
[QuickTime Video] Opcolor - 0 0 0
[QuickTime Video] Graphics Mode - Copy
[QuickTime Video] Vendor - Unknown
[QuickTime Video] Compression Type - Unknown
[QuickTime Video] Temporal Quality - 0
[QuickTime Video] Spatial Quality - 0
[QuickTime Video] Width - 6000 pixels
[QuickTime Video] Height - 4000 pixels
[QuickTime Video] Depth - 24-bit color
[QuickTime Video] Color Table - None
[QuickTime Video] Horizontal Resolution - 72
[QuickTime Video] Vertical Resolution - 72
[QuickTime Video] Frame Rate - 1
[QuickTime Video] Creation Time - Fr M�r 30 20:37:59 +02:00 2018
[QuickTime Video] Modification Time - Fr M�r 30 20:37:59 +02:00 2018
[QuickTime Video] Opcolor - 0 0 0
[QuickTime Video] Graphics Mode - Copy
[QuickTime Video] Vendor - Unknown
[QuickTime Video] Compression Type - Unknown
[QuickTime Video] Temporal Quality - 0
[QuickTime Video] Spatial Quality - 0
[QuickTime Video] Width - 1624 pixels
[QuickTime Video] Height - 1080 pixels
[QuickTime Video] Depth - 24-bit color
[QuickTime Video] Color Table - None
[QuickTime Video] Horizontal Resolution - 72
[QuickTime Video] Vertical Resolution - 72
[QuickTime Video] Frame Rate - 1
[QuickTime Video] Creation Time - Fr M�r 30 20:37:59 +02:00 2018
[QuickTime Video] Modification Time - Fr M�r 30 20:37:59 +02:00 2018
[QuickTime Video] Opcolor - 0 0 0
[QuickTime Video] Graphics Mode - Copy
[QuickTime Video] Vendor - Unknown
[QuickTime Video] Compression Type - Unknown
[QuickTime Video] Temporal Quality - 0
[QuickTime Video] Spatial Quality - 0
[QuickTime Video] Width - 6288 pixels
[QuickTime Video] Height - 4056 pixels
[QuickTime Video] Depth - 24-bit color
[QuickTime Video] Color Table - None
[QuickTime Video] Horizontal Resolution - 72
[QuickTime Video] Vertical Resolution - 72
[QuickTime Video] Frame Rate - 1
[File Type] Detected File Type Name - CRX
[File Type] Detected File Type Long Name - Canon Camera Raw
[File Type] Expected File Name Extension - cr3
[File] File Name - IMG_0482_raw.CR3
[File] File Size - 26408085 bytes
[File] File Modified Date - Do Aug 24 20:46:28 +02:00 2023

@TSGames
Copy link
Author

TSGames commented Aug 25, 2023

@drewnoakes I'm not sure regarding required tests for the cr3 format parsing. I would be glad to support here but I guess I need some detail on best practices/required configuration, I'm not too deep into the libraries structure

@drewnoakes
Copy link
Owner

Thanks very much for tackling this @TSGames! I appreciate the comprehensive PR.

The Java and .NET implementations for QuickTime handling are quite different which has historically made porting code between them difficult. I don't know which of the implementations produces the more preferable output either. At some point we should consolidate them. This will require diving into the specs, understanding both of the current implementations, selecting the best approach for both and moving forwards with what was learned. We'd also likely need more test data as we're pretty thin on that.

I'm not sure regarding required tests for the cr3 format parsing

Generally, in this library, we use the regression tests images instead of unit tests. Unit tests are fine where we want to validate some small component, but generally most of the code here is well covered by the regression test suite. It's also not great to check tonnes of image data in alongside the source code.

Running your PR against that regression test suite shows a changes that I'm unsure about and would require deeper investigation. For example:

-[QuickTime - 0x1000] Major Brand = MP4  Base Media v1 [IS0 14496-12:2003]
-[QuickTime - 0x1001] Minor Version = 512
+[QuickTime - 0x1000] Major Brand = Unknown
+[QuickTime - 0x1001] Minor Version = 0
 [QuickTime - 0x1002] Compatible Brands = [MP4  Base Media v1 [IS0 14496-12:2003], MP4 Base Media v2 [ISO 14496-12:2005], MP4 Base w/ AVC ext [ISO 14496-12:2005], MP4 v1 [ISO 14496-1:ch13]]
 [QuickTime - 0x0100] Creation Time = Fri Jan 01 10:00:00 +10:00 1904
 [QuickTime - 0x0101] Modification Time = Fri Jan 01 10:00:00 +10:00 1904
-[QuickTime - 0x0103] Duration = 0
+[QuickTime - 0x0103] Duration = 441
 [QuickTime - 0x0102] Media Time Scale = 1000
-[QuickTime - 0x0104] Duration in Seconds = 00:00:00
-[QuickTime - 0x0105] Preferred Rate = 27.562
-[QuickTime - 0x0106] Preferred Volume = 0.125
-[QuickTime - 0x0107] Preview Time = 1073741824
+[QuickTime - 0x0104] Duration in Seconds = 00:00:01
+[QuickTime - 0x0105] Preferred Rate = 1
+[QuickTime - 0x0106] Preferred Volume = 1
+[QuickTime - 0x0107] Preview Time = 0
 [QuickTime - 0x0108] Preview Duration = 0

I'm not sure if this is more or less correct than before though!

There are instructions on running the regression tests at https://github.com/drewnoakes/metadata-extractor/wiki/Working-with-test-images. Let me know if anything's unclear and I can improve the docs.

Are you able to produce and donate a CR3 file to the project that we can use for regression testing? It's hard to validate the correctness of this PR without one.

Also are you interested in digging more into the spec here and uncovering the approach we should take for both implementations?

@drewnoakes
Copy link
Owner

Are you able to produce and donate a CR3 file to the project that we can use for regression testing? It's hard to validate the correctness of this PR without one.

Actually I forgot that @thorsted kindly volunteered their data in drewnoakes/metadata-extractor-images#28 (comment). I'm working to bring them in now, in a submodule.

@TSGames
Copy link
Author

TSGames commented Aug 28, 2023

Hi @drewnoakes , thanks for taking your time looking over the PR!
I wasn't aware that the PR causes side effects in the Quick Time parsing - that wasn't intented. I'll try to get the test suite running and find out what is causing the changes.
When the cr3 file is available (I don't have any camera producing cr3 files), I would also take a look at adding a test for cr3.

@drewnoakes
Copy link
Owner

Cloning https://github.com/drewnoakes/metadata-extractor-images/ (with submodules) will bring down some CR3 files to test with. I ran your PR against them a little earlier and there's a lot more metadata coming through now! We just need to understand why the other changes are there. Hopefully it's something straightforward.

@TSGames
Copy link
Author

TSGames commented Aug 28, 2023

Sounds good, I'm just stuck a bit with the regression test still producing diffs even when running on master (Issue #626 ). Maybe you have any idea how do I get them running stable? Thanks!

@TSGames
Copy link
Author

TSGames commented Aug 29, 2023

Hi @drewnoakes ,

the side effect is caused since there is the new if condition regarding the uuid header (c39a1b3#diff-31f8271c36c605ceb94867d1b75b9146f3ca2b424a8ec3742c8e55b458a9ac60R81). The issue seems that the code will read the cr3 header length from the stream - even for non-cr3 files. The problem than seems to be (with my humble understanding) that the InputStream-Cursor is now at an invalid position causing subsequent parsing issues because of the wrong alignment.

My (naive?) approach was to check for the file type cr3/crx and only reading the header in this case - I'm not sure if that's valid in your opinion. The only other chance I see would be to "reset" the InputStream after the header was read and didn't match - but I'm not aware that this is possible with a regular InputStream.

With this fix, the regression testing didn't caused any side effects for me, may you can check it as well. Thanks!

@TSGames
Copy link
Author

TSGames commented Sep 9, 2023

Hi, just wanted to bump this, can I provide any more changes or can you help me on how I should proceed? @drewnoakes
Thanks!

@TSGames
Copy link
Author

TSGames commented Sep 19, 2023

bump @drewnoakes

@drewnoakes
Copy link
Owner

Apologies @TSGames, holiday and the compression either side of it has taken up all my free time recently. I hope to get back to this soon. Thanks for your patience.

@TSGames
Copy link
Author

TSGames commented Oct 11, 2023

No worries, let me know if you need any more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants