title: DirectShow Jerky Video Playback at Speed
body: <p>I am using DirectShow/VMR9 to playback a MPEG 4 video in my application. I use IMediaSeeking SetRate to set the speed of the video. Playing back a video I have created plays well at speeds up to 4x, above this the video becomes very jerky. Playing back the same file using Windows media player at speeds above 4x is not jerky. Can anyone shed some light as to why windows media player can play my file OK at speed but my DirectShow filter graph cannot. </p>
  
  <p>My graph topology is Recording.avi -> AVI Splitter -> Mpeg4s Decoder DMO -> Ds.NET Grabber -> Color Space Converter -> Video Mixing Renderer 9.</p>
  
  <p>Please let me know if you need any further information.</p>
  
  <p><strong>Update</strong></p>
  
  <p>I removed the grabber (and thus csc as well) and playback is not jerky up to 8x which would be good enough but I do need the grabber. The CSC ended up there when I added the grabber. I would like if possible to remove the CSC to see if that improves things while retaining the grabber. Below are my graphs with intermediate formats with and without the filter. I tried setting the media subtype of the grabber to NV12 (like the non grabber graph), however I get error a "No combination of intermediate filters could be found to make the connection." I include my code for configuring the grabber.</p>
  
  <p>Is it possible to get this to work without the csc?</p>
  
  <p>Also not sure if it is relevant but I do not understand how the video dimensions are changed on the graph without grabber.</p>
  
  <p><strong>With Grabber</strong></p>
  
  <p>Recording.avi ----- (AVI) ----- AVI Splitter ----- (MP4V - 704*576 – 24bits ) ----- Mpeg4s Decoder DMO ----- (RGB24 704*576) ----- Ds.NET Grabber - (RGB24 704*576) ----- Color Space Converter ----- (ARGB32 704*576) ----- Video Mixing Renderer 9</p>
  
  <p><strong>Without Grabber</strong></p>
  
  <p>Recording.avi ----- (AVI) ----- AVI Splitter  ----- (MP4V - 704*576 – 24bits ) ----- Mpeg4s Decoder DMO ----- (NV12 768*576 12 bits) ----- Video Mixing Renderer 9.</p>
  
  <pre><code> private void ConfigureSampleGrabber(ISampleGrabber sampleGrabber)
   {
          AMMediaType media;
          int hr;
  
          // Set the media type to Video/RBG24
          media = new AMMediaType();
          media.majorType = MediaType.Video;
          media.subType = MediaSubType.ARGB32; // tried NV12 here, gives error.
          media.formatType = FormatType.VideoInfo;
          hr = sampleGrabber.SetMediaType(media);
          DsError.ThrowExceptionForHR(hr);
  
          DsUtils.FreeAMMediaType(media);
          media = null;
  
          // Configure the samplegrabber
          hr = sampleGrabber.SetBufferSamples(true);
          DsError.ThrowExceptionForHR(hr);
      }
  </code></pre>
  
  <p><em><strong>CPU Usage details</em></strong></p>
  
  <p><strong>Core i3 - 3300MHz – with hyperthreading 4GB RAM</strong></p>
  
  <p><em>4x Speed</em> </p>
  
  <p>CPU1 ~45%</p>
  
  <p>CPU2 ~0%</p>
  
  <p>CPU3 ~33%</p>
  
  <p>CPU4 ~0%</p>
  
  <p><em>8x Speed</em> </p>
  
  <p>CPU1 ~40%</p>
  
  <p>CPU2 ~25% (but very spiky 0-50%) </p>
  
  <p>CPU3 ~40%</p>
  
  <p>CPU4 ~0%</p>
  
  <p><strong>Core i3 - 3300MHz – Hyperthreading disabled in BIOS.</strong></p>
  
  <p><em>4x Speed</em> </p>
  
  <p>CPU1 ~45%</p>
  
  <p>CPU2 ~33%</p>
  
  <p><em>8x Speed (same results at 16x Speed)</em></p>
  
  <p>CPU1 ~66%</p>
  
  <p>CPU2 ~45%</p>