Cannot record Bitrate-based audio using Windows media encoder
I want to record video from webcam and sound from microphone using Windows Media Encoder. I set a profile to record audio using bitrate-based mode and video using CBR.
this.newProfile = new WMEncProfile2();
this.newProfile.ValidateMode = true;
this.newProfile.ContentType = 17;
this.newProfile.set_VBRMode开发者_开发技巧(WMENC_SOURCE_TYPE.WMENC_AUDIO, 0, WMENC_PROFILE_VBR_MODE.WMENC_PVM_BITRATE_BASED);
this.newProfile.set_VBRMode(WMENC_SOURCE_TYPE.WMENC_VIDEO, 0, WMENC_PROFILE_VBR_MODE.WMENC_PVM_NONE);
newProfile.AddAudience(400000);
IWMEncAudienceObj audience = newProfile.get_Audience(0);
audience.set_VideoCodec(0, 3);
audience.set_VideoBitrate(0, 700000);
audience.set_VideoFPS(0, 25000);
audience.set_VideoKeyFrameDistance(0, 5000);
audience.set_VideoBufferSize(0, 3000);
audience.set_VideoWidth(0,800);
audience.set_VideoHeight(0, 600);
audience.set_AudioCodec(0, 1);
audience.SetAudioConfig(0, 2, 44100, 192000, 16);
this.newProfile.Validate();
However, the video output has no sound. It's just work in CBR mode.
I just konw that Bitrate-based VBR, encoder must start(encoder.Start();) twice. Now, I can record the sound.
精彩评论