On Fri Mar 14 20:23:51 2025 +0000, Brendan McGrath wrote:
Actually, I think the DTS value in the file is a delta. In that the actual DTS value is PTS - DTS. Certainly the difference between the Windows (and FFmpeg) PTS and DTS of each sample is the DTS value from the file. So I guess it's just a matter of understanding why the PTS values are different. Possibly Windows adjusts the PTS values so that there are no negative DTS values (given its passed as an unsigned 64-bit value). I'm thinking we should probably do the same.
I looked further in to the MP4 format and I've got a better understanding now. It looks like the Windows values are right. There's an 'Edit List' atom in the file with a start time of 666666, which is why Windows earliest DTS is 666666. It looks like GStreamer uses that value to set the earliest PTS (I'm not sure which one is actually right). But the values I used as PTS is actually DTS - this start time. And finally PTS is the start time + DTS (which I listed as PTS) + the delta (which I listed as DTS). So I've added another column to the table above to show the 'Fixed file value'. It's very similar to Windows.