如何在从网络摄像头捕获时指定编码比特率 - MS Expression Encoder 4

时间:2010-10-07 05:52:24

标签: webcam bitrate expression-encoder expression-encoder-sdk

我有一个捕获和保存实时网络摄像头视频的程序。 这取自Expression Encoder 4附带的示例程序。

LiveJob job = new LiveJob();
EncoderDevice video = EncoderDevices.FindDevices(EncoderDeviceType.Video).Count > 0 ? EncoderDevices.FindDevices(EncoderDeviceType.Video)[0] : null;
EncoderDevice audio = EncoderDevices.FindDevices(EncoderDeviceType.Audio).Count > 0 ? EncoderDevices.FindDevices(EncoderDeviceType.Audio)[0] : null;

LiveDeviceSource deviceSource = job.AddDeviceSource(video, audio);
job.ActivateSource(deviceSource);

//When the Start Encoding Button is clicked.
fileOut.OutputFileName = "C:\\output\\Capture\\Video1.wmv";
job.PublishFormats.Add(fileOut);
job.StartEncoding();

//When the Stop Encoding Button is clicked.
job.StartEncoding();

如何指定编码视频的比特率。

1 个答案:

答案 0 :(得分:1)

您需要添加格式

WindowsMediaOutputFormat outputFormat = new WindowsMediaOutputFormat();  
AdvancedVC1VideoProfile profile = new AdvancedVC1VideoProfile();  
profile.Bitrate = 1;  
outputFormat.VideoProfile = profile;  
job.OutputFormat = outputFormat;