Streaming h264 with tcpserversink and tcpclientsrc

Tim Müller tim at centricular.com
Thu Jun 2 21:40:27 UTC 2016


On Thu, 2016-06-02 at 21:22 +0100, Monyz Wacon wrote:

Hi,

> I'm trying to stream h264 using tcrpserversink and tcpclientsrc.
> 
> Using this example I'm able to see a test stream:
> 
> gst-launch-1.0 videotestsrc ! x264enc ! video/x-
> h264,format=bytestream ! typefind ! h264parse ! avdec_h264 !
> autovideosink

I think this should be: video/x-h264,stream-format=byte-stream


> However these commands don't work as expected:
> 
> gst-launch-1.0 videotestsrc ! x264enc ! tcpserversink port=7001

Pass -v to gst-launch-1.0 to see what video/x-h264 stream-format
x264enc negotiates to here. It might depend on your GStreamer version.
In newer versions it will hopefully use byte-stream (which is fine
here), but in older versions it might end up outputting avc which won't
work over tcp.

You can force it to output byte-stream format with


 ... ! x264enc ! video/x-h264,stream-format=byte-stream ! tcpserversink


> gst-launch-1.0 tcpclientsrc port=7001 ! video/x-
> h264,format=bytestream ! typefind ! h264parse ! avdec_h264 !
> autovideosink

See above, but also: just tcpclientsrc ... ! typefind should be enough,
there's no need to tell typefind what the format is, it should figure
it out itself. Again, pass -v to gst-launch-1.0 to see what's
happening. typefind should detect h264 byte-stream format.


One problem with this is that there won't be proper timestamping like
this, but at least you should see an initial image. Putting the stream
in a container such as matroska or mpeg-ts might be a good idea.

Cheers
 -Tim

-- 
Tim Müller, Centricular Ltd - http://www.centricular.com


More information about the gstreamer-devel mailing list