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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:03:25+00:00 2026-06-07T17:03:25+00:00

I’m using WMEncoder for screen recording. At the first time everything is working properly,

  • 0

I’m using WMEncoder for screen recording.
At the first time everything is working properly,
but at the second time Start() method throws me OutOfMemoryException:

System.OutOfMemoryException was caught
  HResult=-2147024882
  Message=Not enough storage is available to complete this operation.

My code looks like this and it’s on .Net4:

// Initialize encoder and set recording parameters
mEncoder = new WMEncoder();
SetRecordingParams(); // If it's relevant I can attach this function

// Set the output file.
mEncoder.EnableAutoArchive = true;
mEncoder.AutoIndex = true;
mEncoder.File.LocalFileName = tempRecFile;

// Start the encoding process.
mEncoder.PrepareToEncode(true);
mEncoder.Start();

// If currently recording, stop recording
if (mEncoder != null &&
    mEncoder.RunState != WMENC_ENCODER_STATE.WMENC_ENCODER_STOPPED)
{

    // Stop recording
    mEncoder.Stop();
}

// Releasing Com object
if (mEncoder != null)
{
    Marshal.FinalReleaseComObject(mEncoder);
    mEncoder = null;
}

Help me!

UPDATE

 private void SetRecordingParams()
        {
            // Create a source group collection object from the WMEncoder object.
            srcGrpColl = mEncoder.SourceGroupCollection;

            // Add a source group named SG1 to the collection.
            // Create a source object for each type of multimedia content
            // in the source group.
            srcGrp = (IWMEncSourceGroup2)srcGrpColl.Add("SG_1");
            srcVideo = (IWMEncVideoSource2)srcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_VIDEO);
            srcVideo.SetInput("ScreenCap://ScreenCapture1", "", "");

            // Create a profile collection object from the WMEncoder object.
            mEncoder.ProfileCollection.ProfileDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            mEncoder.ProfileCollection.Refresh();
            proColl = mEncoder.ProfileCollection;

            // Create a profile object
            IEnumerator profEnum = proColl.GetEnumerator();
            while (profEnum.MoveNext())
            {
                profile = (IWMEncProfile)profEnum.Current;
                if (profile.Name == "Screen Recording")
                {
                    // Load profile
                    newProfile = new WMEncProfile2();
                    newProfile.LoadFromIWMProfile(profile);

                    audience = newProfile.get_Audience(0);

                    audience.set_VideoFPS(0, paramMaps.fpsMapping[fpsKey] * 1000);
                    audience.set_VideoKeyFrameDistance(0, keyFrameInt * 1000);
                    audience.set_VideoWidth(0, Screen.PrimaryScreen.Bounds.Width * paramMaps.imageQualityMapping[qualityRatioKey] / 100);
                    audience.set_VideoHeight(0, Screen.PrimaryScreen.Bounds.Height * paramMaps.imageQualityMapping[qualityRatioKey] / 100);

                    // Set profile language to client machine's locale.
                    // When recording is done this way, it will assume server's locale when extracted from the DB.
                    // This enables us to know which locale should be used for the file merge.
                    // We have found that when profile is set to the same language as user's locale, the recording
                    // has a "flexible" language definition.
                    int langCount = newProfile.get_LanguageCount(WMENC_SOURCE_TYPE.WMENC_VIDEO, 0);
                    // Remove all existing language definitions from profile
                    for (int i = 0; i < langCount; i++)
                    {
                        newProfile.RemoveLanguage(WMENC_SOURCE_TYPE.WMENC_VIDEO, 0, newProfile.get_Language(WMENC_SOURCE_TYPE.WMENC_VIDEO, 0, i));
                    }
                    // Add current locale as profile language.
                    int lcid = Thread.CurrentThread.CurrentCulture.LCID;
                    newProfile.AddLanguage(WMENC_SOURCE_TYPE.WMENC_VIDEO, 0, lcid);

                    // Specify this profile object as the profile to use in source group.
                    srcGrp.set_Profile(newProfile);
                }
            }
            mEncoder.VideoComplexity = WMENC_VIDEOCOMPLEXITY.WMENC_COMPLEXITY_LEVEL20;
        }
  • 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-07T17:03:26+00:00Added an answer on June 7, 2026 at 5:03 pm

    WMEncoder is no longer supported by Microsoft apparently. I would recommend looking into the Expression Encoder which make screen capture very easy indeed – http://www.microsoft.com/expression/products/Encoder4_Overview.aspx. And it saves you the hassle of marshalling and dealing with COM.

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

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
I'm making a simple page using Google Maps API 3. My first. One marker
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
Specifically, suppose I start with the string string =hello \'i am \' me And
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

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.