Click here to Skip to main content
15,891,136 members
Everything / DirectShow

DirectShow

directshow

Great Reads

by Maxim Kartavenkov
Articles describes how to create virtual video capture source directshow filter in pure C#
by Maxim Kartavenkov
Article describes how to make H.264 Video Encoder DirectShow Filter using NVIDIA encoder API in C#
by Maxim Kartavenkov
Article shows how easy to make various video effects using PixelShaders in Direct3D.
by Maxim Kartavenkov
Article describes basic task which are requre to solve for developing your own DirectShow Splitter filters.

Latest Articles

by Maxim Kartavenkov
Make H.264 Video Encoder DirectShow Filter in C# using AMF SDK API from AMD
by Maxim Kartavenkov
This is a guide on how to configure your application, service or driver to handle appearing the new devices or device removal avoiding reboot request.
by free5lot
Camera_Net is a FLOSS library for using video-cameras and video-inputs in .NET projects easily
by Andreask84
In this article, I propose a simple application written entirely in Python that allows you to capture images from a camera using DirectShow and to perform simple processing on them using OpenCV.

All Articles

Sort by Score

DirectShow 

13 Oct 2012 by Maxim Kartavenkov
Articles describes how to create virtual video capture source directshow filter in pure C#
16 Jul 2012 by Maxim Kartavenkov
Article describes how to make H.264 Video Encoder DirectShow Filter using NVIDIA encoder API in C#
20 Nov 2012 by Maxim Kartavenkov
Article shows how easy to make various video effects using PixelShaders in Direct3D.
7 Oct 2012 by Maxim Kartavenkov
Article describes basic task which are requre to solve for developing your own DirectShow Splitter filters.
10 Jul 2012 by Maxim Kartavenkov
Articles describes how to make pure C# rendering video on VMR9 with custom allocator presenter over Direct3D in .NET
13 Oct 2023 by Maxim Kartavenkov
This is a guide on how to configure your application, service or driver to handle appearing the new devices or device removal avoiding reboot request.
13 Oct 2012 by Maxim Kartavenkov
Article describes basic tasks for implementing your own File Source DirectShow filters.
9 Jul 2011 by DaveAuld
There is a technical blog article on the subject;Face Recognition Project: Introduction To Face Recognition[^]
7 Sep 2012 by Dynamsoft
In this article, I’ll share with you how to utilize Dynamic .NET TWAIN in a WPF application to process your documents.
24 Jan 2024 by Maxim Kartavenkov
Make H.264 Video Encoder DirectShow Filter in C# using AMF SDK API from AMD
13 Mar 2011 by Espen Harlinn
This may help:Webcam with VISUAL C++ MFC[^]If that's not enough here is a few optional answers[^]RegardsEspen Harlinn
15 Mar 2011 by Olivier Levrey
If you want to really improve your image display, then consider using hardware accelerated functions. Use DirectX or OpenGL libraries.Once, I used DirectX and sprites to display a 2D image (and a few more things). I will copy the code that worked for me, but please note I am not a Direct3D...
28 Mar 2012 by Jochen Arndt
See How to avoid error "LNK2001 unresolved external" by using DEFINE_GUID[^].
9 Aug 2012 by Volynsky Alex
If you want simulate the printscreen in C++.Try this small example then...#include char EditText[256];int EditTextLength;/* Declare Windows procedure */LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);/* Make the class name into a global variable */char...
15 Mar 2013 by Maxim Kartavenkov
You should get connected media type of your renderer and get information from VIDEOINFOHEADER structure.double GetFPS(IBaseFilter * _filter){ double _fps = 0; if (_filter) // Check if the filter passed { IEnumPins * _enum; // Query Enum pins if...
6 Apr 2013 by Sergey Alexandrovich Kryukov
I saw this solution which I don't like very much: http://stackoverflow.com/questions/251467/how-can-i-create-a-video-from-a-directory-of-images-in-c[^].You can try to find some more: http://bit.ly/14NTPTx[^].I wouldn't to it. I would prefer to use FFmpeg which perfectly does this, as...
12 Aug 2013 by Sergey Alexandrovich Kryukov
Please see my comment to the question, and then see the documentation:http://directshownet.sourceforge.net/faq.html[^].Basically, the Capture object expects the parameter representing the index of the device. Then you can use two different Capture objects exactly in the same way as you...
11 Nov 2013 by SoMad
You don't mention the parameters you need to record at, specifically image resolution and frame rate. The higher you go on those settings, the more you will be taxing that poor Atom processor if you insist on doing the compression on the PC.I have worked on a product for many years where video...
29 Sep 2020 by Pete O'Hanlon
Getting the handle requires a little bit of PresentationSource trickery. Your code will look something like this:HwndSource hwnd = PresentationSource.FromVisual(theControl) as HwndSource; if (hwnd != null) { handle = hwnd.Handle; }
28 Jan 2010 by Xmen Real
A Simple C# Wrapper for the AviFile Library[^]
7 Jun 2010 by narmadha_s
This is Narmadha. Currently I am doing Video Capturing Project using Directshow. For this I Need Help for How to Save the video file in MPEG1,MPEG2,MOV,DV,WMV,AVI.Pls some body help me.Thanks in Advance.
8 Jul 2010 by helianthus87
Try out OpenCV library which has very nice support for cameras and image processing at all and its for free ;)I'm not sure whats the web of this projectbut here's link to OpenCV wiki. You can find anything you need there.http://opencv.willowgarage.com/wiki/
13 Jan 2011 by Kozlov_Sergey
What should I use instead of CreatePosPassThru for multiple input pins?STDMETHODIMP CTransformerOutputPin::NonDelegatingQueryInterface(REFIID riid, void **ppv){ CheckPointer(ppv,E_POINTER); ValidateReadWritePtr(ppv,sizeof(PVOID)); *ppv = NULL; if (riid ==...
26 Jan 2011 by Kozlov_Sergey
I have found "avisplitter.ax". It is perfect.
18 Mar 2011 by Kozlov_Sergey
I have got own video switcher filter. It has 20 input pins and 1 output pin. Every second only one input pin is active. Data from active input pin goes to output pin and next filter input pin.When i connect this filter after MPEG2 Decoder there is no image drawn by render filter. Without my...
21 Mar 2011 by cougar10
i'm currently reading the documentation of MSDN to render a stream to an audio renderer.. or in other word, to play my captured data from microphone.http://msdn.microsoft.com/en-us/library/dd316756%28v=vs.85%29.aspxthis example provides example.My problem now is that i couldn't...
4 Apr 2011 by MaulikDusara
use graphbuilder create a graph for that and add your device from external device
20 Apr 2011 by Groulien
Hello all,Whilst working on a project, a strange little idea popped into my mind.I want to play a media file (any format but without a gui), allow the user to pause/resume the video and add the option to extract that frame as a bitmap (instead of making a screenshot).I've found the...
9 Jul 2011 by thatraja
Addition to Dave's answer.Found a bunch in CPHuman Emotion Detection from Image[^]Pupil or Eyeball Detection and Extraction by C# from eye image[^]Face Detection in C#[^]Face and Eyes Detection Using OpenCV[^]Efficient Face Detection Algorithm using Viola Jones method[^]Face...
20 Feb 2012 by weirdProgrammer-2
Hello,I have just started off a little bit of programming with Directshow.What I can do quiet easily is link up IGraphBuilder to a few filters such as IMediaControl, IBaseFilter, IVMRWindowlessControl, etc and play an avi file from the local harddrive by using a pGraph->RenderFile(..)...
20 Feb 2012 by Sergey Alexandrovich Kryukov
Of course you should not use temporary files. This is a pretty big topic though.I hope this cycle of three CodeProject articles can help you to understand the techniques involved:DirectShow Filters Development Part 1: Video Rendering with Direct2D[^],DirectShow Filters Development Part...
27 Mar 2012 by OriginalGriff
Take out one of the close brackets and change the semicolon to a comma:OUR_GUID_ENTRY(CLSID_Sourcefilter_AVI_WAV, 0xd3588ab0, 0x0781,0x11ce, 0xb0,0x3a, 0x00 ,0x20, 0xaf ,0x0b,0xa7,0x70);x0b,0xa7,0x70);Becomes:OUR_GUID_ENTRY(CLSID_Sourcefilter_AVI_WAV, 0xd3588ab0,...
29 Mar 2012 by barneyman
Looking at that filter in GraphEdit shows it to be a DMO - you need to wrap DMO's up in the IDMOWraperFilter[^] before you can use them as IBaseFiltersThe code in that web page is almost an exact replacement for your AddFilterByCLSID function
4 May 2012 by lanhxg
HRESULT CPlayer::AddDefaultDirectSoundDevice ( IFilterGraph *pfG,IBaseFilter ** ppF, LPCWSTR wszName){ HRESULT hr ; ICreateDevEnum *pSysDevEnum = NULL; hr =...
8 May 2012 by Code-o-mat
I wanted to add this as a comment, but since that function seems to be gone (and i can't seem to be able to figure out how to send a "private message")...Did you specify the input for the filter? If not, try specifying the input (e.g. the URL or file name or whatever) and do the enumerating...
14 May 2012 by stib_markc
I have to capture the media stream coming from a website(say www.youtube.com). Are there any source filters for this task? If I have to write a filter myself for this task, then how to capture a stream that is coming from a website to my PC?
2 Aug 2012 by Dynamsoft
In this article, I’ll show you how to embed document processing, such as image scanning, editing, and uploading, to your .NET application.
3 Oct 2012 by Maxim Kartavenkov
You are wrong abt DirectShow. That is possible to make using DirectShow without problems: you should write filter which will do providing data, you downloading, to upstream filters.DirectShow uses the DirectSound for playback, but standalone DirectSound does not performs the decoding (mp3...
14 Oct 2012 by Maxim Kartavenkov
Hello,Devices are enumerated in your PC according they were initially appear in the system (Installed/USB Connected and so on). To identify the camera you can use moniker display name. Is contains full path to the device in a system, It can contains device PID and VID or other device key,...
27 Oct 2012 by Maxim Kartavenkov
Hello,Here you just need to insert your capture source ("Hauppauge WinTV PVR PCI II Capture") into filter graph, then render it via ICaptureGraphBuilder2 from pin "656" using RenderStream. So the brief graph building will be looks:ICaptureGraphBuilder2 _builder;IPin _output =...
30 Nov 2012 by Maxim Kartavenkov
Hello,#pragma comment(lib,"wmcodecdspuuid.lib")or __uuidof(CResizerDMO) instead of CLSID_CResizerDMORegards,Maxim
30 Nov 2012 by Maxim Kartavenkov
I post here as in comment it shows not formattedIBaseFilter * pYourFilter; // initialized int _numerator; // rate numeratorint _denominator; // rate denominatorIPropertyStore * _store;if (S_OK == pYourFilter->QueryInterface(IID_IPropertyStore,(void**)&_store)){ PROPVARIANT...
14 Mar 2013 by ud_
This is a solution from graph edit plus.CComPtr CreateFilterByName(const WCHAR* filterName, const GUID& category){ HRESULT hr = S_OK; CComPtr pSysDevEnum; hr = pSysDevEnum.CoCreateInstance(CLSID_SystemDeviceEnum); if (hrcheck(hr, "Can't create System...
24 Mar 2013 by Maxim Kartavenkov
I already anwering you abt that you should know filter interface which used to control it properties. After query that interface froom your filter object and use it methods to modify filter settings.IBaseFilter * _filter; // initialized by CoCreateInstanceIFilterControl * _interface;//...
28 Mar 2013 by Sergey Alexandrovich Kryukov
Please see: http://www.codeproject.com/search.aspx?doctypeid=1&q=%28Webcam+OR+%22Web+camera%22+OR+%22USB+Camera%22%29+%22.NET%22[^].You will find some decent solutions.—SA
11 Jun 2013 by JackDingler
There are two common methods for doing this.1. Check you cursor coordinates against each shape to see if it comes near any primitive. The downside of this technique is that the more shapes you have on the screen, the more need you'll have for optimizations to prune the selections down,...
2 Oct 2013 by Eduard Keilholz
DirectX (DirectSound) should be a good solution for WindowXP. You need to create a Filter (see the examples of DirectX, there are a couple of filter examples) and then make sure sounds are being played using a graph that includes your filter.Your filter must then provide information about...
13 Jun 2014 by J.Surjith Kumar
I am trying to create directshow virtual source filter. Which is to deliver the video sample of what the renderer currently displays. Exactly like what e2evcam filters does. I tried using the sample of push source filter example from the sdk, its accessing the image from the particular location...
7 Jan 2017 by KarstenK
The best way is to create a top-most window with transparent background and than draw the line in it.
16 Jan 2017 by KarstenK
Create and populate the bitmap and the other stuff once at program start. These operations are "expensive" so do them as less as possible.//Gobal bitmapBITMAP bm = {0};// init with zerosvoid drawlineOverlay(HWND m_hwndApp){ //run code once if( bm.bmWidth == 0 ) { // set...
23 Aug 2020 by Hank Williams
Have you tried using the Aforge VideoSourcePlayer control instead of the picturebox control? I think the VideoSourcePlayer control is more suited to your needs.
22 Nov 2009 by arash333
I am working with DirectShow. How can I work with two different types of cameras and read their data and render detail from both cameras in a synchronized way?I have already written a program that can read a camera's raw data but now I need to work with 2 cameras and synchronize them.
28 Nov 2009 by Matthew Tsay
Hi:You can add two camera source filters to your filter graph.And also two video render filters.Then connect them properly.Run the Filter Graph, then it is done. :laugh: In general, you don't have to purposely sync the two camera signal.Unless you need a precise control.Cheers!
28 Jan 2010 by Stephen Winch
Hi,This is the first C# program I've written and I'm having a slight problem trying to compress the video, I can get the video to display and save as an AVI, but it is uncompressed so takes a lot of disk space.I have added a snippet of code to show I am using the...
17 Feb 2010 by Fedos89
Good time of day!I have a problem, I need to rotate video in a window at an free angle. Is this possible (I am an dilettante in DirectShow), and how?Thank you.P.S. Sorry for my English)
18 Feb 2010 by Tim Yen
This has to be doable. You probably have to put a rotation filter into the DirectShow filter chain.Microsoft has a DirectShow player that rotates[^]Here's one that can claim to do it for...
2 Apr 2010 by roschler
I've written a DirectShow push filter for use with Skype using Delphi Pro 6 and the DSPACK DirectShow library. In preview mode, when you test a video input device in the Skype client Video Settings window, my filter works flawlessly. I can leave it up and running for many minutes without an...
3 Apr 2010 by E.F. Nijboer
Hello roschler,dropped udp packages? CoInitialize/CoInitializeEx propblems?My advice would be to wrap it into try..except and log into the system event log. You could also log the thread activity so you can detect if anything or nothing is happening. This could give you more info on...
3 Apr 2010 by roschler
"dropped udp packages? CoInitialize/CoInitializeEx propblems?My advice would be to wrap it into try..except and log into the system event log. You could also log the thread activity so you can detect if anything or nothing is happening. This could give you more info on what's happening and...
12 Apr 2010 by E.F. Nijboer
Hello Robert,On the skype website there is an interesting hotfix that addresses to your problem. With this hotfix we have resolved a security vulnerability in Skype's Extras Manager and fixed video freezing issues for some of our users who were experiencing...
12 Apr 2010 by roschler
Hello E.F. Nijboer,It turns out it's a problem that they introduced in a version some time after version 4.1.0.179. That version works fine. But the the 4.2 variants I've tried all fail. I discovered this because fortunately I had 4.1.0.179 on another station I had not upgraded and it did...
14 Apr 2010 by E.F. Nijboer
Hello Robert,My last answer was quite on the spot then :-D Hopefully they fix it soon and now you know it wasn't you.... and bet it makes you feel a hole lot better :) Etienne
14 Apr 2010 by roschler
Only if they fix it soon, otherwise I'll still feel bad. :)
19 Apr 2010 by Darkcharm
For days ,I tried to capture video streams by Web Camara with DirectShowLib.DLL and I gone through the samples to find the way .At last I writed the codes like this:DsDevice[] theDevices;theDevices = DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice );this .Text =theDevices...
19 Apr 2010 by oycw
I can display a picture or a sound via the method "RenderFile" of IGraphbuilder interface. But I want to display a picture and a sound at the same time。how do I?thanks.
20 Apr 2010 by mateusz.matyaszek
How about creating two instances of IGraphbuilder and using one for picture and other for sound. You will encouther problems with synchronization. There is a good article about this in The Code Project.
1 Jun 2010 by AndreBroz
How to debug DirectShow
8 Jun 2010 by Dylan Morley
Nice article here...Video File Saving in Windows Media Video Format for the DirectX.Capture Class Library[^]Lots of links to other threads herehttp://www.dotnetspider.com/forum/160289-How-save-video-files-ASP-Net-using-C.aspx[^]
23 Jun 2010 by Kim Mingon
Hello~~Is there anyone watch the World Cup 2010??I'm Korean so really really happy that Korean Team has gone to the Round of 16! Wow~!!Anyway...There is some Questions about DirectShow!I've made the program which could extract part of AVI from AVI file using...
3 Jul 2010 by btap_644
Hi, I tried to recreate the BitmapMixer sample from Directshow.NET in VS 2010 (The original sample works fine) and got the following errors in the Form1.csError 1 The name 'MainForm_ResizeMove' does not exist in the current context C:\Documents and Settings\TLNA\my documents\visual studio...
3 Jul 2010 by btap_644
I got the code below from the bitmapmixer sample (DirectShow.NET) and i tried to reimplement it. The original sample works fine. In my version when I try to compile i get errors.private void AddHandlers() { // Add handlers for VMR purpose this.Paint += new...
29 Jun 2010 by btap_644
Hi, I have compiled the sample PLayCap (http://sourceforge.net/projects/directshownet/files/) from the directshow.NET (http://directshownet.sourceforge.net/) website in C#.PLayCap - This application creates a preview window for the first video capture device.Although the program works...
29 Jun 2010 by William Winner
Well, just quickly looking at the source code, DirectShow uses an IVideoWindow.In the source code, it sets the owner of the IVideoWindow to the form.You could, instead, probably use a panel and just change the line:hr = this.videoWindow.put_Owner(this.Handle);to hr =...
3 Jul 2010 by Estys
Your previous question already covered the problem.All the methods and/or names present in the error messages need to be reachable by the compiler either through definition in your code or by reference to the assembly and namespace.Cheers
3 Jul 2010 by btap_644
Answer can be found at http://stackoverflow.com/questions/3171507/the-name-marshal-does-not-exist-in-the-current-context/3171515#3171515
5 Jul 2010 by fanfanfyq
I'm working on a application recording video from TV via DirectShow. The function used is SetOutputFileName() parameter : MEDIASUBTYPE_AviIf compression filter (Cinepak Codec by Radius) is applied, the video recorded is suffering severe frame dropping. If no compression filter is applied,...
5 Jul 2010 by Christian Graus
You need to use a better codec and get a faster machine, or use a lower image size or frame rate. You're dropping frames b/c your computer can't keep up, and you're out of sync because the codecs that come with windows all suck. DivX is a good codec. The other thing you can do with a slow...
7 Jul 2010 by weylspinor
I am trying to write a a simple program that converts video from my webcam into ASCII text, like an ASCII art video. I currently have Visual Studio 2008, and will soon upgrade to VS 2010. My machine is Windows 7, 64 bit. My question is, which SDK can I use which will allow me to take frames...
3 Aug 2010 by Jarno Burger
I had also problems with the sample grabber towards a null renderer , to be used for direct3d surfaces , this is how i solved the samplegrabber part in c# ( i use directshow.net and c#):my sample grabber : /// /// a callback handler for samples /// The ISampleGrabberCB...
10 Aug 2010 by Asif Bahrainwala
Taking snapshots of video overlay using DirectShow
12 Sep 2010 by David Hey
hi,i have write(using vb.net) a small karaoke system which can play .mpeg, .AVI, .VOB 1 format video file by using directshow.but currently i'm facing a problem which i cant control the audio channel / track in the music video.Is that any methods or ways to allow me to control the audio...
12 Sep 2010 by Abhinav S
Chcek these[^] links out.
19 Sep 2010 by David Hey
hi,i have write(using vb.net) a small karaoke system which can play .mpeg, .AVI, .VOB 1 format video file by using directshow.but currently i'm facing a problem which i cant control the audio channel / track in the music video.Is that any methods or ways to allow me to control the audio...
27 Jan 2011 by Kozlov_Sergey
Where can i take "WMV Splitter Filter"?First i will use it in "Graph Edit" from Direct eXtensions Software Development Kit, then in my program in C++.
21 Sep 2010 by Kozlov_Sergey
It could be memory returning problems.
20 Sep 2010 by Sandeep Mewara
It's a 4th repost[^]! :doh: Whats the point? Stick to one. Wait for response. If needed edit/update it. (Just to add here, if you edit your question it will again pop it back at the top of questions stack.)
20 Sep 2010 by Sandeep Mewara
Its 2nd repost[^]!... :doh:
29 Sep 2010 by Kozlov_Sergey
I try to create copy of IMediaSample from one of my two input pins of my Filter.Function HRESULT hr = m_pAllocator->GetBuffer(&pMediaSample->pOUTSBuffer_1,&start_time, &end_time,AM_GBF_NOTASYNCPOINT);returns 0x80040211.When using this function, Graph Edit hangs.
29 Sep 2010 by Kozlov_Sergey
I decided to usepMediaSample->pINSSBuffer_1->QueryInterface(IID_IMediaSample,(void**)&pMediaSample->pOUTSBuffer_1);But i do not know, if QueryInterface creates new instance of desired object.
30 Sep 2010 by Kozlov_Sergey
Graph Edit hangs because of this function, when begining to play movies.What is wrong?STDMETHODIMPCEncOutPin::NonDelegatingQueryInterface(REFIID riid, void **ppv){ CheckPointer(ppv,E_POINTER); ASSERT(ppv); *ppv = NULL; HRESULT hr = S_OK; // See what interface...
1 Oct 2010 by Kozlov_Sergey
Here 2 interfaces for each pin must be returned. But we can return only 1 interface. That is the problem. To control seeking on 2 input pins, we must have 2 pairs of interfaces. But we can return only 1. So how can we get information of requiring pin?
1 Oct 2010 by Kozlov_Sergey
I have modified project BaseClasses so now i can manage 2 pins. May be the desigion is to create 2 output pin (1 for each input pin) to set 1 input - 1 output. Output are same^ stereo picture.Any ideas?STDMETHODIMPCEncOutPin::NonDelegatingQueryInterface(REFIID riid, void **ppv){ ...
4 Oct 2010 by Kozlov_Sergey
I tryed to implement IMediaSeeking in Filter class.I have implemented interface request, most of functions.When request of this interface is enabled in my Filter appears ASSERT message when creating Filter.When request of this interface is disabled Filter hungs on seeking operation.Why...
4 Oct 2010 by Kozlov_Sergey
In the Filter the vector queue is used// Struct for queued samplesstruct Sample{ DWORD dwFlags; IMediaSample *pINSSBuffer_1; // Кадр от первого входного пина IMediaSample *pINSSBuffer_2; // Кадр от второго входного пина IMediaSample *pOUTSBuffer_1; // Кадр от первого...
20 Oct 2010 by Kozlov_Sergey
I have read presentation from NVidio about NVidia 3D Vision.I have got monitor, video board, glasses.I use the render video filter to display video in full screen with the simple video player.In this filter the image is drawing using Direct3D surfaces.I load it from IMediaSample to two...
20 Oct 2010 by Kozlov_Sergey
My second filter displays stereo image, when video consist of two images: left and right together.The question is: "Why sometimes aplication hangs when switching mode to windowed on the line with gImageSrc->Release();?"The code of rendering function is here:HRESULT...
26 Oct 2010 by phongvm90
Dear Experts,I am currently using directShow to write a video player in school project. I use VMR-9 in windowless mode as my renderer filter.Every thing work fine, my video player can play videos! But when I resize (in my case is enlarging) the application (which means resize the video...