There is filter Dump with sources in Windows SDK Samples.
Im compile that, registered with regsvr32. But I will not understand as to him to connect for example any Mux that would weigh a stream he wrote down in a file. Though I can isn't correct I understand as he works.

CoCreateInstance(CLSID_DUMP, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void**)&pDump);
pGraph->AddFilter(pDump, L"DUMP");
pDump->QueryInterface(IID_IFileSinkFilter, (void**)&pSink);
pSink->SetFileName(m_FileName, NULL);

IPin* MuxOut;
IPin* WriterIn;

MuxOut = GetPin(pMux, PINDIR_OUTPUT);
WriterIn = GetPin(pDump, PINDIR_INPUT);

hr = pGraph->Connect(MuxOut, WriterIn);

After last line hr becomes equal -2147220969.