Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8033749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:47:49+00:00 2026-06-05T01:47:49+00:00

i am recording video from webcam using DirectshowLib2005.dll in C#.net..i have this code to

  • 0

i am recording video from webcam using DirectshowLib2005.dll in C#.net..i have this code to startVideoRecoding as below..

try
        {
            IBaseFilter capFilter = null;
            IBaseFilter asfWriter = null;
            IFileSinkFilter pTmpSink = null;
            ICaptureGraphBuilder2 captureGraph = null;
            GetVideoDevice();
            if (availableVideoInputDevices.Count > 0)
            {
                //
                //init capture graph
                //
                graphBuilder = (IFilterGraph2)new FilterGraph();
                captureGraph = (ICaptureGraphBuilder2)new CaptureGraphBuilder2();
                //
                //sets filter object from graph
                //
                captureGraph.SetFiltergraph(graphBuilder);
                //
                //which device will use graph setting
                //
                graphBuilder.AddSourceFilterForMoniker(AvailableVideoInputDevices.First().Mon, null, AvailableVideoInputDevices.First().Name, out capFilter);
                captureDeviceName = AvailableVideoInputDevices.First().Name;
                //
                //check saving path is exsist or not;if not then create
                //
                if (!Directory.Exists(ConstantHelper.RootDirectoryName + "\\Assets\\Video\\"))
                {
                    Directory.CreateDirectory(ConstantHelper.RootDirectoryName + "\\Assets\\Video\\");
                }
                #region WMV                   
                //
                //sets output file name,and file type
                //
                captureGraph.SetOutputFileName(MediaSubType.Asf, ConstantHelper.RootDirectoryName + "\\Assets\\Video\\" + videoFilename + ".wmv", out asfWriter, out pTmpSink);                    
                //
                //configure which video setting is used by graph
                //                
                IConfigAsfWriter lConfig = asfWriter as IConfigAsfWriter;
                Guid asfFilter = new Guid("8C45B4C7-4AEB-4f78-A5EC-88420B9DADEF");
                lConfig.ConfigureFilterUsingProfileGuid(asfFilter);
                #endregion
                //
                //render the stram to output file using graph setting
                //
                captureGraph.RenderStream(null, null, capFilter, null, asfWriter);
                m_mediaCtrl = graphBuilder as IMediaControl;
                m_mediaCtrl.Run();
                isVideoRecordingStarted = true;
                VideoStarted(m_mediaCtrl, null);
            }
            else
            {
                isVideoRecordingStarted = false;
            }
        }
        catch (Exception Ex)
        {               
           ErrorLogging.WriteErrorLog(Ex);
        }

if you observe this lines of code

//
                //configure which video setting is used by graph
                //                
                IConfigAsfWriter lConfig = asfWriter as IConfigAsfWriter;
                Guid asfFilter = new Guid("8C45B4C7-4AEB-4f78-A5EC-88420B9DADEF");
                lConfig.ConfigureFilterUsingProfileGuid(asfFilter);

it will apply video setting which is described on that GUID i got this GUID from file located at “C:\windows\WMSysPr9.prx”..

so my question is how create my own video setting with format,resolutions and all?

How to Record video using webcam in black and white mode or in grayscale?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T01:47:51+00:00Added an answer on June 5, 2026 at 1:47 am

    so my question is how create my own video setting with format,resolutions and all?

    GUID based profiles are deprecated, though you can still use them. You can build custom profile in code using WMCreateProfileManager and friends (you start with empty profile and add video and/or audio streams at your discretion). This is C++ API, and I suppose that WindowsMedia.NET, a sister project to DirectShowLib you are already using, provides you interface into .NET code.

    Windows SDK WMGenProfile sample both shows how to build profile manually and provides you a tool to build it interactively and save into .PRX file you can use in your application.

    $(WindowsSDK)\Samples\multimedia\windowsmediaformat\wmgenprofile

    enter image description here

    How to Record video using webcam in black and white mode or in grayscale?

    The camera gives you a picture, then it goes through pipeline up to recording through certain processing. Ability to make it greyscale is not something inherent.

    There are two things you might want to think of. First of all, if the camera is capable of stripping color information on capture, you can leverage this. Check it out – if its settings have Saturation slider, then you just put it input minimal value position and the camera gives you greyscale.

    In code, you use IAMVideoProcAmp interface for this.

    Another option, including if the camera is missing mentioned capability, is to apply post processing filter or effect that converts to greyscale. There is no stock solution for this, and otherwise there are several ways to achieve the effect:

    • use third party filter that strips color
    • export from DirectShow pipeline, convert data in code using Color Control Transform DSP (available starting Win Vista) or GDI functions
    • use Sample Grabber in the streaming pipeline and update image bits directly
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am recording a video from the iPhone camera by using the AVCam code
Introduction After watching this video from LIDNUG, about .NET code protection http://secureteam.net/lidnug_recording/Untitled.swf (especially from
I have received the following video file from a camera (from security camera) http://dl.dropbox.com/u/1369478/tmw/recording.264
I have an OpenGL view of which I am recording a video using what
I am recording video and audio from android then i have to upload those
I have a project where I need to record a video using DirectShow from
Following is the code from my audio, video recording project. The audio file is
I have my app set up to record video from the camera using an
I'm recording video from a live stream. The format we're recording in requires the
My basic requirement is to capture video using UIImagePickerController. The recording of video should

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.