[Live-devel] raw h264
Ross Finlayson
finlayson at live555.com
Thu Aug 2 15:54:08 PDT 2012
> I’m in the process of evaluating Live555, and I’m trying to send out a live H264 stream using the Intel’s Media SDK H264 encoder. To ensure I was encoding properly, I made a raw h264 file and made sure I could stream out the file with mediaserver.exe, which with VLC it acted like the frame time was off(played quickly), but using SMPlayer everything worked fine(so I think that particular issue is VLC and not with the encoding).
That's odd, because VLC is usually more reliable than (S)MPlayer. But anyway...
> My second test is to see if I can get Live555 to now stream the output, meaning, instead of writing to a file, send out through RTSP.
I found this confusing, because that ("sending it out through RTSP") is what you were doing before, when you ran the "LIVE555MediaServer".
However, from the rest of your message, I inferred that what you were really talking about was having the server take your H.264 input directly from your encoder, rather than from a file.
So, because you've read the FAQ, I assume that you have written your own subclass of "OnDemandServerMediaSubsession" (that sets the "reuseFirstSource" parameter to True), and have redefined the "createNewStreamSource()" and "createNewRTPSink()" virtual functions.
Your "createNewRTPSink()" implementation can be exactly the same as the one that's in "H264VideoFileServerMediaSubsession.cpp".
Your "createNewStreamSource()" implementation, however, would create a new instance of your "EncoderSource" class, and feed it to a "H264VideoStreamDiscreteFramer" (note, *not* a "H264VideoStreamFramer"). The function would then return a pointer to the 'framer' object.
There are two important things to note:
1/ Each NAL unit delivered by your "EncoderSource" class must be a single, complete NAL unit, *without* a preceding 'start code' (i.e., with *no* preceding 0x00000001)
2/ You need to provide SPS and PPS NAL units. If they occur frequently in the encoder's output, then there is nothing more that you need to do.
If, however, the SPS and PPS NAL units do not occur frequently (or at all) in the encoder's output, then you need to supply them directly. (In this case we assume that the SPS and PPS NAL units are static - i.e., do not change within the stream.) There are two ways you can do this:
1/ In your "createNewStreamSource()" function, call "H264VideoStreamFramer::setSPSandPPS()" on the "H264VideoStreamDiscreteFramer" object (which is a subclass of "H264VideoStreamFramer"), before you return it.
2/ Alternatively, in your "createNewRTPSink()" function, use one of the variants of "H264VideoRTPSink::createNew()" that take SPS/PPS NAL units as parameters.
Finally, when you are streaming directly from your encoder, rather than from a file, you should consider using VLC - rather than MPlayer - as a client. The timing problems that you saw when you streamed from a file will probably not occur when you're streaming from your encoder.
Ross Finlayson
Live Networks, Inc.
http://www.live555.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20120802/fd2ecb82/attachment.html>
More information about the live-devel
mailing list