转换RAW帧入WEBM现场直播 [英] Converting raw frames into webm live stream

查看:833
本文介绍了转换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 image processing)
  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.

推荐答案

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

The WebM Project offers DirectShow filters for playing and encoding WebM

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

We provide DirectShow filters for playing and working with WebM on Windows. Once the filters are installed on your system, applications that use the DirectShow framework (such as Windows Media Player, and others) will be able to play and encode WebM media

还有一个 FFmpegInterop微软倡议,使用 FFmpeg的多媒体框架。

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

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆