简体   繁体   English

原始H264为JPEG,在C#中

[英]Raw H264 to JPEG, in C#

I get a stream of frames, an initial SPS and PPS h264 data packet and then packets for the I and P frames. 我得到一个帧流,一个初始SPS和PPS h264数据包,然后是I帧和P帧的数据包。

Using c# .NET I want to convert into a series of JPEGs? 我想使用c#.NET转换为一系列JPEG吗? Has anyone done this? 有没有人这样做过? I have tried AForge.NET FFMpeg wrapper, but can only go from MP4 file to JPEGs? 我试过AForge.NET FFMpeg包装器,但只能从MP4文件转到JPEGs? Also looked at DirectShow. 还看了看DirectShow。

I can't seem to find an examples that even come close to doing this? 我似乎找不到一个甚至可以做到这一点的例子?

Thanks 谢谢

In Directshow, it sounds like you need to introduce a SampleGrabber filter into your filter graph. 在Directshow中,您需要在过滤器图形中引入SampleGrabber过滤器。 Insert this after the H264 decoder. 将此插入到H264解码器之后。

This is a pass through filter which can receive a callback containing each video frame. 这是一个直通过滤器,可以接收包含每个视频帧的回调。 You can then obviously choose what you do with the frame, is save it to disk as a jpeg etc. 然后,您显然可以选择对框架进行的操作,将其保存为jpeg等格式的磁盘。

Rather than regurgitate MSDN, there is a great page explaining its usage here: 而不是反刍MSDN,有一个很好的页面解释它的用法:

https://msdn.microsoft.com/en-us/library/windows/desktop/dd407288(v=vs.85).aspx https://msdn.microsoft.com/en-us/library/windows/desktop/dd407288(v=vs.85).aspx

Update taking account of Roman's comments: 更新考虑到罗马的评论:

SampleGrabber is deprecated as its part of Directshow Editing Services. SampleGrabber已被弃用为Directshow编辑服务的一部分。 However, it is quite self contained. 但是,它是完全独立的。 If it was removed from a later version of Windows it would be straight forward to replace with an alternative filter. 如果从更高版本的Windows中删除了它,则可以直接替换为其他过滤器。 I still use it in one of my consumer applications. 我仍然在我的一个消费者应用程序中使用它。 Roman is correct though - it has a steep learning curve. 罗马是正确的 - 它有一个陡峭的学习曲线。

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

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