DEV Community

Peiguan
Peiguan

Posted on

Does the Soundtrack of a Public Tiny Desk AI Clip Start Before the First Video Frame, and by How Many Milliseconds? (ffmpeg + Python, Tested)

Does the Soundtrack of a Public Tiny Desk AI Clip Start Before the First Video Frame, and by How Many Milliseconds? (ffmpeg + Python, Tested)

I built tinydeskoutstanding.video, an independent studio that places one to five photos into a 15-second vertical desk performance. Today, 28 November 2026, I asked a timing question about the eight public homepage samples: on the composition timeline, does the soundtrack start before the first video frame, and by how many milliseconds?

This is not a rerun of the earlier edit-list / AAC-priming note. I still read the edit list, because a correct player uses it, but the hook is the measured start offset in milliseconds, with exact timescales and first-sample timestamps.

I re-downloaded the eight /media/imported/ MP4s linked from the live homepage (SHA-256 of each file matched its filename; fetches 12:20:46–12:20:50 CST, Asia/Shanghai). I did not use a paid studio render and I did not touch a customer file. As of today's fetch of the pricing page (72,750 bytes, 12:19:55 CST), a single run is $9.98 at 480p (998 credits), $12.98 at 720p (1,298), $24.98 at 1080p (2,498), or $39.98 at 4K (3,998), the same for Just Me, Back Row, and Whole Band. There is no subscription.

What I ran

The official reference is still:

https://tinydeskoutstanding.video/media/imported/db09b1c54359b0930cec54690f0158751f6144e3a7faa812556adec5a89a0cc1.mp4
Enter fullscreen mode Exit fullscreen mode

(4,258,704 bytes.) Then:

python3 av_start_offset.py --samples-dir files/samples --out files/dv
Enter fullscreen mode Exit fullscreen mode

For each file the script reads the first video and audio packets with ffprobe, the movie timescale from mvhd, each track's media timescale from mdhd, and the edit list from elst. It reports a raw first-PTS offset, (video_pts_time − audio_pts_time) in milliseconds, and an edit-list-adjusted offset on the movie timeline.

The first audio packet is timestamped before the first video frame

Every file has movie timescale 1,000. The first video packet PTS is 0 (pts_time 0.0). The first audio packet PTS is −1024 ticks on every file. That negative timestamp is the whole difference.

short video mdhd ts audio ts first video PTS first audio PTS raw offset elst-adjusted offset
0299078c 12,288 44,100 0 −1024 23.220 ms 0.000 ms
632c0129 12,288 44,100 0 −1024 23.220 ms 0.000 ms
8256cd87 12,288 32,000 0 −1024 32.000 ms 0.000 ms
875d2458 12,288 44,100 0 −1024 23.220 ms 0.000 ms
947f5eb2 12,288 44,100 0 −1024 23.220 ms 0.000 ms
db033545 12,288 44,100 0 −1024 23.220 ms 0.000 ms
db09b1c5 (reference) 15,360 48,000 0 −1024 21.333 ms 0.000 ms
f7ff5268 12,288 44,100 0 −1024 23.220 ms 0.000 ms

The official reference is the odd one out on purpose: it is the only public sample at 48 kHz, and its video media timescale is 15,360 rather than 12,288. The raw offset is exactly 1024/48000 seconds (ffprobe prints -0.021333). Six files are 44.1 kHz, where 1024/44100 seconds is 23.219954… ms (ffprobe prints -0.02322). Gallery file 8256cd87 is 32 kHz, so 1024/32000 seconds is 32.000 ms exactly.

The first audio packet on the official file also carries skip_samples=1024 side data. The next audio packet is already at PTS 0 — the same composition time as the first video frame.

After the edit list, the offset is 0.000 ms

Both tracks on every public file have a single elst entry with media_time=1024 and no empty edit. Stream start_time from ffprobe is 0.0 for video and for audio. The first decoded audio frame on the official reference has PTS 0.000000. The edit-list-adjusted start is movie time 0.0 s for both tracks, so the adjusted A/V offset is 0.000 ms on all eight files.

A player that only compares the first packet timestamps can conclude that the soundtrack starts 21.333 ms (official), 23.220 ms, or 32.000 ms before the first video frame. A player that honors the edit list — or ffmpeg's skip-samples — presents them together.

(The first video packet also has DTS −1024. On the official file that is 1024/15360 = 66.667 ms of decode delay, not an A/V start offset; the first video composition timestamp is still 0.)

Takeaway

The public samples do not have a leftover A/V start skew on the presentation timeline. They do have a consistent raw first-PTS pattern: audio at −1024 ticks, video at 0, whose millisecond size follows the audio sample rate. If you are writing a mux inspector, report both the raw first-PTS offset and the edit-list-adjusted offset, and do not treat 23.22 ms as a universal constant — the official reference is 21.333 ms.

How to reproduce: Python 3 and ffmpeg / ffprobe 7.x. Run av_start_offset.py on the eight SHA-verified files. The numbers above are from av_start_offset.json, measured on this box on 28 November 2026.

Top comments (2)

Collapse
 
userxnom profile image
Abdullah Naseer •

The -1024 tick is the giveaway that this is AAC priming, not drift — 1024/44100 is 23.219954 ms, and your table lands on 23.220 ms on six files, 32.000 ms exactly on the 32 kHz file, and 21.333 ms on the 48 kHz reference. That exactness is what makes the measurement convincing. The part I will remember is the edit list: media_time=1024 cancels the whole offset, so a player that only compares first packet timestamps reports a 23 ms lead that no listener ever hears. Did any of the eight files show a non-zero edit-list-adjusted offset, or was 0.000 ms universal across all of them?

Collapse
 
vidlify profile image
Vidlify •

Nice to see the raw and the edit list adjusted numbers side by side. One place where the raw number comes back: the edit list only exists in MP4. I remuxed a 48 kHz AAC + H.264 test file with -c copy to MPEG-TS (and to HLS segments, same result) on FFmpeg 6.1.1, and the stream start times became 1.445333 s for audio and 1.466667 s for video, so the 21.333 ms is back as a start_time difference.

Sync itself is still fine: the second audio packet, the first one with real samples, starts at exactly the same time as the first frame. What moved is the priming packet, which is now part of the presented timeline. Remuxing that TS back to MP4 keeps it that way, with audio starting at 0.000 and video at 0.021.

So reporting both numbers, like your inspector does, gives the right answer for MP4. For HLS or TS the raw offset is all there is, and a 21 to 32 ms audio lead there is expected rather than a bug.