"Error:'uuid' atom is too large for rewriting" occurs in mp4 by RICOH THETA Z1.

Started by potaro67, June 22, 2022, 07:48:29 PM

Previous topic - Next topic

potaro67

I use exiftool very usefully. Thank you, Phil.
However, most of the mp4s of 2GB or more recorded by RICOH THETA Z1 cannot rewrite EXIF.
The following error has occurred.

Warning: Truncated RicohRMKN directory - C:/Users/shotaro・・・
Error: 'uuid' atom is too large for rewriting (542 MB) - C:/Users/shotaro・・・


I have compiled the detailed report in the following article.
All mp4s to be tested can also be downloaded.
https://www.facebook.com/groups/GoogleStreetViewTrustedPhotographers/posts/2228353637340337/

When I contacted Ricoh's official support desk for the meaning of the EXIF ​​time tag value, I received the following answer:
"Tags with time information recorded according to ISO / IEC 14496-14 MP4 file format are recorded based on the mp4 box specifications."
This answer is not an answer that mentions the format of atom etc., but Ricoh seems to be confident that they wrote the correct EXIF ​​as specified in mp4.
The following is an article on the official Ricoh private bulletin board. I will post it as a reference for myself.
https://www.facebook.com/groups/theta.lab/posts/2810305679263291/

――――――

I can't rewrite the EXIF ​​of an mp4 that gives the above error.
However, I also know that re-encoding the mp4 will eliminate the above error.

Is there a way to avoid this error and fix EXIF ​​with exiftool?

StarGeek

One thing to clarify, exiftool can't edit EXIF metadata in a video.  There is no standard for it and every camera manufacturer shoves EXIF data into the files in different ways.  The data you are probably looking at is Quicktime metadata.  All EXIF data is metadata, but not all metadata is EXIF data.

I'm currently downloading one of the files, but it is downloading slowly, even on my broadband connection.  But you might try adding the -api LargeFileSupport option to your command to see if that allows editing of the file.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

StarGeek

Finally finished downloading the first file on the list, 1-1a1_R0022987_20210405140946.MP4.

There's no EXIF data in that file, only some Quicktime data.  The error I got when trying to add a Descripton tag was
Error: Truncated mdat atom - Y:/!temp/ccc/1-1a1_R0022987_20210405140946.MP4
    0 image files updated
    1 files weren't updated due to errors

It took a while to reach that error, so it looks like exiftool was trying to edit it, but then hit this error.

Ffprobe wouldn't even look at that file
C:\>ffprobe -hide_banner  Y:\!temp\ccc\1-1a1_R0022987_20210405140946.MP4
[mov,mp4,m4a,3gp,3g2,mj2 @ 000002b1c64de380] moov atom not found
Y:\!temp\ccc\1-1a1_R0022987_20210405140946.MP4: Invalid data found when processing input


Similar problem trying to remux the file with ffmpeg
C:\>ffmpeg -hide_banner -i Y:\!temp\ccc\1-1a1_R0022987_20210405140946.MP4  -c copy -map 0 Y:\!temp\ccc\1-1a1_R0022987_20210405140946-edited.MP4
[mov,mp4,m4a,3gp,3g2,mj2 @ 00000231b5bc98c0] moov atom not found
Y:\!temp\ccc\1-1a1_R0022987_20210405140946.MP4: Invalid data found when processing input


I'm downloading another file to check.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

StarGeek

Second file downloaded, this one dies quickly.  This one does include EXIF and MakerNotes, as well as more Quicktime data.
C:\>exiftool -P -overwrite_original -description=Test Y:\!temp\ccc\1-1a2_R0025470_20220330135614.MP4
Warning: Truncated RicohRMKN directory - Y:/!temp/ccc/1-1a2_R0025470_20220330135614.MP4
Error: 'uuid' atom is too large for rewriting (422 MB) - Y:/!temp/ccc/1-1a2_R0025470_20220330135614.MP4
    0 image files updated
    1 files weren't updated due to errors


Ffprobe reads it, with a warning
C:\>ffprobe -hide_banner Y:\!temp\ccc\1-1a2_R0025470_20220330135614.MP4
[mov,mp4,m4a,3gp,3g2,mj2 @ 000002195d31e380] UDTA parsing failed retrying raw
    Last message repeated 1 times
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Y:\!temp\ccc\1-1a2_R0025470_20220330135614.MP4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2022-03-30T04:56:13.000000Z
    make            : RICOH
    model           : RICOH THETA Z1
  Duration: 00:19:12.01, start: 0.000000, bitrate: 59254 kb/s
  Stream #0:0[0x1](eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuvj420p(pc, smpte170m/bt709/smpte170m, progressive), 3840x1920, 55991 kb/s, SAR 1:1 DAR 2:1, 29.97 fps, 29.97 tbr, 90k tbn (default)
    Metadata:
      creation_time   : 2022-03-30T04:56:13.000000Z
      handler_name    : VideoHandle
      vendor_id       : [0][0][0][0]
    Side data:
      spherical: equirectangular (0.000000/0.000000/0.000000)
  Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 95 kb/s (default)
    Metadata:
      creation_time   : 2022-03-30T04:56:13.000000Z
      handler_name    : SoundHandle
      vendor_id       : [0][0][0][0]


Ffmpeg remuxes this one.
C:\Windows\System32>ffmpeg -hide_banner -i Y:\!temp\ccc\1-1a2_R0025470_20220330135614.MP4 -c copy -map 0 Y:\!temp\ccc\1-1a2_R0025470_20220330135614-edited.MP4
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001f9c74398c0] UDTA parsing failed retrying raw
    Last message repeated 1 times
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Y:\!temp\ccc\1-1a2_R0025470_20220330135614.MP4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2022-03-30T04:56:13.000000Z
    make            : RICOH
    model           : RICOH THETA Z1
  Duration: 00:19:12.01, start: 0.000000, bitrate: 59254 kb/s
    Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuvj420p(pc, smpte170m/bt709/smpte170m), 3840x1920, 55991 kb/s, SAR 1:1 DAR 2:1, 29.97 fps, 29.97 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      creation_time   : 2022-03-30T04:56:13.000000Z
      handler_name    : VideoHandle
    Side data:
      spherical: equirectangular (0.000000/0.000000/0.000000)
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 95 kb/s (default)
    Metadata:
      creation_time   : 2022-03-30T04:56:13.000000Z
      handler_name    : SoundHandle
Output #0, mp4, to 'Y:\!temp\ccc\1-1a2_R0025470_20220330135614-edited.MP4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    model           : RICOH THETA Z1
    make            : RICOH
    encoder         : Lavf58.29.100
    Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuvj420p(pc, smpte170m/bt709/smpte170m), 3840x1920 [SAR 1:1 DAR 2:1], q=2-31, 55991 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 90k tbc (default)
    Metadata:
      creation_time   : 2022-03-30T04:56:13.000000Z
      handler_name    : VideoHandle
    Side data:
      spherical: equirectangular (0.000000/0.000000/0.000000)
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 95 kb/s (default)
    Metadata:
      creation_time   : 2022-03-30T04:56:13.000000Z
      handler_name    : SoundHandle
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=34521 fps=185 q=-1.0 Lsize= 7887509kB time=00:19:11.97 bitrate=56090.1kbits/s speed=6.16x
video:7872756kB audio:13499kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.015908%


After the remux, exiftool can edit the file.  The EXIF and MakerNotes are lost, because of the aforementioned lack of standards, but the much of the Quicktime and XMP data could be copied from the original.
C:\Programs\My_Stuff>exiftool.pl -P -overwrite_original -description=Test Y:\!temp\ccc\1-1a2_R0025470_20220330135614-edited.MP4
    1 image files updated

C:\Programs\My_Stuff>exiftool.pl -P -overwrite_original -TagsFromFile Y:\!temp\ccc\1-1a2_R0025470_20220330135614.MP4 -All:All Y:\!temp\ccc\1-1a2_R0025470_20220330135614-edited.MP4
    1 image files updated
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

StarGeek

Missing from the above, all exiftool commands include the -api LargeFileSupport option, as I have it permanently set in my .exiftool_config file.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

potaro67

Thank you for your answer.
The information that exiftool is not available in Video was a surprise to me.
I will cherish the situation that I happen to be able to use.

Also, for "1-1a1_R0022987_20210405140946.MP4" that you first looked up, by executing with the option "-api largefilesupport = 1" as shown in the following operation capture,  I noticed that items such as "Exif Version: 230" are displayed.
https://youtu.be/LX9JChfwQM4
I thought from this fact I was able to see the EXIF ​​of the mp4 above.
Isn't this EXIF?

And the subject of my question is that even for an mp4 that can view information like this, running a write command can result in an error.
When browsing the information, I added "-api largefilesupport = 1" to support large atom.
And I gave the same option for the write command, but failed.
I imagined that there might be another useful option prepared.

StarGeek

Quote from: potaro67 on June 23, 2022, 08:54:11 AM
Also, for "1-1a1_R0022987_20210405140946.MP4" that you first looked up, by executing with the option "-api largefilesupport = 1" as shown in the following operation capture,  I noticed that items such as "Exif Version: 230" are displayed.
https://youtu.be/LX9JChfwQM4
I thought from this fact I was able to see the EXIF ​​of the mp4 above.
Isn't this EXIF?

This is what I get from the first file I downloaded.  There is no EXIF data, just the underlying file system data and Quicktime data
C:\>exiftool -G -a -s -e Y:\!temp\ccc\1-1a1_R0022987_20210405140946.MP4
[ExifTool]      ExifToolVersion                 : 12.42
[ExifTool]      Warning                         : Truncated 'mdat' data
[File]          FileName                        : 1-1a1_R0022987_20210405140946.MP4
[File]          Directory                       : Y:/!temp/ccc
[File]          FileSize                        : 7.8 GB
[File]          ZoneIdentifier                  : Exists
[File]          FileModifyDate                  : 2022:06:22 18:04:50-07:00
[File]          FileAccessDate                  : 2022:06:23 07:35:29-07:00
[File]          FileCreateDate                  : 2022:06:22 17:58:56-07:00
[File]          FilePermissions                 : -rw-rw-rw-
[File]          FileType                        : MP4
[File]          FileTypeExtension               : mp4
[File]          MIMEType                        : video/mp4
[QuickTime]     MajorBrand                      : MP4 v2 [ISO 14496-14]
[QuickTime]     MinorVersion                    : 0.0.0
[QuickTime]     CompatibleBrands                : isom, mp42
[QuickTime]     MediaDataSize                   : 10374131968
[QuickTime]     MediaDataOffset                 : 40


The second file does have EXIF data
C:\Programs\My_Stuff>exiftool -G -a -s -e Y:\!temp\ccc\1-1a2_R0025470_20220330135614.MP4
[ExifTool]      ExifToolVersion                 : 12.42
[File]          FileName                        : 1-1a2_R0025470_20220330135614.MP4
[File]          Directory                       : Y:/!temp/ccc
[File]          FileSize                        : 8.5 GB
[File]          ZoneIdentifier                  : Exists
[File]          FileModifyDate                  : 2022:06:22 18:24:11-07:00
[File]          FileAccessDate                  : 2022:06:23 07:37:45-07:00
[File]          FileCreateDate                  : 2022:06:22 18:17:33-07:00
[File]          FilePermissions                 : -rw-rw-rw-
[File]          FileType                        : MP4
[File]          FileTypeExtension               : mp4
[File]          MIMEType                        : video/mp4
[File]          ExifByteOrder                   : Big-endian (Motorola, MM)
[QuickTime]     MajorBrand                      : MP4 v2 [ISO 14496-14]
[QuickTime]     MinorVersion                    : 0.0.0
[QuickTime]     CompatibleBrands                : isom, mp42
[QuickTime]     MediaDataSize                   : 8075524628
[QuickTime]     MediaDataOffset                 : 40
[QuickTime]     MovieHeaderVersion              : 0
[QuickTime]     CreateDate                      : 2022:03:30 04:56:13
[QuickTime]     ModifyDate                      : 2022:03:30 04:56:13
[QuickTime]     TimeScale                       : 1000
[QuickTime]     Duration                        : 0:19:12
[QuickTime]     PreferredRate                   : 1
[QuickTime]     PreferredVolume                 : 100.00%
[QuickTime]     MatrixStructure                 : 1 0 0 0 1 0 0 0 1
[QuickTime]     PreviewTime                     : 0 s
[QuickTime]     PreviewDuration                 : 0 s
[QuickTime]     PosterTime                      : 0 s
[QuickTime]     SelectionTime                   : 0 s
[QuickTime]     SelectionDuration               : 0 s
[QuickTime]     CurrentTime                     : 0 s
[QuickTime]     NextTrackID                     : 3
[QuickTime]     TrackHeaderVersion              : 0
[QuickTime]     TrackCreateDate                 : 2022:03:30 04:56:13
[QuickTime]     TrackModifyDate                 : 2022:03:30 04:56:13
[QuickTime]     TrackID                         : 1
[QuickTime]     TrackDuration                   : 0:19:12
[QuickTime]     TrackLayer                      : 0
[QuickTime]     TrackVolume                     : 0.00%
[QuickTime]     MatrixStructure                 : 1 0 0 0 1 0 0 0 1
[QuickTime]     ImageWidth                      : 3840
[QuickTime]     ImageHeight                     : 1920
[QuickTime]     MediaHeaderVersion              : 0
[QuickTime]     MediaCreateDate                 : 2022:03:30 04:56:13
[QuickTime]     MediaModifyDate                 : 2022:03:30 04:56:13
[QuickTime]     MediaTimeScale                  : 90000
[QuickTime]     MediaDuration                   : 0:19:12
[QuickTime]     HandlerType                     : Video Track
[QuickTime]     HandlerDescription              : VideoHandle
[QuickTime]     GraphicsMode                    : srcCopy
[QuickTime]     OpColor                         : 0 0 0
[QuickTime]     CompressorID                    : avc1
[QuickTime]     SourceImageWidth                : 3840
[QuickTime]     SourceImageHeight               : 1920
[QuickTime]     XResolution                     : 72
[QuickTime]     YResolution                     : 72
[QuickTime]     BitDepth                        : 24
[QuickTime]     PixelAspectRatio                : 65536:65536
[QuickTime]     ColorRepresentation             : nclx 1 1 6
[QuickTime]     VideoFrameRate                  : 29.97
[QuickTime]     TrackHeaderVersion              : 0
[QuickTime]     TrackCreateDate                 : 2022:03:30 04:56:13
[QuickTime]     TrackModifyDate                 : 2022:03:30 04:56:13
[QuickTime]     TrackID                         : 2
[QuickTime]     TrackDuration                   : 0:19:12
[QuickTime]     TrackLayer                      : 0
[QuickTime]     TrackVolume                     : 100.00%
[QuickTime]     MatrixStructure                 : 1 0 0 0 1 0 0 0 1
[QuickTime]     MediaHeaderVersion              : 0
[QuickTime]     MediaCreateDate                 : 2022:03:30 04:56:13
[QuickTime]     MediaModifyDate                 : 2022:03:30 04:56:13
[QuickTime]     MediaTimeScale                  : 48000
[QuickTime]     MediaDuration                   : 0:19:12
[QuickTime]     HandlerType                     : Audio Track
[QuickTime]     HandlerDescription              : SoundHandle
[QuickTime]     Balance                         : 0
[QuickTime]     AudioFormat                     : mp4a
[QuickTime]     AudioChannels                   : 1
[QuickTime]     AudioBitsPerSample              : 16
[QuickTime]     AudioSampleRate                 : 48000
[QuickTime]     PreviewImage                    : (Binary data 38712 bytes, use -b option to extract)
[QuickTime]     Model                           : RICOH THETA Z1
[QuickTime]     SoftwareVersion                 : RICOH THETA Z1 Ver 1.20.1
[QuickTime]     ContentCreateDate               : 2022:03:30 13:56:14+09:00
[QuickTime]     GPSCoordinates                  : 33 deg 9' 50.76" N, 130 deg 24' 41.04" E, 40 m Above Sea Level
[QuickTime]     Make                            : RICOH
[QuickTime]     Make                            : RICOH
[QuickTime]     Model                           : RICOH THETA Z1
[XMP]           Spherical                       : true
[XMP]           Stitched                        : true
[XMP]           StitchingSoftware               : RICOH THETA Z1 1.20.1
[XMP]           ProjectionType                  : equirectangular
[XMP]           SourceCount                     : 1
[XMP]           TimeStamp                       : 2088:03:30 04:56:13
[EXIF]          ImageDescription                :
[EXIF]          Make                            : RICOH
[EXIF]          Model                           : RICOH THETA Z1
[EXIF]          Orientation                     : Horizontal (normal)
[EXIF]          XResolution                     : 300
[EXIF]          YResolution                     : 300
[EXIF]          ResolutionUnit                  : inches
[EXIF]          Software                        : RICOH THETA Z1 Ver 1.20.1
[EXIF]          ModifyDate                      : 2022:03:30 13:37:01
[EXIF]          YCbCrPositioning                : Centered
[EXIF]          Copyright                       :
[EXIF]          ExposureProgram                 : Program AE
[EXIF]          ExifVersion                     : 0230
[EXIF]          DateTimeOriginal                : 2022:03:30 13:37:01
[EXIF]          CreateDate                      : 2022:03:30 13:37:01
[EXIF]          ComponentsConfiguration         : Y, Cb, Cr, -
[EXIF]          ExposureCompensation            : +4/3
[EXIF]          MaxApertureValue                : 2.1
[EXIF]          MeteringMode                    : Multi-segment
[EXIF]          LightSource                     : Unknown
[EXIF]          Flash                           : No flash function
[EXIF]          FocalLength                     : 2.6 mm
[EXIF]          FlashpixVersion                 : 0100
[EXIF]          ColorSpace                      : sRGB
[EXIF]          ExifImageWidth                  : 3840
[EXIF]          ExifImageHeight                 : 1920
[EXIF]          InteropIndex                    : R98 - DCF basic file (sRGB)
[EXIF]          InteropVersion                  : 0100
[EXIF]          ExposureMode                    : Auto
[EXIF]          WhiteBalance                    : Auto
[EXIF]          SceneCaptureType                : Standard
[EXIF]          Sharpness                       : Normal
[EXIF]          GPSVersionID                    : 2.3.0.0
[EXIF]          GPSLatitudeRef                  : North
[EXIF]          GPSLatitude                     : 33 deg 9' 50.81"
[EXIF]          GPSLongitudeRef                 : East
[EXIF]          GPSLongitude                    : 130 deg 24' 40.91"
[EXIF]          GPSAltitudeRef                  : Above Sea Level
[EXIF]          GPSAltitude                     : 40.24 m
[EXIF]          GPSTimeStamp                    : 04:36:57
[EXIF]          GPSImgDirectionRef              : Magnetic North
[EXIF]          GPSImgDirection                 : 292.94
[EXIF]          GPSMapDatum                     : WGS-84
[EXIF]          GPSDateStamp                    : 2022:03:30
[EXIF]          Compression                     : JPEG (old-style)
[EXIF]          XResolution                     : 300
[EXIF]          YResolution                     : 300
[EXIF]          ResolutionUnit                  : inches
[EXIF]          ThumbnailOffset                 : 8075954892
[EXIF]          ThumbnailLength                 : 38712
[MakerNotes]    MakerNoteType                   : Rdc
[MakerNotes]    FirmwareVersion                 : 00000000
[MakerNotes]    SerialNumber                    : (00000000)10010029
[MakerNotes]    RecordingFormat                 : JPEG
[MakerNotes]    WhiteBalance                    : Auto
[MakerNotes]    ColorTempKelvin                 : 5000
[MakerNotes]    Accelerometer                   : 5.96 3.22
[MakerNotes]    Compass                         : 292.94
[MakerNotes]    TimeZone                        : +09:00
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

StarGeek

Just an FYI, Phil is currently away until next week, so it will be a bit until he sees this.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Phil Harvey

Quote from: potaro67 on June 22, 2022, 07:48:29 PM
Error: 'uuid' atom is too large for rewriting (542 MB) - C:/Users/shotaro・・・

I would need to add some specialized code to be able to rewrite atoms that are too large to fit into memory.  I'll put this on the list of things to do, but a sample file would be useful for testing and the dropbox referenced from your facebook post seems to be empty.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

potaro67

Sorry for the broken dropbox links in those files. I had inadvertently moved those files.
Currently, all those files are in their original location.
Please check the above link again.

Phil Harvey

I've looked into this, and it is problem that won't be easy to solve.  ExifTool must keep all of the metadata in memory before writing because some offsets into the video stream must be updated if the metadata size changes.  The problem with your files is that there is a huge (> 100 MB) tag in the metadata, which is too large to load into memory on many systems.  Adding support for this would be a big job.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).