我正在尝试找到一种从流中获取视频帧的方法,以便可以通过网络实时发送帧。视频流来自USB网络摄像头并记录到in-memory random-access stream(strm)。
deviceSettings = new MediaCaptureInitializationSettings();
deviceSettings.StreamingCaptureMode = StreamingCaptureMode.Video;
mediaCapture = new MediaCapture();
await mediaCapture.InitializeAsync(deviceSettings);
MediaEncodingProfile recordProfile = MediaEncodingProfile.CreateMp4(VideoEncodingQuality.Auto);
IRandomAccessStream strm = new InMemoryRandomAccessStream();
await mediaCapture.StartRecordToStreamAsync(recordProfile, strm);
strmSize = (uint)strm.Size;
using (var datareader = new DataReader(strm.GetInputStreamAt(strmSize)))
{
//Here I want to get the byte length that would represent the image to be read
//but we don't know how many bytes the image is comprised of.
strmSize = (uint)strm.Size;
await datareader.LoadAsync(strmSize);
byte[] frameByte = new byte[strmSize];
datareader.ReadBytes(frameByte);
}
我尝试使用 AForge.Video.dll 和 AForge.Video.DirectShow在Windows 10应用中使用 AForge 和 Directshow 。 dll 但根据我测试它和wikipedia reference不支持库。