简体   繁体   English

如何将RGB图像编码为H264帧(关键帧+一些相关帧)?

[英]How to encode RGB images into H264 frames (Keyframe + some dependent frames)?

So I created images generator (quite simple onewhich generates RGBs) I want to be able to turn some amount of images into H264 KeyFrame+dependent frames (lats say 100) So on each 100 frames generated I need to encode them into H264. 所以我创建了图像生成器(非常简单,生成RGB)我希望能够将一些图像转换为H264 KeyFrame +相关帧(拉特说100)所以在生成的每100帧上我需要将它们编码为H264。 How to do such thing? 怎么办这样的事情?

You have a couple options. 你有几个选择。 Probably the best available encoder is x264, but it doesn't have a C# interface. 可能最好的编码器是x264,但它没有C#接口。 You'd need to define C-style interop calls to use it from a C# program. 您需要定义C风格的互操作调用以从C#程序中使用它。

Another option would be MSFT's expression encoder SDK, which supports H264. 另一种选择是MSFT的表达式编码器SDK,它支持H264。 I'm not sure how much it costs. 我不确定它的价格是多少。 Then there's a few other encoder implementations, such as Mainconcept and Dicas, that may have C# interfaces, but those are going to cost you. 然后还有一些其他编码器实现,例如Mainconcept和Dicas,它们可能有C#接口,但这些将花费你。

One last option is to use DirectShow.NET and this filter to do the encoding with directshow. 最后一个选项是使用DirectShow.NET和此过滤器来使用directshow进行编码。 You should be able to do everything from C#, and it's through COM interop so the interface is a bit cleaner. 你应该可以从C#做所有事情,它通过COM互操作,所以界面更清洁。

Lastly, almost all encoders work in the YUV colorspace, so you'll likely need something to convert your RGB images--x264 and the Monogram filter both work on YV12. 最后,几乎所有编码器都在YUV色彩空间中工作,因此您可能需要一些东西来转换RGB图像 - x264和Monogram滤镜都可以在YV12上工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM