Streaming h264 with tcpserversink and tcpclientsrc

Peter Maersk-Moller pmaersk at gmail.com
Thu Jun 2 20:57:41 UTC 2016


Hi Monyz.

In general you need to set the 'is-live' parameter to 'true' for
videotestsrc. Otherwise your pipeline will generate as many frames per
second as your hardware supports and that is probably not what you want.
The reason your first example with autovideosink is that the videosink will
limit how many frames per second you can display and that will ripple back
from the videosink to the videotestsrc. Lack of CPU capacity might also
slow down the number of frames.

Now to streaming using tcpserversink. You can in general not stream a raw
encoded video stream. You need to place the raw stream into a media
container. A media container could be RTP, TS, AVI, MP4, Matroska and many
more.

Something similar to this will work

  gst-launch-1.0 -v videotestsrc is-live=true !
video/x-raw,width=640,width=480,framerate=30/1 ! queue ! videoconvert !
x264enc tune=zero-latency ! h264parse ! queue ! matroskamux ! queue leaky=2
! tcpserversink port=7001 host=0.0.0.0 recover-policy=keyframe
sync-method=latest-keyframe

Technically you can eliminate the video caps, if you only want the default
values. You can also eliminate one of the queues, but I placed it there for
a reason. You can also eliminate videoconvert, but like the extra queue, I
placed it there for a reason. The leaky queue is actually also
intentionally. In most cases you won't need it, but in some cases with an
extended pipeline, you need it to avoid everything locking up in case your
client is slow at picking up data. Complicated. Just add it.

The client is simple.

  gst-launch -v tcpclientsrc host=a.b.c.d port=7001 ! decodebin !
autovideosink

On Thu, Jun 2, 2016 at 10:22 PM, Monyz Wacon <monyz.ww at gmail.com> wrote:

> Hello,
> 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
>
> However these commands don't work as expected:
>
> gst-launch-1.0 videotestsrc ! x264enc ! tcpserversink port=7001
>
> gst-launch-1.0 tcpclientsrc port=7001 ! video/x-h264,format=bytestream !
> typefind ! h264parse ! avdec_h264 ! autovideosink
>
> No video is shown. The client stops at Prerolling and when I close the
> server, there is a message on the client's side:
>
> ERROR: from element /GstPipeline:pipeline0/GstH264Parse:h264parse0: No
> valid frames found before end of stream
>
> How to make this tcpserversink example work?
>
> Best regards
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20160602/3043f0dc/attachment-0001.html>


More information about the gstreamer-devel mailing list