Microsoft DirectShow 9.0


The SetMasterStream method specifies a stream that will be used to synchronize the other streams in the file.


  HRESULT SetMasterStream(
  LONG iStream



[in] Specifies the index of the stream, or –1 to indicate no master stream. The AVI Mux writes one stream for each connected input pin. Stream numbers are indexed from zero.

Return Values

Returns an HRESULT value. Possible values include the following.

Value Description
E_INVALIDARG Invalid argument.
S_OK Success.


If you are capturing audio and video from two different sources, use this method to synchronize the streams. Streams coming from separate capture sources may be captured at slightly different rates. If you specify a master stream, the AVI Mux adjusts the playback rates for the other streams, to compensate for any drift that might occur.

It is recommended to use the audio stream as the master stream, because minor adjustments to the video playback rate are less noticeable than changes to the audio playback rate. Also, modifying the audio playback rate will cause the audio to be resampled by the audio driver.

This method works by adjusting the dwScale and dwRate values in the AVISTREAMHEADER structure.


Header: Declared in Strmif.h; include Dshow.h.

Library: Use Strmiids.lib.

See Also