本文介绍了转换RAW帧入WEBM现场直播的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下设置的ASP.NET应用程序:

I have an ASP.NET application with the following set up:


  1. 捕获原始RGB照相机帧,分辨率为656x492

  2. 这些帧在我的C#code(处理一些简单的图像
    处理)

  3. 的原始图像存储在一个字节阵列(以及包裹在一个位图容器)

  4. MISSING MAGIC:转换RAW图像缓冲区的WebM流

  5. 在另一端我有一个函数的Htt presponseMessage 函数,钩了一个一个的WebM流 PushStreamContent 功能(此)。这个函数把一个视频文件的数据块的网站。

  6. 可以播放视频网站。

  1. A camera that captures raw RGB frames at a resolution 656x492
  2. These frames are processed in my C# code (with some simple imageprocessing)
  3. The raw image is stored in a byte array (as well as wrapped in a Bitmap container)
  4. MISSING MAGIC: Convert raw image buffer to WebM stream
  5. On the other end I have a function HttpResponseMessage function that hooks up a WebM stream with a PushStreamContent function (inspired by this blog post). This function pushes chunks of a video file to the website.
  6. A Website that plays back the video.

我在努力弄清楚如何实施 4点。现在我只能流视频文件。不过,我想带code我的原始缓冲区成WebM的容器和流,为我的网站。的 point5 code的中心部分如下所示:

I am struggling to figure out how to implement point 4. Right now I can only stream video files. But I would like to encode my raw buffer into a WebM container and stream that to my website. The central piece of code of point5 looks as follows:

while (length > 0 && bytesRead > 0)
{
    bytesRead = video.Read(buffer, 0, Math.Min(length, buffer.Length));
    await outputStream.WriteAsync(buffer, 0, bytesRead);
    length -= bytesRead;
}

基本上我想通过某种方式编码我生帧插入一个动态格式的WebM并将其存储在来替换 video.Read 功能缓冲,这样他们就可以推到网站作为一个实时流。有没有一种简单的方法来做到这一点?这是很好,如果某些帧会被丢弃。

Basically I would like to replace the video.Read function by somehow encoding my raw frames into a WebM format on the fly and storing them in buffer, so they can be pushed to the website as a live stream. Is there a straight forward way to do this? It's fine if some frames get dropped.

如果有一个完全不同的方法,是更好的话,我当然也是开放的建议。

If there is an entirely different approach that is better then I am of course also open for suggestions.

推荐答案

借助提供的DirectShow播放和编码器的WebM

The WebM Project offers DirectShow filters for playing and encoding WebM

我们玩,并与WebM的Windows系统,提供DirectShow过滤器。一旦过滤器系统,使用DirectShow的框架(如Windows Media Player和其他)应用程序安装就能玩和连接code的WebM媒体

还有一个倡议,使用多媒体框架。

There is also a FFmpegInterop Microsoft initiative which uses the FFmpeg multimedia framework.

这篇关于转换RAW帧入WEBM现场直播的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-09 17:43