如何从视频流中获取图像或帧?

时间:2016-02-29 09:55:00

标签: c# arm win-universal-app

我正在尝试找到一种从流中获取视频帧的方法,以便可以通过网络实时发送帧。视频流来自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不支持库。

0 个答案:

没有答案