如何在Silverlight中压缩捕获的视频? [英] How do you compress captured video in Silverlight?

查看:146
本文介绍了如何在Silverlight中压缩捕获的视频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Silverlight v4中的一个大交易是音频/视频捕获...但我还没有找到一个例子,但我做了我想做的。所以:

One of the big deals in Silverlight v4 is audio/video capture... but I haven't found an example yet that does what I want to do. So:

如何使用Silverlight(从网络摄像头)捕获音频/视频,然后将其另存为压缩格式(WMV或MP4)?这里的想法是压缩后上传。

How do you capture audio/video with Silverlight (from a webcam), and then save it as a compressed format (WMV or MP4)? The idea here is to upload it after compression.

已经查看过这个博客文章的捕获片段,但需要找到一种方式来压缩音频/视频上传。 p>

Have already looked at this blog post for the capture piece, but need to find a way to compress audio/video for upload.

推荐答案

Silverlight不支持视频编码,更有可能这将不会被Microsoft实现。为了通过网络传输视频,一些人通过将各个帧压缩为常规JPEG图像来使用伪MJPEG编解码器。有些人甚至通过将帧划分为固定块(比如说8x8),只传输改变的块(有损比较)来改进这个想法。

Silverlight does not support video encoding and more likely this won't be implemented at least by Microsoft. To transmit video over network, some people use "pseudo-MJPEG" codec by compressing individual frames as regular JPEG images. Some people even improved that idea by dividing frames into fixed block (say 8x8), and only transmits changed blocks (with lossy comparison).

如果你是一个资深程序员并且享受编码,这里是psuedo-MJPEG想法的另一个略微改进的版本:

If you're a veteran programmer and enjoy coding, here is another slightly improved version of "psuedo-MJPEG" idea:


  1. 将当前帧分割为固定的8x8块

  2. 为每个块应用RGB - > YCbCr颜色空间转换

  3. 将样例Cb和Cr平面缩小一半

  4. DCT到YCbCr

  5. 使用量化矩阵量化DCT系数

  6. 将此DCT系数与前一帧的块进行比较。

  7. 使用比特式范围编码器并对未更改的块进行标记编码

  8. >对于更改的块,通过对它们建模(您可以使用JPEG的标准之字形模式和零运行模型)并使用范围编码器对它们进行编码来传输DCT系数。

  1. Divide current frame into fixed 8x8 block
  2. Apply RGB -> YCbCr color space conversion for each block
  3. Down sample Cb and Cr plane by half
  4. Apply DCT to YCbCr
  5. Quantize DCT coefficients with a quantization matrix
  6. Compare this DCT coefficients with previous frame's block. This way you make "perceptually lossy" comparison for each consecutive frames.
  7. Use a bit-wise range-coder and encode a flag for unchanged blocks
  8. For changed blocks, transmit DCT coefficient by modeling them (you can use JPEG's standard zig-zag pattern and zero-run model) and encode them with range coder.

这或多或少是一个标准的JPEG算法。但是,相对于标准JPEG的实际优势是:

This is more or less a standard JPEG algorithm actually. But, actual advantages over standard JPEG are:


  1. 感知上有损块比较

  2. (范围编码器)

另一种选择是支付第三方软件(对不起,我不'知道任何免费软件)。我发现产品。我没有使用它。但是,我相信这对你很有用。

Another option could be pay for 3rd party software (sorry, I don't know any free software). I find that product. I didn't used it at all. But, I believe it could be useful for you.

这篇关于如何在Silverlight中压缩捕获的视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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