Skip to content

Commit

Permalink
mp4: Use correct epoch for quicktime timestamps
Browse files Browse the repository at this point in the history
Somehow was 1904-01-04 should be 1904-01-01
  • Loading branch information
wader committed May 16, 2023
1 parent aec2635 commit 493848a
Show file tree
Hide file tree
Showing 20 changed files with 125 additions and 125 deletions.
2 changes: 1 addition & 1 deletion format/mp4/boxes.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func decodeLang(d *decode.D) string {
}

// Quicktime time seconds in January 1, 1904 UTC
var quicktimeEpochDate = time.Date(1904, time.January, 4, 0, 0, 0, 0, time.UTC)
var quicktimeEpochDate = time.Date(1904, time.January, 1, 0, 0, 0, 0, time.UTC)

var uintActualQuicktimeEpoch = scalar.UintActualDate(quicktimeEpochDate, time.RFC3339)

Expand Down
12 changes: 6 additions & 6 deletions format/mp4/testdata/aac.fqtest
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ $ fq -d mp4 dv aac.mp4
0x2a0|68 64 |hd |
0x2a0| 00 | . | version: 0 0x2a2-0x2a2.7 (1)
0x2a0| 00 00 00 | ... | flags: 0 0x2a3-0x2a5.7 (3)
0x2a0| 00 00 00 00 | .... | creation_time: 0 (1904-01-04T00:00:00Z) 0x2a6-0x2a9.7 (4)
0x2a0| 00 00 00 00 | .... | modification_time: 0 (1904-01-04T00:00:00Z) 0x2aa-0x2ad.7 (4)
0x2a0| 00 00 00 00 | .... | creation_time: 0 (1904-01-01T00:00:00Z) 0x2a6-0x2a9.7 (4)
0x2a0| 00 00 00 00 | .... | modification_time: 0 (1904-01-01T00:00:00Z) 0x2aa-0x2ad.7 (4)
0x2a0| 00 00| ..| time_scale: 1000 0x2ae-0x2b1.7 (4)
0x2b0|03 e8 |.. |
0x2b0| 00 00 00 4a | ...J | duration: 74 0x2b2-0x2b5.7 (4)
Expand Down Expand Up @@ -76,8 +76,8 @@ $ fq -d mp4 dv aac.mp4
0x310| 03 | . | in_preview: false 0x319.5-0x319.5 (0.1)
0x310| 03 | . | in_movie: true 0x319.6-0x319.6 (0.1)
0x310| 03 | . | enabled: true 0x319.7-0x319.7 (0.1)
0x310| 00 00 00 00 | .... | creation_time: 0 (1904-01-04T00:00:00Z) 0x31a-0x31d.7 (4)
0x310| 00 00| ..| modification_time: 0 (1904-01-04T00:00:00Z) 0x31e-0x321.7 (4)
0x310| 00 00 00 00 | .... | creation_time: 0 (1904-01-01T00:00:00Z) 0x31a-0x31d.7 (4)
0x310| 00 00| ..| modification_time: 0 (1904-01-01T00:00:00Z) 0x31e-0x321.7 (4)
0x320|00 00 |.. |
0x320| 00 00 00 01 | .... | track_id: 1 0x322-0x325.7 (4)
0x320| 00 00 00 00 | .... | reserved1: 0 0x326-0x329.7 (4)
Expand Down Expand Up @@ -131,8 +131,8 @@ $ fq -d mp4 dv aac.mp4
0x390| 00 | . | version: 0 0x39e-0x39e.7 (1)
0x390| 00| .| flags: 0 0x39f-0x3a1.7 (3)
0x3a0|00 00 |.. |
0x3a0| 00 00 00 00 | .... | creation_time: 0 (1904-01-04T00:00:00Z) 0x3a2-0x3a5.7 (4)
0x3a0| 00 00 00 00 | .... | modification_time: 0 (1904-01-04T00:00:00Z) 0x3a6-0x3a9.7 (4)
0x3a0| 00 00 00 00 | .... | creation_time: 0 (1904-01-01T00:00:00Z) 0x3a2-0x3a5.7 (4)
0x3a0| 00 00 00 00 | .... | modification_time: 0 (1904-01-01T00:00:00Z) 0x3a6-0x3a9.7 (4)
0x3a0| 00 00 ac 44 | ...D | time_scale: 44100 0x3aa-0x3ad.7 (4)
0x3a0| 00 00| ..| duration: 3229 0x3ae-0x3b1.7 (4)
0x3b0|0c 9d |.. |
Expand Down
12 changes: 6 additions & 6 deletions format/mp4/testdata/av1.fqtest
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ $ fq -d mp4 dv av1.mp4
0x11c0| 6d 76 68 64| mvhd| type: "mvhd" (Movie header, overall declarations) 0x11cc-0x11cf.7 (4)
0x11d0|00 |. | version: 0 0x11d0-0x11d0.7 (1)
0x11d0| 00 00 00 | ... | flags: 0 0x11d1-0x11d3.7 (3)
0x11d0| 00 00 00 00 | .... | creation_time: 0 (1904-01-04T00:00:00Z) 0x11d4-0x11d7.7 (4)
0x11d0| 00 00 00 00 | .... | modification_time: 0 (1904-01-04T00:00:00Z) 0x11d8-0x11db.7 (4)
0x11d0| 00 00 00 00 | .... | creation_time: 0 (1904-01-01T00:00:00Z) 0x11d4-0x11d7.7 (4)
0x11d0| 00 00 00 00 | .... | modification_time: 0 (1904-01-01T00:00:00Z) 0x11d8-0x11db.7 (4)
0x11d0| 00 00 03 e8| ....| time_scale: 1000 0x11dc-0x11df.7 (4)
0x11e0|00 00 00 28 |...( | duration: 40 0x11e0-0x11e3.7 (4)
0x11e0| 00 01 00 00 | .... | preferred_rate: 1 0x11e4-0x11e7.7 (4)
Expand Down Expand Up @@ -69,8 +69,8 @@ $ fq -d mp4 dv av1.mp4
0x1240| 03 | . | in_preview: false 0x1247.5-0x1247.5 (0.1)
0x1240| 03 | . | in_movie: true 0x1247.6-0x1247.6 (0.1)
0x1240| 03 | . | enabled: true 0x1247.7-0x1247.7 (0.1)
0x1240| 00 00 00 00 | .... | creation_time: 0 (1904-01-04T00:00:00Z) 0x1248-0x124b.7 (4)
0x1240| 00 00 00 00| ....| modification_time: 0 (1904-01-04T00:00:00Z) 0x124c-0x124f.7 (4)
0x1240| 00 00 00 00 | .... | creation_time: 0 (1904-01-01T00:00:00Z) 0x1248-0x124b.7 (4)
0x1240| 00 00 00 00| ....| modification_time: 0 (1904-01-01T00:00:00Z) 0x124c-0x124f.7 (4)
0x1250|00 00 00 01 |.... | track_id: 1 0x1250-0x1253.7 (4)
0x1250| 00 00 00 00 | .... | reserved1: 0 0x1254-0x1257.7 (4)
0x1250| 00 00 00 28 | ...( | duration: 40 0x1258-0x125b.7 (4)
Expand Down Expand Up @@ -116,8 +116,8 @@ $ fq -d mp4 dv av1.mp4
0x12c0| 6d 64 68 64 | mdhd | type: "mdhd" (Media header, overall information about the media) 0x12c8-0x12cb.7 (4)
0x12c0| 00 | . | version: 0 0x12cc-0x12cc.7 (1)
0x12c0| 00 00 00| ...| flags: 0 0x12cd-0x12cf.7 (3)
0x12d0|00 00 00 00 |.... | creation_time: 0 (1904-01-04T00:00:00Z) 0x12d0-0x12d3.7 (4)
0x12d0| 00 00 00 00 | .... | modification_time: 0 (1904-01-04T00:00:00Z) 0x12d4-0x12d7.7 (4)
0x12d0|00 00 00 00 |.... | creation_time: 0 (1904-01-01T00:00:00Z) 0x12d0-0x12d3.7 (4)
0x12d0| 00 00 00 00 | .... | modification_time: 0 (1904-01-01T00:00:00Z) 0x12d4-0x12d7.7 (4)
0x12d0| 00 00 32 00 | ..2. | time_scale: 12800 0x12d8-0x12db.7 (4)
0x12d0| 00 00 02 00| ....| duration: 512 0x12dc-0x12df.7 (4)
0x12e0|55 c4 |U. | language: "und" 0x12e0-0x12e1.7 (2)
Expand Down
12 changes: 6 additions & 6 deletions format/mp4/testdata/avc.fqtest
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ $ fq -d mp4 dv avc.mp4
0x00d90|64 |d |
0x00d90| 00 | . | version: 0 0xd91-0xd91.7 (1)
0x00d90| 00 00 00 | ... | flags: 0 0xd92-0xd94.7 (3)
0x00d90| 00 00 00 00 | .... | creation_time: 0 (1904-01-04T00:00:00Z) 0xd95-0xd98.7 (4)
0x00d90| 00 00 00 00 | .... | modification_time: 0 (1904-01-04T00:00:00Z) 0xd99-0xd9c.7 (4)
0x00d90| 00 00 00 00 | .... | creation_time: 0 (1904-01-01T00:00:00Z) 0xd95-0xd98.7 (4)
0x00d90| 00 00 00 00 | .... | modification_time: 0 (1904-01-01T00:00:00Z) 0xd99-0xd9c.7 (4)
0x00d90| 00 00 03| ...| time_scale: 1000 0xd9d-0xda0.7 (4)
0x00da0|e8 |. |
0x00da0| 00 00 00 78 | ...x | duration: 120 0xda1-0xda4.7 (4)
Expand Down Expand Up @@ -76,8 +76,8 @@ $ fq -d mp4 dv avc.mp4
0x00e00| 03 | . | in_preview: false 0xe08.5-0xe08.5 (0.1)
0x00e00| 03 | . | in_movie: true 0xe08.6-0xe08.6 (0.1)
0x00e00| 03 | . | enabled: true 0xe08.7-0xe08.7 (0.1)
0x00e00| 00 00 00 00 | .... | creation_time: 0 (1904-01-04T00:00:00Z) 0xe09-0xe0c.7 (4)
0x00e00| 00 00 00| ...| modification_time: 0 (1904-01-04T00:00:00Z) 0xe0d-0xe10.7 (4)
0x00e00| 00 00 00 00 | .... | creation_time: 0 (1904-01-01T00:00:00Z) 0xe09-0xe0c.7 (4)
0x00e00| 00 00 00| ...| modification_time: 0 (1904-01-01T00:00:00Z) 0xe0d-0xe10.7 (4)
0x00e10|00 |. |
0x00e10| 00 00 00 01 | .... | track_id: 1 0xe11-0xe14.7 (4)
0x00e10| 00 00 00 00 | .... | reserved1: 0 0xe15-0xe18.7 (4)
Expand Down Expand Up @@ -131,8 +131,8 @@ $ fq -d mp4 dv avc.mp4
0x00e80| 00 | . | version: 0 0xe8d-0xe8d.7 (1)
0x00e80| 00 00| ..| flags: 0 0xe8e-0xe90.7 (3)
0x00e90|00 |. |
0x00e90| 00 00 00 00 | .... | creation_time: 0 (1904-01-04T00:00:00Z) 0xe91-0xe94.7 (4)
0x00e90| 00 00 00 00 | .... | modification_time: 0 (1904-01-04T00:00:00Z) 0xe95-0xe98.7 (4)
0x00e90| 00 00 00 00 | .... | creation_time: 0 (1904-01-01T00:00:00Z) 0xe91-0xe94.7 (4)
0x00e90| 00 00 00 00 | .... | modification_time: 0 (1904-01-01T00:00:00Z) 0xe95-0xe98.7 (4)
0x00e90| 00 00 32 00 | ..2. | time_scale: 12800 0xe99-0xe9c.7 (4)
0x00e90| 00 00 06| ...| duration: 1536 0xe9d-0xea0.7 (4)
0x00ea0|00 |. |
Expand Down

0 comments on commit 493848a

Please sign in to comment.