On 8/1/2015 11:12 PM, pablo platt wrote:
> I'm capturing RTP and RTCP packets from audio and video streams and
> merge them to a video with a post-processing script.
>
> I've read about the RTP timestamp and NTP timestamp in RTCP SR and how
> to sync audio and video streams from the same source.
>
> How can I synchronize streams from multiple participants?
> I also need to synchronize the streams with other events in the
> recording like whiteboard annotations and presentation slides.
You can synchronize the streams coming *from* a participant (by putting
them in the same MediaStream). Synchronizing *multiple* participants
means basically recording the view as seen by either the server or one
participant.
>
> rfc3550 says:
> An implementation is not required to run the Network Time Protocol in
> order to use RTP. Other time sources, or none at all, may be used
> (see the description of the NTP timestamp field in Section 6.4.1).
> However, running NTP may be useful for synchronizing streams
> transmitted from separate hosts.
> Do WebRTC clients (Chrome, Firefox, OpenWebRTC) sync their clocks with
> NTP servers?
You should ask "do the computers users run WebRTC on sync NTP?" Likely
yes, but not always. And even synced NTP isn't perfect *between*
machines. Some machines don't sync and the time may be off by minutes,
hours, days or more. You can figure out the delta (including one-way
transit time, which will vary from packet to packet!) between sender and
receiver (given access to the RTCP, note below).
>
> How does Chrome handles clock drift between the sender and the receiver?
This is handled by the jitter buffers and associated time-warping done
to avoid jitter buffer buildup. Basically, the mechanisms for an
adaptive jitter buffer as a side-effect will compensate for clock drift
between sender and receiver.
>
> Can I compensate the clock drift with the following?
> - Save the receiver local timestamp for each SR packet
> - Get a polynomial fit that translates SR NTP timestamp to receiver
> local timestamp.
> - Use the polynomial fit with setpts/asetpts in ffmpeg.
>
https://ffmpeg.org/ffmpeg-filters.html#setpts_002c-asetpts
Maybe...
Note: unless you are a true WebRTC endpoint (and are decrypting the
packets), you have no access to the RTP/RTCP-level of media. A JS
client can manipulate the decoded streams (or feed them to
MediaRecorders, which will reencode them into media files), but can't
access the packets themselves. Recording the packets will be worthless
as you don't have access to the keys to decrypt them.
--
Randell Jesup -- rjesup a t mozilla d o t com
Please please please don't email
randel...@jesup.org! Way too much spam