Open cowwoc opened 3 years ago
~Sounds like a bug, so long as the specification is clear.~ We have examples of using different epochs in the code today. Want to take a look at fixing this? It shouldn't be too hard to find the relevant bit of code. I'd applying the transformation when reading from the QuickTime data, and setting a DateTime on the Directory.
Edit: re-read the quoted comment and understand the problem better now. Yeah, it's less clear. It is possible that some system digitized old footage and set the date for that footage before 1970, in which case this transformation would give an incorrect date. That seems less likely than the other bug though, so I guess it's a fair trade off.
Longer term I'd like to allow controlling this kind of thing with 'feature flags' for the library, to allow finer grained control over these kinds of workarounds, giving an escape hatch for times when they get in the way.
Also, if you have a small file that repros this we should add it here (so long as none of the existing files repro it).
@drewnoakes I've got an MP4 file with this problem. Unfortunately, it is not short and family members are in the video so it's not something I'd like to publish on the internet. I tried truncating the video to 1 video frame using Handbreak but doing so loses all metadata. I tried transferring the metadata from the old video to the new one but exiftool insists on fixing the timestamp in transit so I can't transfer the "bad" metadata over unchanged. Any ideas?
I've successfully used FFmpeg to truncate video files without losing metadata before, but MP4 can be tricky since it might put the metadata last AFAICR. It's still worth a shot. If that doesn't work, MP4Box might do the trick.
@Nadahar I haven't been able to make this work in ffmpeg and the server containing binary builds of MP4Box (some server in France) is currently timing out. I'm open to suggestions. If you've got a specific command-line that works for you in ffmpeg, let me know. When I tried it just now it dumped all metadata in the output file.
Per https://exiftool.org/forum/index.php?topic=7911.msg40318#msg40318:
This brings up some questions:
I mention this because I'm getting some MP4 timestamps returning 1946 with this library and 2012 with exiftool and I know for a fact the latter is correct. I am applying the above adjustment manually in the application layer but it took me a while to track down the cause.