Bug or correctly corrupted file?

Started by sx8999, March 24, 2024, 04:31:03 AM

Previous topic - Next topic

sx8999

Hi all,

I downloaded a Whatsapp MP4 file via Whatsapp Web (ie Desktop Browser).
When I try to write and modify a tag, I'm getting this output:

Warning: Truncated '\x0b\xc0\x00\x00' dataI guess this could be suppressed... but it leads to:
QuoteError: Truncated '0x0bc00000' atom
-> User end result: File cannot be written / modified.

The file plays just fine in Mediaplyer Classic...

I wanted to set the EXIF dates like so:

exiftool ^
-P ^
-overwrite_original ^
"-AllDates<Filename" ^
"-FileCreateDate<Filename" ^
"-FileModifyDate<Filename" ^
"%~1"

Here's the original file:
https://www.dropbox.com/scl/fi/d89zy8wqrg27gw97jnmbv/20240323_160151.mp4?rlkey=iuiim0fu5s2f150aku31y8c68&dl=0

Any ideas?
Thanks so much!


EDIT:
I know how to circumvent (ie workaround) it - I opened the file in LOsslesscut and cut off 0.1s at the start saved it (actually without reencoding) and all of a sudden, everything works fine. So a quick ffmpeg call corrects all stuff it seems. But it's still annoying as it always requires some manual work...

Phil Harvey

This happens often enough that I should probably do something about it.  There is garbage data after the mdat in this file.  I haven't seen any specification for why this should happen, and because I like to take the conservative approach ExifTool doesn't currently rewrite these files because of the potential loss of this unknown data.

However, I've never seen any data that looks useful here.

I'll study your sample closely and think about including a way to write these files in the next version.  This may involve adding a new API option to force ExifTool to remove this data.

- 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 ($).

sx8999

OK so that means after all those years you've often seen this potential "garbage" data but never seen a case where it's useful?
I mean obviously the player plays it and ffmpeg or other encoders also throw it away.
So yes, indeed I'd say it's a good idea and approach to simply discard it using a new force option.

Would be great!

Phil Harvey

I'm testing a version that works like this with your test file:

> exiftool 20240323_160151.mp4 -title=test
Warning: Unknown trailer with truncated '0x0bc00000' atom - 20240323_160151.mp4
Error: Use "-trailer=" to delete unknown trailer - 20240323_160151.mp4
    0 image files updated
    1 files weren't updated due to errors

> exiftool 20240323_160151.mp4 -title=test -trailer=
Warning: Deleted unknown trailer with truncated '0x0bc00000' atom - 20240323_160151.mp4
    1 image files updated

If testing goes well, I'll include this feature in the upcoming 12.81 release.

- 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 ($).

wywh

Quote from: sx8999 on March 24, 2024, 04:31:03 AMquick ffmpeg call corrects

Yes, just rewrapping the movie fixes it:

ffmpeg -i 20240323_160151.mp4 -c copy 20240323_160151_rewrap.mp4
- Matti

Phil Harvey

I really have no idea why some software writes mounds of seeming garbage at the end of MP4 files.  This unused data can sometimes be quite large.

Anyway, testing has been going well and I plan to release 12.81 later today.

- 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 ($).

sx8999

#6
That's really great to know, thanks!
Will download, play around and integrate into my scripts!

EDIT: Works wonderful! THANKS for making it possible!