WMEncoder TimeCode RRS feed

  • Question

  • Hi all.

    I use WMEncoder ActiveX Plugin to broadcast live video stream .

    The source is web cam.

    On client side I  use WMPlayer ActiveX plugin.

    On client side I get current timecode like this:

    (WindowsMediaPlayer1.controls as IWMPControls3).currentPositionTimecode

    now question: How can I get current TimeCode at the Encoder side?

    I try to get sample count from Encoder stats:

    WMEncoder.Statistics.StreamOutputStats[WMENC_VIDEO, 0, 0] as IWMEncOutputStats2.SampleCount

    and then generate timecode using average sample rate.

    function TForm1.GetServerTimeCode: TTimeCode;

      Stats: IWMEncOutputStats2;
      Frames: Cardinal;
      FrameRate: Extended;
      TotalSec: Cardinal;
      TotalMin: Cardinal;
      TotalHours: Cardinal;
      Stats := WMEncoder.Statistics.StreamOutputStats[WMENC_VIDEO, 0, 0] as IWMEncOutputStats2;
      Frames := Trunc(Stats.SampleCount*10000);

      TotalSec := Trunc(Frames/FrameRate);
      TotalMin := Trunc(TotalSec/60);
      TotalHours := Trunc(TotalMin/60);

      Result.Frames := Trunc(Frames - FrameRate * TotalSec);
      Result.Seconds := TotalSec mod 60;
      Result.Minutes := TotalMin mod 60;
      Result.Hours := TotalHours mod 24;

    But such timecode run much more faster than client timecode!!!

    How I can do it properly?

    thaks. sory for my english.

    Wednesday, November 1, 2006 7:00 AM