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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:20:04+00:00 2026-05-11T17:20:04+00:00

I’m compressing raw AVI files to WMV using the ASF Writer. I’m in a

  • 0

I’m compressing raw AVI files to WMV using the ASF Writer.
I’m in a big need to make the compression faster.
There are any hints & best practicevs on how to achieve this ? Drop/lower the indexer impact ? Any hidden compression parameters ?

The files contains just video in RGB/24bits format and the compression level for the video stream is between 200kbps and 2000kbps.

Any configuration hints (using C++, C#, Delphi, etc)

Here is the the part of the code (using DSPack) that configure the WMV writer.

function CreateWMVWriter(VideoQuality, AudioQuality: Cardinal; videoInfo: PVideoInfoHeader; audioInfo: PWaveFormatEx; hasAudio: Boolean): IBaseFilter;
const
  PROFILE_NAME = 'WMV AutoProfile';
  // BUFFER_WINDOW = $FFFFFFFF;  // auto buffer
  BUFFER_WINDOW = 1000;  // 1 second
  MAX_KEY_FRAME_SPACING = 10000000; // 1 seconds
var
  configWriter : IConfigAsfWriter;
  profileManager : IWMProfileManager;
  profile : IWMProfile;
  stream : IWMStreamConfig;
  mediaProps : IWMMediaProps;
  vmediaProps : IWMVideoMediaProps;
  pmt : PWMMediaType;
  msize : Cardinal;
  vih : PVideoInfoHeader;
  wfe: PWaveFormatEx;
  hr : HRESULT;
  videoBitRate, audioBitRate: Cardinal;
  width, height: Integer;
begin
  videoBitRate := VideoQuality * 1000; // kbits
  // create the profile
  CheckDSError(WMCreateProfileManager(profileManager));
  CheckDSError(profileManager.CreateEmptyProfile(WMT_VER_9_0, profile));
  CheckDSError(profile.SetName(StringToOleStr(PROFILE_NAME)));
  CheckDSError(profile.SetDescription(StringToOleStr(PROFILE_NAME)));
  CheckDSError(profile.CreateNewStream(WMMEDIATYPE_Video, stream));
  CheckDSError(stream.SetStreamName(StringToOleStr('Video')));
  CheckDSError(stream.SetBitrate(videoBitRate));
  CheckDSError(stream.SetBufferWindow(BUFFER_WINDOW));
  // config video media type
  stream.QueryInterface(IID_IWMMediaProps, mediaProps);
  CheckDSError(mediaProps.GetMediaType(nil, msize));
  GetMem(pmt, msize);
  CheckDSError(mediaProps.GetMediaType(pmt, msize));
  with pmt^ do
  begin
    majortype := WMMEDIATYPE_Video;
    subtype := WMMEDIASUBTYPE_WMV3;
    bFixedSizeSamples := True;
    bTemporalCompression := True;
    pUnk := nil;
    vih := PVideoInfoHeader(pbFormat);
    // copy video info header (the same as with the original - copy: rcSource, rcTarget, AvgTimePerFrame, biWidth, biHeight)
    CopyMemory(vih, videoInfo, SizeOf(TVideoInfoHeader));
    // set bit rate at the same value
    vih.dwBitRate := videoBitRate;
    // set new compression ('WMV3')
    vih.bmiHeader.biCompression := MAKEFOURCC('W', 'M', 'V', '3');
  end;
  CheckDSError(mediaProps.SetMediaType(pmt));
  FreeMem(pmt, msize);
  // set media props
  stream.QueryInterface(IID_IWMVideoMediaProps, vmediaProps);
  CheckDSError(vmediaProps.SetQuality(100));
  CheckDSError(vmediaProps.SetMaxKeyFrameSpacing(0));
  // CheckDSError(vmediaProps.SetMaxKeyFrameSpacing(MAX_KEY_FRAME_SPACING));
  // add video stream
  CheckDSError(profile.AddStream(stream));
  // add audio stream (if needed)
  if hasAudio then
  begin
    CheckDSError(profile.CreateNewStream(WMMEDIATYPE_Audio, stream));
    CheckDSError(stream.SetStreamName(StringToOleStr('Audio')));
    audioBitRate := audioInfo.nSamplesPerSec * audioInfo.nChannels * audioInfo.wBitsPerSample;
    CheckDSError(stream.SetBitrate(audioBitRate));
    CheckDSError(stream.SetBufferWindow(BUFFER_WINDOW)); // auto
    // config video media type
    stream.QueryInterface(IID_IWMMediaProps, mediaProps);
    CheckDSError(mediaProps.GetMediaType(nil, msize));
    GetMem(pmt, msize);
    hr := mediaProps.GetMediaType(pmt, msize);
    with pmt^ do
    begin
      // uncompressed audio
      majortype := WMMEDIATYPE_Audio;
      subtype := WMMEDIASUBTYPE_PCM;
      formattype := WMFORMAT_WaveFormatEx;
      cbFormat := sizeof(TWaveFormatEx);
      bFixedSizeSamples := True;
      bTemporalCompression := False;
      lSampleSize := audioInfo.nChannels * audioInfo.wBitsPerSample div 8;
      pUnk := nil;
      wfe := PWaveFormatEx(pbFormat);
      // copy video info header (the same as with the original)
      CopyMemory(wfe, audioInfo, SizeOf(TWaveFormatEx));
    end;
    CheckDSError(mediaProps.SetMediaType(pmt));
    FreeMem(pmt, msize);
    // add video stream
    CheckDSError(profile.AddStream(stream));
  end;

  // create the writer
  Result := AddFilterGUID(CLSID_WMAsfWriter, 'WmvWriter');

  // config the writer
  configWriter := Result as IConfigAsfWriter;
  CheckDSError(configWriter.SetIndexMode(True));
  CheckDSError(configWriter.ConfigureFilterUsingProfile(profile));
end;
  • 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-11T17:20:05+00:00Added an answer on May 11, 2026 at 5:20 pm

    I really don’t have a lot of experience with this, but from what has been posted elsewhere, try setting WMMEDIASUBTYPE_WVC1 instead of WMMEDIASUBTYPE_WVC3. Information was gleaned from here.

    Some other links that might be helpful: here and here

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

Sidebar

Ask A Question

Stats

  • Questions 124k
  • Answers 124k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can use an if statement to check whether the… May 12, 2026 at 1:18 am
  • Editorial Team
    Editorial Team added an answer Based on http://www.zillow.com/howto/api/APIFAQ.htm#devkit, there is no JavaScript API. Because of… May 12, 2026 at 1:18 am
  • Editorial Team
    Editorial Team added an answer You could always use the person's email address in authentication… May 12, 2026 at 1:18 am

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am currently running into a problem where an element is coming back from
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.