在C#中渲染的图像序列进行视频 [英] Rendering a Sequence of Images in C# to make a video

查看:556
本文介绍了在C#中渲染的图像序列进行视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我捕捉和渲染到屏幕上,以创建视频JPG格式的图像序列。

I have a sequence of jpg images that I am capturing and rendering to the screen to create a video.

我从使用JpegBitmapDecoder一个MemoryStream解压缩图像,并在图像控制设置源呈现它。这似乎工作不错,但处理器的开销是相当高的。这些图像是1280×720,30fps的运行,我能勉强跟上我的电脑(双核2.8GHz)上。运行在更高的分辨率使我丢掉帧。我想尝试让CPU使用率下降。

I am decompressing the image from a MemoryStream using a JpegBitmapDecoder and rendering it by setting the Source on an Image control. This seems to work okay, but the processor overhead is pretty high. The images are 1280x720, running at 30fps and I can just barely keep up on my computer ( Dual Core 2.8Ghz). Running at higher resolutions cause me to throw away frames. I would like to try to get the cpu utilization down.

大部分花在花的时间似乎是在解码(解码简单的基准独自在我的机器上放证明我可以解码约40fps的)。有谁知道是否有可用更快的解码器(的DirectX?DirectShow的?什么事情我可以卸载到视频卡?)

Most of the time spent spent seems to be in the decoding (simple benchmarks of the decoding alone on my machine put show that I can decode about 40fps). Does anyone know if there is a faster decoder available (DirectX? DirectShow? Something I can offload to the video card?)

至于渲染,它似乎并不像图像控制是专为这种类型的使用(实际上,我是惊讶它的工作在所有的,我只是想它,因为它是很容易做到)。有另一种方式来呈现,可能会更快的单个帧?

As for the rendering, it doesn't seem like the Image control is designed for this type of use (I was actually surprised it worked at all, i just tried it because it was easy to do). Is there another way to render the individual frames that might be faster?

推荐答案

这听起来像你既解码和调整大小的JPEG与此同时。调整尺寸可能过于昂贵。尝试分离解码和调整(使用最廉价的算法可用)JPEG文件的。使用像的FreeImage 与JPEG_FAST来解压和FILTER_BOX来调整。

It sounds like you are both decoding and resizing the jpeg at the same time. The resizing can be expensive too. Try separating decoding and resizing (using the cheapest algorithm available) the jpegs. Use something like FreeImage with "JPEG_FAST" to decompress and "FILTER_BOX" to resize.

有关显示,TinyPTC是简单,快捷。 (约DirectDraw的包装),这是C,但它是很容易写的包装和编译你可以参考的DLL。

For display, TinyPTC is simple and fast. (a wrapper around DirectDraw) It is C, but it is pretty easy to write a wrapper for and compile to a dll you can reference.

这篇关于在C#中渲染的图像序列进行视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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