v145 · Web APIs · VideoFrame Metadata
VideoFrame Metadata
All fields in the VideoFrameMetadata dictionary returned by VideoFrame.metadata(), including rtpTimestamp added in Chrome 145, and when each field is populated.
VideoFrameMetadata fields
| Field | Type | When populated | Description |
|---|---|---|---|
rtpTimestamp new 145 |
unsigned long |
WebRTC received frames only | The RTP timestamp from the incoming packet header. Matches the value seen in RTCInboundRtpStreamStats.lastPacketReceivedTimestamp. Undefined for local camera frames. |
captureTime |
DOMHighResTimeStamp |
WebRTC with capture-time extension | Time the frame was captured on the sender's clock, in milliseconds. Requires the sender to include the capture-time RTP header extension. |
receiveTime |
DOMHighResTimeStamp |
WebRTC received frames | Time the last packet for this frame was received, in milliseconds. |
presentationTime |
DOMHighResTimeStamp |
All VideoFrames | Recommended presentation time in microseconds, based on the frame's timestamp. |
width |
unsigned long |
All VideoFrames | Coded width of the frame in pixels. |
height |
unsigned long |
All VideoFrames | Coded height of the frame in pixels. |
A/V sync with rtpTimestamp
// Use rtpTimestamp to correlate video frames with audio packets
// Both audio and video RTP streams share the same RTP session.
// Converting RTP timestamps to a common clock requires knowing the clock rate.
// Video RTP clock rate: typically 90000 Hz
// Audio RTP clock rate: typically 48000 Hz (Opus) or 16000 Hz (G.711)
function rtpToSeconds(rtpTs, clockRate) {
return rtpTs / clockRate;
}
// Example: if video frame has rtpTimestamp 123456789 (90kHz clock)
const videoSeconds = rtpToSeconds(123456789, 90000); // 1371.74...
// SRTP and NTP mapping (via RTCP SR) converts to wall-clock time,
// enabling precise A/V sync without access to sender's system clock.
use cases
// 1. Jitter buffer analysis
const timestamps = [];
while (true) {
const { value: frame } = await reader.read();
const meta = frame.metadata();
if (meta.rtpTimestamp !== undefined) {
timestamps.push({ rtp: meta.rtpTimestamp, recv: meta.receiveTime });
}
frame.close();
}
// 2. Frame-level logging for A/V sync debugging
// 3. Custom video processing that needs to match frames to stats
// (RTCInboundRtpStreamStats, RTCReceivedRtpStreamStats)
// 4. End-to-end latency measurement:
// sendTime (from RTCP SR) → receiveTime → presentationTime
see also
scenario focus
Select a scenario to focus its rendered example and summary.