使用live555渲染RTSP H.264视频流 [英] Render RTSP H.264 video stream using live555

查看:681
本文介绍了使用live555渲染RTSP H.264视频流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将欣赏使用Live555库将实况流呈现到屏幕的示例。显然,它很简单,但它真的有助于看到它完成,而不是只是读到这很简单! gmane 网站声明:



更新(一个副本)testRTSPClient代码,以便渲染视频数据是相当简单:你只需要更改DummySink类,以便执行渲染(或调用解码器库进行渲染)。特别是,你将改变afterGettingFrame()函数的执行 - 在第479行。就是这样!



(实际上,对于H.264视频,您可能还需要做一件事。H.264流具有带外配置信息(SPS和PPS NAL单元),您可以需要给解码器初始化它。要获得这个信息,调用MediaSubsession :: fmtp_spropparametersets()(在视频'subsession'对象),这将给你一个(ASCII)字符串,然后你可以传递到parseSPropParameterSets(),为您的解码器生成二进制NAL单元。)



PS:我使用visual studio和windows

解决方案

我在以前的工作中做了类似的事情。诀窍是使用DirectShow进行渲染。基本上,live555本身不解码或渲染任何东西,你需要一些类型的h264解码器以及视频表面。幸运的是,DirectShow提供了两者,但需要相当多的编程来工作。



live555只提供流的机制,意味着它将需要NAL数据包h264数据包,如果你愿意)从网络或文件源,并推送到DummySink,你仍然需要解码(将NAL单位转换为位图)和渲染(绘制位图到屏幕)。这不是live555会为你做的,但其他库可以,如ffmpeg,但我没有设法让它工作,所以我们转移到DirectShow解决方案。也就是说,MS DTV-DVD解码器非常有用,可以使用我们使用的芯片组(自动)提供的一些硬件加速。 live555的另一个有用的功能是它将处理诸如RTSP的控制协议来处理对流的播放/停止/暂停请求。



编辑:因为您正在搜索代码,我找到了一个开源的使用live555的DirectShow过滤器为你。你应该能够运行类似GraphStudio或GraphEdit的东西。最后,您可以了解如何在c ++中创建DirectShow图形。这真的不是很复杂,因为吨的例子已经存在。最困难的部分是创建过滤器,但解码器和渲染器已经存在,我已经为您提供了源过滤器。


I would appreciate an example of using the Live555 library to render live streams to screen. Apparently it's simple, but it would really help to see it done rather than simply read that "it's simple"!. The gmane site states:

"To update (a copy of) the "testRTSPClient" code so that it renders video data is fairly straightforward: You simply have to change the "DummySink" class, so that it does the rendering (or calls a decoder library to do the rendering). In particular, you would change the implementation of the "afterGettingFrame()" function - at line 479. That's it!

(Actually, for H.264 video, there is one more thing that you'll probably need to do. H.264 streams have out-of-band configuration information (SPS and PPS NAL units) that you may need to feed to the decoder to initialize it. To get this information, call "MediaSubsession::fmtp_spropparametersets()" (on the video 'subsession' object). This will give you a (ASCII) character string. You can then pass this to "parseSPropParameterSets()", to generate binary NAL units for your decoder.) "

PS: I'm using visual studio and windows

解决方案

I did something similar in a previous job. The trick was to use DirectShow for rendering. Basically, live555 does not decode or render anything by itself, you need some kind of h264 decoder as well as a video surface. Fortunately for you, DirectShow provides both, but need quite a lot of programming to get to work.

live555 only provides mechanism for streaming, meaning that it will take NAL packets (h264 packets if you will) from the network or file source and push it to the "DummySink", you still need to decode (transform the NAL units to bitmaps) and render (draw the bitmaps to the screen). This is not something that live555 will do for you, but other libraries can, such as ffmpeg, but I didn't managed to get it to work so we moved to the DirectShow solution. Namely, the "MS DTV-DVD Decoder" was very useful and could use some hardware acceleration provided by the chipset we were using (automagically). Another useful feature of live555 is that it will handle control protocols such as RTSP to handle PLAY/STOP/PAUSE requests for the stream.

EDIT: since you are searching for code, I've found an open sourced DirectShow filter that uses live555 for you. You should be able to run that with something like GraphStudio or GraphEdit. Eventually, you could learn how to create DirectShow graphs in c++. This is really not very complicated as tons of examples already exist. The most difficult parts are to create the filters but the decoder and the renderer are already there for you, and I've provided you with the Source filter .

这篇关于使用live555渲染RTSP H.264视频流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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