On my Win11 X64 computer, I have a video MP4 file size of 4,300,971,434 bytes. I am trying to add a cover of 6 MB, I received an error, cannot write file.
Note that I had this on other files that are also very close to 4GB, so I am sure it is not file related. Other files that are 4.05 GB or 3.90 GB work fine with same type of change, it is always the one that are near 4.0GB that fail.
My guest here is that when writing file tag on MP4, if the temporary file size goes below the 4GB threshold and the new final file would go over the 4GB, some check avoid the write.
I used latest 3.26 release and 3.26c and the issue is still present.
PNG. I just tried with a 600KB jpg and it work fine.
Note that I used PNG for all the other files (that are bigger or smaller) without issue.
I just tried also same file with same PNG image but slowly reducing the image size by resizing.
5.38MB, 5.02MB, 4.59 MB, 4.16MB, 3.72 MB ... until it finally passed with a 1.43 MB cover file.
In the past, I had the same issue with a change in the Comment field, with a file around the 4GB size, and it failed too, until I reduce the comment length.
So I am pretty sure it is related to file size of the temporary process of final write. Could be a call to an old 32 bit call or path because the file without tags is below 4GB but when adding tags it goes over the 4GB limit and the 32 bit path will not process that.
File: y:\projects_audio\smp4file.cpp
Line: 568
Message: write: overflow (C:\Users\GrayG\Desktop\R\Doctor Who\Season 06\Doctor Who - S06E13 - The Wedding Of River Song.mp4)
00004AE8 at 27:45.438914
Perhaps it could help, when this failed, I was doing the cover change (same PNG) for a lot of mp4 files that were having various size, from 1MB to 4.5 MB, all other files passed except this one. It is the only one with 4.00 GB size in the propriety. All other near were 4.0x or more, and or lower 3.95 and below.
Again in the past I had same issue with file with similar size, any change in the tag could produce this, not linked to only cover change. Cover change issue is easier to detect because you do not need to have a file that is too close to the 4 GB.
Used a 3.98 MB file that was working with the 6MB PNG. I used a 16MB PNG and got the same write error:
The problem is related to the chunk-offset atom stco in the problematic file, which holds the 32-bit chunk offsets. Because the file size is at the brink of exceeding the unsigned int 32-bit range, an overflow is produced when trying to remap the offsets during a tag update that exceeds this range.
I think what's needed in those cases is to drop the stco atom and create a co64 atom, which can hold 64-bit chunk offsets. Easier said than done, though