压缩的AVI视频帧里面 [英] Compressing frames inside an AVI video

查看:171
本文介绍了压缩的AVI视频帧里面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经建立了一个Windows Phone的类WriteableBitmap的一些转换成AVI全帧(未压缩)。影片真的是巨大的。有一个简单的编解码器执行现有的,像一个编解码器,只是压缩图像,或者一些正在下一个/上一个XOR然后压缩它JPEG?

I've built a Windows Phone class to convert some WriteableBitmap into a AVI Full Frame (Uncompressed). Videos are really huge. Is there a simple codec implementation existing, like a codec that just zip images, or something that is making a next/previous XOR then zip it in jpeg?

Windows手机没有按'T让任何不安全的代码,大多数DLL不能被包装成C#WP库。所以这就是为什么我编码从头开始。请注意,我在从头编码比学习C ++现有的资源(我不是一个C ++编码器)是更有效的,所以我正在寻找的是一个压缩的AVI格式的相关信息,可以无需编写100000线路来实现。我使用的AVI,因为规格是简单的。

Windows Phone doesn't allow any unsafe code and most DLL cannot be wrapped into a C# WP library. So that's why I'm coding something from scratch. Note that I'm more efficient at coding from scratch than in studying C++ existing sources (I'm not a C++ coder), so what I'm searching is infos about a compressed AVI format that can be achieved without writing 100000 lines. I've used AVI because the specs are simple.

我发现一件很有趣的这里在CodeProject上,从2004年的文章。这是一个100%的C#源帧转换成MPEG-1。可悲的是这是I帧,而不是P帧,所以文件比预期的MPEG-1文件平均大小的3倍。

I've found something very interesting here on codeproject, from a 2004 article. It's a 100% C# source to convert frames to mpeg-1. Sadly that's i frame, and not p frame, so files are 3 times larger than an expected mpeg-1 average file size.

要描述更多我的项目,我会做什么是应用在设备拍摄了一些影响。这部电影将被在Youtube或其他一些网站上传。因此,用户期望在电话上所使用的精确的分辨率,至少25帧/秒,体面的质量,以及一个短载时间。所以我不能用MPEG-1的I帧停止。我需要学习有关MPEG-1的预测。

To describe more my project, what I'll do is to apply some effects on a captured movie. This movie will then be uploaded on Youtube or some other websites. Thus, the user expect the exact resolution used on the phone, at least 25 frames/s, a decent quality, and a short upload time. So I can't stop with a Mpeg-1 I-Frames. I'll need to study about prediction in mpeg-1.

推荐答案

我采取这是一个延续/重职的你刚才的问题(但有一些细节)。正如我在文章的评论中提到,有视频编解码器的整个宇宙在那里。对于泛滥的一个原因是,很多人都喜欢重新发明轮子。然而,更突出的原因是,有很多不同的使用情况进行录像。

I take this to be a continuation/re-post of your previous question (but with a few more details). As I mentioned in the comments of that post, there is a whole universe of video codecs out there. One reason for the proliferation is that a lot of people like to re-invent wheels. However, a more salient reason is that there are a lot of different use cases for video.

您似乎是问了很多,但也有很多变数还没有提出:

You seem to be asking for a lot, yet there are a lot of variables you have not presented:


  • 您表达需要一种视频编码器,将一个Windows电话设备上的软件纯粹运行,这是必然一个相当低的供电机;你需要它在实时运行?即,你期望视频帧中几乎立即压缩后的未压缩的帧发送(在几毫秒内)?或者你可以让设备想想压缩了一段时间?

  • 如何大的视频帧?你是WP设备,即计算机生成的数据做屏幕捕获?或者,您在相机读取原始帧,并希望能够压缩那些?

  • 从上一个点之后,什么类型的视频数据?计算机生成的数据看起来与某一类编解码器更好。照片质量的图像(从摄像机)意味着不同的家庭的编解码器。

  • 你瞄准什么比特率?如果您有视频的1秒,什么是应该占用的字节的最大数量(或者你希望)?

  • 谁是视频的最终消费者?在帖子的最后,你表示你想上传到YouTube。如果是这样的话,你很幸运,因为YouTube的 - 由FFmpeg的支持 - 处理宇宙中的几乎每一个编解码器,所以你有很多选择

  • You express a need for a video encoder that will run purely in software on a Windows Phone device, which is necessarily a fairly low-powered machine; do you need it to run in real-time? I.e., do you expect a frame of video to be compressed almost immediately after to send in the uncompressed frame (within a few milliseconds)? Or can you let the device think about the compression for awhile?
  • How large are the video frames? Are you doing screen capture on a WP device, i.e., computer-generated data? Or are you reading raw frames from the camera and hoping to compress those?
  • Following from the previous point, what type of video data? Computer-generated data will look better with a certain class of codecs. Photo-quality images (from camera) implies a different family of codecs.
  • What bitrate are you aiming for? If you have 1 second of video, what's the max amount of bytes it should occupy (or so you hope)?
  • Who is the eventual consumer of the video? In the last post, you indicated you wanted to upload to YouTube. If that's the case, you're in luck, since YouTube -- backed by FFmpeg -- handles nearly every codec in the universe, so you would have a lot of options.

我不知道很多关于Windows Phone的节目。然而,任何WP设备将要在技术上具有硬件视频编码功能。我做了一些谷歌搜索粗略判断如果你在应用程序层面,任何访问,但我无法找到任何证据表明这是可能的(和的这个SO接听状态中,该功能是不存在的)。

I don't know much about Windows Phone programming. However, any WP device is going to technically have hardware video encoding capabilities. I've done some cursory Googling to determine if you get any access to that at the application programming level but I can't find any evidence that it's possible (and this SO answer states that the functionality is not there).

我希望在你身上留下深刻的印象,编写一个视频编码器是一个工作的(看我的用户名;我知道从那里我说话)。一般地,它们需要相当多的CPU马力(和,因此,电池电力,尤其是当在纯软件实现的)的。但是,你已经做出了有关使用标准的zlib的编解码器的一些猜测。事实上,也有基于直zlib的,即MSZH和zlib,统称无损编解码器库。那维基页面有一个基本的比特流描述(披露:我经营该wiki站点)。我相信在WP库包括获得zlib的编码,所以这可能是一个起点,和YouTube应该能消化产生的文件。

I hope to impress upon you that writing a video encoder is a LOT of work (look at my username; I know from whence I speak). Generally, they require quite a lot of CPU horsepower (and, consequently, battery power, especially when implemented in pure software). However, you have already made some guesses about a codec that uses standard zlib. In fact, there are a few video codecs based on straight zlib, namely MSZH and ZLIB, collectively the Lossless Codec Libraries. That wiki page has a basic bitstream description (disclosure: I operate that wiki site). I'm confident the WP libraries include access to zlib encoding, so this might be a starting point, and YouTube should be able to digest the resulting files.

还有结合XOR和zlib作为你猜一个视频编解码器( DOSBox中捕获编解码器)但它可能不适合你的应用程序。

There is also a video codec that combines XOR and zlib as you guessed (Dosbox Capture Codec), but it's probably not appropriate for your application.

执行库提供访问标准JPEG(也就是说,它可以编码JPEG文件)?另一种选择(取决于视频型)将在AVI文件酿静止JPEG图像的连续帧。这被称为动态JPEG或MJPEG。然而,它在比特率大约仅相当于内部MPEG-1,你表示为不足。

Do the libraries provide access to standard JPEG (i.e., can it encode JPEG files)? Another option (depending on the video type) would be successive frames of still JPEG images stuffed in the AVI file. This is known as Motion JPEG or MJPEG. However, it's roughly equivalent in bitrate to intra-only MPEG-1, which you expressed as being inadequate.

我希望我已经给了你一些想法和有用的途径去追求在你的路径的解决方案。

I hope I have given you some ideas and useful avenues to pursue on your path to a solution.

这篇关于压缩的AVI视频帧里面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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