NickeManarin/ScreenToGif · error · Exception
DirectShow SampleGrabber not installed/registered!
Error message
DirectShow SampleGrabber not installed/registered!
What it means
CaptureWebcam.CreateGraph needs the DirectShow SampleGrabber COM filter. It calls Type.GetTypeFromCLSID(Uuid.Clsid.SampleGrabber); if that returns null (the COM class is not registered), it throws. The SampleGrabber lives in qedit.dll and is part of the legacy DirectShow runtime.
Source
Thrown at ScreenToGif/Webcam/DirectX/CaptureWebcam.cs:260
{
//Make a new filter graph.
GraphBuilder = (ExtendStreaming.IGraphBuilder)Activator.CreateInstance(Type.GetTypeFromCLSID(Uuid.Clsid.FilterGraph, true));
//Get the Capture Graph Builder.
var clsid = Uuid.Clsid.CaptureGraphBuilder2;
var riid = typeof(ExtendStreaming.ICaptureGraphBuilder2).GUID;
CaptureGraphBuilder = (ExtendStreaming.ICaptureGraphBuilder2)Activator.CreateInstance(Type.GetTypeFromCLSID(clsid, true));
//Link the CaptureGraphBuilder to the filter graph
var hr = CaptureGraphBuilder.SetFiltergraph(GraphBuilder);
if (hr < 0)
Marshal.ThrowExceptionForHR(hr);
var comType = Type.GetTypeFromCLSID(Uuid.Clsid.SampleGrabber);
if (comType == null)
throw new Exception("DirectShow SampleGrabber not installed/registered!");
var comObj = Activator.CreateInstance(comType);
SampGrabber = (EditStreaming.ISampleGrabber)comObj; comObj = null;
_baseGrabFlt = (CoreStreaming.IBaseFilter) SampGrabber;
var media = new CoreStreaming.AmMediaType();
//Get the video device and add it to the filter graph
if (VideoDevice != null)
{
VideoDeviceFilter = (CoreStreaming.IBaseFilter)Marshal.BindToMoniker(VideoDevice.MonikerString);
hr = GraphBuilder.AddFilter(VideoDeviceFilter, "Video Capture Device");
if (hr < 0)
Marshal.ThrowExceptionForHR(hr);
View on GitHub (pinned to a4d0a67c21)
Solutions
- Install the Media Feature Pack (N/KN editions) or enable the Desktop Experience / Media Foundation feature on Server.
- Re-register qedit.dll: run `regsvr32 %SystemRoot%\System32\qedit.dll` from an elevated prompt.
- Run `sfc /scannow` to restore missing system binaries.
- If webcam capture is optional, disable the webcam feature until the runtime is repaired.
Example fix
// before
var comType = Type.GetTypeFromCLSID(Uuid.Clsid.SampleGrabber);
if (comType == null)
throw new Exception("DirectShow SampleGrabber not installed/registered!");
// after
var comType = Type.GetTypeFromCLSID(Uuid.Clsid.SampleGrabber);
if (comType == null)
throw new Exception("DirectShow SampleGrabber not installed/registered. Install the Media Feature Pack (N editions) or run: regsvr32 %SystemRoot%\\System32\\qedit.dll"); Defensive patterns
Strategy: validation
Validate before calling
var comType = Type.GetTypeFromCLSID(Uuid.Clsid.SampleGrabber);
if (comType == null)
// surface a user message: install Media Feature Pack or run regsvr32 qedit.dll
return comType != null; Type guard
static bool IsSampleGrabberRegistered => Type.GetTypeFromCLSID(Uuid.Clsid.SampleGrabber) != null;
Try / catch
try { CreateGraph(); }
catch (Exception ex) when (ex.Message.Contains("SampleGrabber"))
{ /* instruct user to install Media Feature Pack / register qedit.dll */ } Prevention
- Detect N/KN editions at install time and prompt for the Media Feature Pack.
- Run `regsvr32 %SystemRoot%\System32\qedit.dll` from an installer step on Server SKUs.
- Gate the webcam feature behind IsSampleGrabberRegistered.
When it happens
Trigger: Selecting a webcam device when qedit.dll (which registers the SampleGrabber CLSID) is missing or unregistered on the machine.
Common situations: Windows N / KN editions without the Media Feature Pack; Windows Server without Desktop Experience / Media Foundation; qedit.dll removed or unregistered by a cleanup tool; older qedit.dll never registered on a stripped Windows image.
Related errors
AI-assisted analysis of NickeManarin/ScreenToGif@a4d0a67c21 (2026-08-13).
Data as JSON: /api/errors/cd76c2239e556a88.
Report an issue: GitHub.