📜 ⬆️ ⬇️

Streaming Video: Broadcasting with the N810

I wanted to throw my nokiyu high into the sky and see how we look from a bird's-eye view.
How to throw is clear: the easiest option is to take a larger kite.
How to look - the question is a bit puzzled.
What turned out:

Fine.

First try


 [n810] $ gst-launch -v v4l2src!  \
     capsfilter caps = "video / x-raw-yuv, format = (fourcc) UYVY, framerate = (fraction) 8/1, width = (int) 640, height = (int) 480"!  \
     autovideosink

The capsfilter filter sets video capture parameters. They can be changed within reasonable limits, if the video cannot be captured with such parameters, gstreamer writes the nearest valid ones.

Network Transfer


It would be good now to transmit it over the network. The simplest option looks like this (IP desktop 192.168.1.254):
')
 [desktop] $ gst-launch -v tcpserversrc host = 0.0.0.0 protocol = gdp!  autovideosink

 [n810] $ gst-launch -v v4l2src!  \
     capsfilter caps = "video / x-raw-yuv, format = (fourcc) UYVY, framerate = (fraction) 8/1, width = (int) 320, height = (int) 240"!  \
     tcpclientsink host = 192.168.1.254 protocol = gdp

The protocol = gdp parameter adds a stream format to the data transmitted over the network: the fact is that only filters with output and input of a compatible format can be combined into a chain. tcp * src with this parameter on the receiving side has the same output format as tcp * sink on the transmit side of the input.

A simple solution, but through wifi it works hard: 7 megabits, 600 packets per second - a noticeable load. 640x480 is already noticeably slow.

Obviously, the next step is to add compression.


Let it be mpeg4:

 [desktop] $ gst-launch -v tcpserversrc host = 0.0.0.0 protocol = gdp!  decodebin!  autovideosink

 [n810] $ gst-launch -v v4l2src!  \
     capsfilter caps = "video / x-raw-yuv, format = (fourcc) UYVY, framerate = (fraction) 8/1, width = (int) 320, height = (int) 240"!  \
     hantro4200enc!  tcpclientsink host = 192.168.1.254 protocol = gdp

Great, everything is in mpeg-cubes, but 110 kilobits and 30 packets per second (:
What other significant disadvantages of this scheme? TCP / IP: packet loss results in retransmission of an already irrelevant picture, which means delays. A disconnection is treated only by restarting the server and client.

Rtp


So you need to tighten the RTP:

 [desktop] $ gst-launch -v gstrtpbin name = rtpbin \
     udpsrc caps = "application / x-rtp, media = (string) video, clock-rate = (int) 90000, encoding-name = (string) H263" port = 5000!  \
     rtpbin.recv_rtp_sink_0 rtpbin.  !  \
     rtph263depay!  decodebin!  autovideosink

 [n810] $ gst-launch -v gstrtpbin name = rtpbin \
   v4l2src!  \
   capsfilter caps = "video / x-raw-yuv, format = (fourcc) UYVY, framerate = (fraction) 8/1, width = (int) 320, height = (int) 240"!  \
   hantro4200enc stream-type = 5 bit-rate = 512!  rtph263pay!  \
   rtpbin.send_rtp_sink_0 rtpbin.send_rtp_src_0!  \
   udpsink port = 5000 host = 192.168.1.254

What changed?

What effect?


What is left?




Help on gstreamer plugins on the official website: gstreamer.freedesktop.org/documentation
List of installed plugins and help for their parameters - gst-inspect

PS It turned out a kind of laudatory ode gstreamer'u. Frankly pleased instrument (:

Source: https://habr.com/ru/post/66015/


All Articles