Incorrect video duration for 0xFFFFFFFF

Started by Neal Krawetz, July 24, 2022, 11:43:43 AM

Previous topic - Next topic

Neal Krawetz

I have some MP4 videos that have the Track Duration and Media Duration set to "4294967295" (0xFFFFFFFF). These are from streaming videos, so the duration isn't known when the header is set.

ExifTool reports:
Track Duration                  : 213503982334 days 14:25:52
Media Duration                  : 21350398 days 5:36:11

MediaInfo sees that the value is effectively "-1" and parses the video stream to determine the actual duration.

I haven't dug through the specs, but I suspect that 0xFFFFFFFF is a special case flag for "N/A".

Unfortunately, the videos that I have contain PII, so I can't share samples.

  | | | TrackID = 1
  | | | - Tag 0x0003 (4 bytes, int32u[1]):
  | | |     06f6: 00 00 00 01                                     [....]
  | | | [offsets adjusted by +0x000c after 0x0005 TrackDuration]
  | | | TrackDuration = 18446744073709551615
  | | | - Tag 0x0005 (8 bytes, int64u[1]):
  | | |     06fe: ff ff ff ff ff ff ff ff                         [........]
  | | | TrackLayer = 0
  | | | - Tag 0x0008 (2 bytes, int16u[1]):
  | | |     070e: 00 00                                           [..]
  | | | TrackVolume = 0
  | | | - Tag 0x0009 (2 bytes, int16u[1]):
  | | |     0712: 00 00                                           [..]
  | | | MatrixStructure = 1 0 0 0 1 0 0 0 16384
  | | | - Tag 0x000a (36 bytes, fixed32s[9]):
  | | |     0716: 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [................]
  | | |     0726: 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [................]
  | | |     0736: 40 00 00 00                                     [@...]
  | | | ImageWidth = 41943040
  | | | - Tag 0x0013 (4 bytes, int32u[1]):
  | | |     073a: 02 80 00 00                                     [....]
  | | | ImageHeight = 23592960
  | | | - Tag 0x0014 (4 bytes, int32u[1]):
  | | |     073e: 01 68 00 00                                     [.h..]

...

  | | | | - Tag 0x0003 (4 bytes, int32u[1]):
  | | | |     0766: 00 98 96 80                                     [....]
  | | | | [offsets adjusted by +0x000c after 0x0004 MediaDuration]
  | | | | MediaDuration = 18446744073709551615
  | | | | - Tag 0x0004 (8 bytes, int64u[1]):
  | | | |     076a: ff ff ff ff ff ff ff ff                         [........]
  | | | | MediaLanguageCode = 21956
  | | | | - Tag 0x0005 (2 bytes, int16u[1]):
  | | | |     0772: 55 c4                                           [U.]

Phil Harvey

This is a bit tricky because testing for equality with 18446744073709551615 won't work on 32-bit architectures, and adding a test before the value is converted to a number would be difficult.

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