[Live-devel] Streaming H.264 with MPEG2TS via BasicUDPSink

Ross Finlayson finlayson at live555.com
Sat Aug 3 14:40:34 PDT 2013


> I'm trying to use live555 to stream H.264 video which is encoded by x264 and the video source is webcam.
>  
> I’ve tried 
> -          Write my own FramedSource subclass based on DeviceSource
> -          Use my own FramedSource, H264VideoStreamFramer and H264VideoRTPSink to stream by RTP.
> -          Use my own FramedSource, H264VideoStreamFramer, MPEG2TransportStreamFromESSource and BasicUDPSink to MPEG2TS stream by UDP.
> In the RTP case, it works fine.

You should continue to use H.264/RTP streaming whenever possible.  It is more efficient than streaming Transport Stream data (over either RTP or UDP).  Also, streaming over raw UDP (i.e., without RTP framing) is discouraged, because - without RTP - you miss out on several benefits, including support for reordering out-of-order packets, and RTCP statistics.

Nonetheless...

> However, in the UDP case, it got broken image by VLC player often.

One thing that I would check is the size of the (Transport Stream) payload that gets delivered to your "BasicUDPSink".  When streaming Transport Stream data, this *must* be a multiple of the 188-byte Transport 'packet size'.  I suggest setting the (otherwise optional) "maxPayloadSize" parameter to "BasicUDPSInk::createNew()" to 1316 (== 7*188).


> Therefore, I changed my video frame source from H264VideoStreamFramer to H264VideoStreamDiscreteFramer

Note that if your input device delivers discrete H.264 NAL units - i.e., one at a time, then you *must* use a "H264VideoStreamDiscreteFramer".  If your input device delivers a byte stream (containing H.264 NAL units that are separated by 0x00 0x00 0x00 0x01), then you *must* use a "H264VideoStreamFramer" (not a "H264VideoStreamDiscreteFramer").


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/20130803/d1dd5191/attachment-0001.html>


More information about the live-devel mailing list