JPEG EOI marker not found

Started by dvc, September 24, 2023, 03:03:59 PM

Previous topic - Next topic

dvc

My task is to pull out a full-size preview from RAW.
After extracting the preview, I need to restore some data (it does not contain exif data) and attach the sRGB-profile. When I do this in one pass, the jpeg file turns out broken and does not open everywhere. And exiftool (v.12.67) writes: 'JPEG EOI marker not found'. Here is my action code:
exiftool -b -JpgFromRaw 0000.CR3 > 0000.jpg -execute -all= -tagsfromfile 0000.CR3 -exif:all -MakerNotes= 0000.jpg -overwrite_original -execute -TagsFromFile srgb.icc -icc_profile 0000.jpg -overwrite_original
However, when I do this one by one, no error comes out and the file is good  ???

exiftool -b -JpgFromRaw 0000.CR3 > 0000.jpg
exiftool -all= -tagsfromfile 0000.CR3 -exif:all 0000.jpg -overwrite_original -execute -TagsFromFile srgb.icc -icc_profile -MakerNotes= 0000.jpg -overwrite_original

I tried it on files from Nikon and Canon - the same result everywhere.
I would like to understand why this happens? It would be great to avoid this error, since there will be a lot of images in the queue.

StarGeek

You are clearing the MakerNotes at different positions in each of the commands, but I don't see how that should change things.

Try this command.  It uses the -W (-TagOut) option option instead of command line redirection,  multiple -TagsFromFile to avoid an extra -execute, the -srcfile option make sure the extracted jpg is processed, the -ext (-extension) option so as to limit processing to NEF and CR3 files, and -Common_Args option so as to make it easier to run across a whole directory.

exiftool -JpgFromRaw -b -W %d%f.%s -execute -all= -tagsfromfile %d%F -exif:all -MakerNotes= -TagsFromFile srgb.icc -icc_profile -srcfile %d%f.jpg -common_args -overwrite_original -ext cr3 -ext nef /path/to/files/

Example output.  First a list of the files, ignoring the zip as that is there to quickly reset the command, then the above command with the -progress option to see the names of the files as they are processed, and then the output of the jpegs without the file system or Composite tags.
C:\>exiftool -G1 -a -s -filename Y:\!temp\x\y
======== Y:/!temp/x/y/Test.icc
[System]        FileName                        : Test.icc
======== Y:/!temp/x/y/TestCR3.CR3
[System]        FileName                        : TestCR3.CR3
======== Y:/!temp/x/y/TestNEF.Nef
[System]        FileName                        : TestNEF.Nef
======== Y:/!temp/x/y/y.zip
[System]        FileName                        : y.zip
    1 directories scanned
    4 image files read

C:\>exiftool -JpgFromRaw -b -W %d%f.%s -execute -all= -tagsfromfile %d%F -exif:all -MakerNotes= -TagsFromFile test.icc -icc_profile -srcfile %d%f.jpg -common_args -overwrite_original -ext cr3 -ext nef Y:\!temp\x\y -progress
======== Y:/!temp/x/y/TestCR3.CR3 [1/2]
======== Y:/!temp/x/y/TestNEF.Nef [2/2]
    1 directories scanned
    2 image files read
    2 output files created
======== Y:/!temp/x/y/TestCR3.jpg [1/2]
======== Y:/!temp/x/y/TestNEF.jpg [2/2]
    1 directories scanned
    2 image files updated

C:\>exiftool -G1 -a -s -e --file:all -ext jpg  Y:\!temp\x\y
======== Y:/!temp/x/y/TestCR3.jpg
[ExifTool]      ExifToolVersion                 : 12.67
[IFD0]          Make                            : Canon
[IFD0]          Model                           : Canon EOS R5
[IFD0]          Orientation                     : Horizontal (normal)
[IFD0]          XResolution                     : 72
[IFD0]          YResolution                     : 72
[IFD0]          ResolutionUnit                  : inches
[IFD0]          ModifyDate                      : 2023:06:10 11:58:21
[IFD0]          Artist                          :
[IFD0]          YCbCrPositioning                : Centered
[IFD0]          Copyright                       :
[ExifIFD]       ExposureTime                    : 1/1600
[ExifIFD]       FNumber                         : 2.0
[ExifIFD]       ExposureProgram                 : Aperture-priority AE
[ExifIFD]       ISO                             : 100
[ExifIFD]       SensitivityType                 : Recommended Exposure Index
[ExifIFD]       RecommendedExposureIndex        : 100
[ExifIFD]       ExifVersion                     : 0231
[ExifIFD]       DateTimeOriginal                : 2020:07:20 11:14:34
[ExifIFD]       CreateDate                      : 2023:06:10 11:58:21
[ExifIFD]       OffsetTime                      : +02:00
[ExifIFD]       OffsetTimeOriginal              : +02:00
[ExifIFD]       OffsetTimeDigitized             : +02:00
[ExifIFD]       ComponentsConfiguration         : Y, Cb, Cr, -
[ExifIFD]       ShutterSpeedValue               : 1/1579
[ExifIFD]       ApertureValue                   : 2.0
[ExifIFD]       ExposureCompensation            : 0
[ExifIFD]       MeteringMode                    : Multi-segment
[ExifIFD]       Flash                           : No Flash
[ExifIFD]       FocalLength                     : 28.0 mm
[ExifIFD]       UserComment                     :
[ExifIFD]       SubSecTime                      : 00
[ExifIFD]       SubSecTimeOriginal              : 00
[ExifIFD]       SubSecTimeDigitized             : 00
[ExifIFD]       FlashpixVersion                 : 0100
[ExifIFD]       ColorSpace                      : sRGB
[ExifIFD]       ExifImageWidth                  : 8192
[ExifIFD]       ExifImageHeight                 : 5464
[ExifIFD]       FocalPlaneXResolution           : 5773.079646
[ExifIFD]       FocalPlaneYResolution           : 5769.799363
[ExifIFD]       FocalPlaneResolutionUnit        : inches
[ExifIFD]       CustomRendered                  : Normal
[ExifIFD]       ExposureMode                    : Auto
[ExifIFD]       WhiteBalance                    : Auto
[ExifIFD]       SceneCaptureType                : Standard
[ExifIFD]       OwnerName                       :
[ExifIFD]       SerialNumber                    : 022021000012
[ExifIFD]       LensInfo                        : 28-70mm f/0
[ExifIFD]       LensModel                       : RF28-70mm F2 L USM
[ExifIFD]       LensSerialNumber                : 7000000484
[GPS]           GPSVersionID                    : 2.3.0.0
[ICC-header]    ProfileCMMType                  : Apple Computer Inc.
[ICC-header]    ProfileVersion                  : 2.2.0
[ICC-header]    ProfileClass                    : Display Device Profile
[ICC-header]    ColorSpaceData                  : RGB
[ICC-header]    ProfileConnectionSpace          : XYZ
[ICC-header]    ProfileDateTime                 : 2006:02:02 02:20:00
[ICC-header]    ProfileFileSignature            : acsp
[ICC-header]    PrimaryPlatform                 : Apple Computer Inc.
[ICC-header]    CMMFlags                        : Not Embedded, Independent
[ICC-header]    DeviceManufacturer              : none
[ICC-header]    DeviceModel                     :
[ICC-header]    DeviceAttributes                : Reflective, Glossy, Positive, Color
[ICC-header]    RenderingIntent                 : Perceptual
[ICC-header]    ConnectionSpaceIlluminant       : 0.9642 1 0.82491
[ICC-header]    ProfileCreator                  : Epson
[ICC-header]    ProfileID                       : 0
[ICC_Profile]   ProfileDescription              : EPSON  sRGB
[ICC_Profile]   RedMatrixColumn                 : 0.43607 0.22249 0.01392
[ICC_Profile]   GreenMatrixColumn               : 0.38515 0.71687 0.09708
[ICC_Profile]   BlueMatrixColumn                : 0.14307 0.06061 0.7141
[ICC_Profile]   MediaWhitePoint                 : 0.95045 1 1.08905
[ICC_Profile]   ProfileCopyright                : Copyright (c) SEIKO EPSON CORPORATION 2000 - 2006. All rights reserved.
[ICC_Profile]   RedTRC                          : (Binary data 8204 bytes, use -b option to extract)
[ICC_Profile]   GreenTRC                        : (Binary data 8204 bytes, use -b option to extract)
[ICC_Profile]   BlueTRC                         : (Binary data 8204 bytes, use -b option to extract)
[ICC_Profile]   MediaBlackPoint                 : 0 0 0
======== Y:/!temp/x/y/TestNEF.jpg
[ExifTool]      ExifToolVersion                 : 12.67
[IFD0]          Make                            : NIKON CORPORATION
[IFD0]          Model                           : NIKON D5100
[IFD0]          Orientation                     : Rotate 270 CW
[IFD0]          XResolution                     : 300
[IFD0]          YResolution                     : 300
[IFD0]          ResolutionUnit                  : inches
[IFD0]          Software                        : Ver.1.01
[IFD0]          ModifyDate                      : 2016:07:23 20:15:26
[IFD0]          YCbCrPositioning                : Centered
[IFD0]          ReferenceBlackWhite             : 0 255 0 255 0 255
[ExifIFD]       ExposureTime                    : 1/100
[ExifIFD]       FNumber                         : 5.0
[ExifIFD]       ExposureProgram                 : Program AE
[ExifIFD]       ISO                             : 800
[ExifIFD]       SensitivityType                 : Recommended Exposure Index
[ExifIFD]       ExifVersion                     : 0232
[ExifIFD]       DateTimeOriginal                : 2016:07:23 20:15:26
[ExifIFD]       CreateDate                      : 2016:07:23 20:15:26
[ExifIFD]       ComponentsConfiguration         : Y, Cb, Cr, -
[ExifIFD]       ExposureCompensation            : 0
[ExifIFD]       MaxApertureValue                : 4.6
[ExifIFD]       MeteringMode                    : Multi-segment
[ExifIFD]       LightSource                     : Tungsten (Incandescent)
[ExifIFD]       Flash                           : No Flash
[ExifIFD]       FocalLength                     : 48.0 mm
[ExifIFD]       UserComment                     :
[ExifIFD]       SubSecTime                      : 10
[ExifIFD]       SubSecTimeOriginal              : 10
[ExifIFD]       SubSecTimeDigitized             : 10
[ExifIFD]       FlashpixVersion                 : 0100
[ExifIFD]       ColorSpace                      : Uncalibrated
[ExifIFD]       SensingMethod                   : One-chip color area
[ExifIFD]       FileSource                      : Digital Camera
[ExifIFD]       SceneType                       : Directly photographed
[ExifIFD]       CFAPattern                      : [Red,Green][Green,Blue]
[ExifIFD]       CustomRendered                  : Normal
[ExifIFD]       ExposureMode                    : Auto
[ExifIFD]       WhiteBalance                    : Manual
[ExifIFD]       DigitalZoomRatio                : 1
[ExifIFD]       FocalLengthIn35mmFormat         : 72 mm
[ExifIFD]       SceneCaptureType                : Standard
[ExifIFD]       GainControl                     : Low gain up
[ExifIFD]       Contrast                        : Normal
[ExifIFD]       Saturation                      : Normal
[ExifIFD]       Sharpness                       : Normal
[ExifIFD]       SubjectDistanceRange            : Unknown
[GPS]           GPSVersionID                    : 2.3.0.0
[ICC-header]    ProfileCMMType                  : Apple Computer Inc.
[ICC-header]    ProfileVersion                  : 2.2.0
[ICC-header]    ProfileClass                    : Display Device Profile
[ICC-header]    ColorSpaceData                  : RGB
[ICC-header]    ProfileConnectionSpace          : XYZ
[ICC-header]    ProfileDateTime                 : 2006:02:02 02:20:00
[ICC-header]    ProfileFileSignature            : acsp
[ICC-header]    PrimaryPlatform                 : Apple Computer Inc.
[ICC-header]    CMMFlags                        : Not Embedded, Independent
[ICC-header]    DeviceManufacturer              : none
[ICC-header]    DeviceModel                     :
[ICC-header]    DeviceAttributes                : Reflective, Glossy, Positive, Color
[ICC-header]    RenderingIntent                 : Perceptual
[ICC-header]    ConnectionSpaceIlluminant       : 0.9642 1 0.82491
[ICC-header]    ProfileCreator                  : Epson
[ICC-header]    ProfileID                       : 0
[ICC_Profile]   ProfileDescription              : EPSON  sRGB
[ICC_Profile]   RedMatrixColumn                 : 0.43607 0.22249 0.01392
[ICC_Profile]   GreenMatrixColumn               : 0.38515 0.71687 0.09708
[ICC_Profile]   BlueMatrixColumn                : 0.14307 0.06061 0.7141
[ICC_Profile]   MediaWhitePoint                 : 0.95045 1 1.08905
[ICC_Profile]   ProfileCopyright                : Copyright (c) SEIKO EPSON CORPORATION 2000 - 2006. All rights reserved.
[ICC_Profile]   RedTRC                          : (Binary data 8204 bytes, use -b option to extract)
[ICC_Profile]   GreenTRC                        : (Binary data 8204 bytes, use -b option to extract)
[ICC_Profile]   BlueTRC                         : (Binary data 8204 bytes, use -b option to extract)
[ICC_Profile]   MediaBlackPoint                 : 0 0 0
    1 directories scanned
    2 image files read

It gave me no problems here, so hopefully, you won't have any either.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

dvc

Quote from: StarGeek on September 24, 2023, 04:22:48 PMexiftool -JpgFromRaw -b -W %d%f.%s -execute -all= -tagsfromfile %d%F -exif:all -MakerNotes= -TagsFromFile srgb.icc -icc_profile -srcfile %d%f.jpg -common_args -overwrite_original -ext cr3 -ext nef /path/to/files/

Thanks for the tip! Following your example, I found a suitable solution for the current moment. Since it is important that the sources and previews are in different places.

exiftool -b -jpgfromraw -w OUT/%f.jpg -execute -tagsfromfile @ -MakerNotes= -TagsFromFile srgb.icc -icc_profile -srcfile OUT/%f.jpg -overwrite_original -common_args --ext jpg /Volumes/RAM\ Disk/raw -progress