FFMpeg将RGB图像编码为H264 [英] FFMpeg encoding RGB images to H264

查看:457
本文介绍了FFMpeg将RGB图像编码为H264的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个DirectShow过滤器,它具有2个输入引脚(1个用于音频,1个用于视频)。我使用FFMpeg的libavcodec / libavformat / libavutil将视频编码为H264,使用RTP将音频转换为AAC和mux it / stream。到目前为止,我可以使用libavcodec正确编码视频和音频,但现在我看到FFMpeg似乎也支持RTP复用。不幸的是,我找不到任何示例代码,显示如何执行H264编码和RTP复用。有人知道好样品吗?

解决方案

请尝试检查手刹。具体来说,这个文件是 muxmp4.c ,这是一个jem我发现使用FFMpeg / RTP。请确保正确使用 av_interleaved_write_frame() extradata 字段。这些是我记得RTP的一些关键差异。



尽管如此,我在使用FFMpeg的RTP / RTSP还有一些稳定性问题(我确定它越来越好)。我有更好的运气与 live555 ,你可以看看 VLC MPlayer for关于如何使用它的很好的例子。


I'm developing a DirectShow filter which has 2 input pins (1 for audio, 1 for video). I'm using libavcodec/libavformat/libavutil of FFMpeg for encoding the video to H264, audio to AAC and mux it/stream using RTP. So far I was able to encode video and audio correctly using libavcodec but now I see that FFMpeg seems to support RTP muxing too. Unfortunatelly, I can't find any example code which shows how to perform H264 encoding and RTP muxing. Does anybody know good samples?

解决方案

Try checking out the code in HandBrake. Specifically, this file muxmp4.c, which was a jem I found working with FFMpeg / RTP. Be sure and use av_interleaved_write_frame() and the extradata fields correctly. Those were some key differences I remember for RTP.

Still, I had some stability issues with RTP/RTSP with FFMpeg, (I'm sure it's getting better). I had much better luck with live555, and you can look at the code in VLC and MPlayer for good examples on how to use it.

这篇关于FFMpeg将RGB图像编码为H264的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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