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 5837905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:24:40+00:00 2026-05-22T11:24:40+00:00

I am using DirectShow.Net and I am capturing video from a webcam and saving

  • 0

I am using DirectShow.Net and I am capturing video from a webcam and saving it to an AVI file. AVI files can get large and I would like to save it in a different format. I am using ICaptureGraphBuilder2::SetOutputFileName( MediaSubType.type, name, out, out). ICaptureGraphBuilder will only let me use a MediaSubType of .AVI or .ASF to save a file. If i try to change the type it tries to save as, it will crash:

            graphBuilder = (IGraphBuilder) new FilterGraph();

        //Create the Capture Graph Builder

        ICaptureGraphBuilder2 captureGraphBuilder = null;
        captureGraphBuilder = (ICaptureGraphBuilder2) new CaptureGraphBuilder2();

        //Create the media control for controlling the graph
        mediaControl = (IMediaControl) this.graphBuilder;

        // Attach the filter graph to the capture graph
        int hr = captureGraphBuilder.SetFiltergraph(this.graphBuilder);
        DsError.ThrowExceptionForHR(hr);

        //Add the Video input device to the graph
        hr = graphBuilder.AddFilter(theDevice, "source filter");
        DsError.ThrowExceptionForHR(hr);


        //Add the Video compressor filter to the graph
        hr = graphBuilder.AddFilter(theCompressor, "compressor filter");
        DsError.ThrowExceptionForHR(hr);

        //Create the file writer part of the graph. SetOutputFileName does this for us, and returns the mux and sink
        IBaseFilter mux;
        IFileSinkFilter sink;
        hr = captureGraphBuilder.SetOutputFileName(MediaSubType.MPEG1Video, textBox1.Text, out mux, out sink);
        captureGraphBuilder.SetOutputFileName

        DsError.ThrowExceptionForHR(hr);


        //Render any preview pin of the device
        hr = captureGraphBuilder.RenderStream(PinCategory.Preview, MediaType.Video, theDevice, null, null);
        DsError.ThrowExceptionForHR(hr);

Is there a way to save to anything other then AVI or ASF without too much hassle?

  • 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-05-22T11:24:40+00:00Added an answer on May 22, 2026 at 11:24 am

    The problem is most likely not the AVI container format but the codec that you are using to compress the video.

    You will need to add a different video compression filter (probably MPEG4 or AVC) and wherever you get that will probably also supply an MP4 mux that you can and should use instead of the avi mux that you are using now.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I want to convert the code at Webcam using DirectShow.NET to C#. It
I am using DirectShow .NET to display video in a control in a C#
I have a project where I need to record a video using DirectShow from
I've been using DirectShow.NET to interface with a webcam in C# and so far
I'm writing some code to handle video input from some cameras using DirectShow, so
Using VS2008, C#, .Net 2 and Winforms how can I make a regular Button
Here is a code snippet from DirectShowNet library, used to open a video file:
How to capture data from camera with out using DirectShow? (in C# on windows
I currently have a DirectShow.NET graph that properly plays but I would like it
I am playing video using custom allocator using directshow. I want to set brightness,

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.