FFMpeg将RGB图像编码为H264 [英] FFMpeg encoding RGB images to H264
问题描述
Hello
我开发了一个DirectShow过滤器,它有2个输入引脚(1个音频,1个视频)。我使用libavcodec / libavformat / libavutil的FFMpeg编码视频到H264,音频到AAC和mux it /流使用RTP。到目前为止,我能够使用libavcodec正确编码视频和音频,但现在我看到FFMpeg似乎也支持RTP多路复用。 Unfortunatelly,我找不到任何示例代码,显示如何执行H264编码和RTP多路复用。是否有人知道样品?
Hello 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?
推荐答案
尝试检查 HandBrake 。具体来说,此文件 muxmp4.c ,这是一个jem我发现使用FFMpeg / RTP。请务必正确使用 av_interleaved_write_frame()和元数据字段。这些是我记得对于RTP的一些关键差异。
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.
然而,我有一些稳定性问题与RTP / RTSP与FFMpeg,(我相信它变得更好)。我有更好的运气与 live555 ,你可以看看 VLC 和 MPlayer for好的例子如何使用它。
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屋!