title: Stream webcam with GStreamer (RTSP)
body: <p>I have <a href="https://kodakpixpro.com/cameras/360-vr/sp360-4k" rel="nofollow noreferrer">Kodak PIXPRO SP360 4k camera</a> connected to the Jetson Nano or TX2 via USB cable. </p>
  
  <p>I want to be able to see that video over browser, either with RTSP stream, Webrtc or something else.
  It doesn't matter how it works in terms of technology, as long as it works. So if you have any ideas or suggestions be free to share them. </p>
  
  <p>I'm currently trying to run the basic setup. </p>
  
  <pre><code>./test-launch "nvarguscamerasrc ! video/x-raw(memory:NVMM), format=NV12, width=1920, height=1080, framerate=30/1 ! nvvidconv ! video/x-raw, width=640, height=480, format=NV12, framerate=30/1 ! omxh265enc ! rtph265pay name=pay0 pt=96 config-interval=1"
  </code></pre>
  
  <p>and</p>
  
  <pre><code>gst-launch-1.0 rtspsrc location=rtsp://127.0.0.1:8554/test ! queue ! decodebin ! videoconvert ! xvimagesink
  </code></pre>
  
  <p>and I'm getting the error saying </p>
  
  <pre><code>Setting pipeline to PAUSED ...
  Pipeline is live and does not need PREROLL ...
  Progress: (open) Opening Stream
  Progress: (connect) Connecting to rtsp://127.0.0.1:8554/test
  Progress: (open) Retrieving server options
  Progress: (open) Retrieving media info
  ERROR: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Could not get/set settings from/on resource.
  Additional debug info:
  gstrtspsrc.c(6999): gst_rtspsrc_setup_streams_start (): /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0:
  SDP contains no streams
  ERROR: pipeline doesn't want to preroll.
  Setting pipeline to PAUSED ...
  Setting pipeline to READY ...
  Setting pipeline to NULL ...
  Freeing pipeline ...
  </code></pre>
  
  <pre><code>(test-launch:22440): GLib-GObject-WARNING **: 11:36:46.018: invalid cast from 'GstRtpH265Pay' to 'GstBin'
  
  (test-launch:22440): GStreamer-CRITICAL **: 11:36:46.018: gst_bin_get_by_name: assertion 'GST_IS_BIN (bin)' failed
  
  (test-launch:22440): GLib-GObject-WARNING **: 11:36:46.018: invalid cast from 'GstRtpH265Pay' to 'GstBin'
  
  (test-launch:22440): GStreamer-CRITICAL **: 11:36:46.018: gst_bin_get_by_name: assertion 'GST_IS_BIN (bin)' failed
  
  (test-launch:22440): GLib-GObject-WARNING **: 11:36:46.018: invalid cast from 'GstRtpH265Pay' to 'GstBin'
  
  (test-launch:22440): GStreamer-CRITICAL **: 11:36:46.018: gst_bin_get_by_name: assertion 'GST_IS_BIN (bin)' failed
  </code></pre>
  
  <p>I have also tried an option that worked for me on PC but I can't get it to work on Jetson. The setup goes as follows. </p>
  
  <p>Download Streameye from <a href="https://github.com/ccrisan/streameye" rel="nofollow noreferrer">https://github.com/ccrisan/streameye</a> and run:</p>
  
  <pre><code>netcat -l 8700 | ./streameye -p 1337
  </code></pre>
  
  <p>To send the webcam stream I run:</p>
  
  <pre><code>gst-launch-1.0 v4l2src device=/dev/video0 ! decodebin ! videoconvert ! videoscale ! videorate ! jpegenc quality=30 ! tcpclientsink host=127.0.0.1 port=8700
  </code></pre>
  
  <p>After this I get:</p>
  
  <pre><code>Setting pipeline to PAUSED ...
  Pipeline is live and does not need PREROLL ...
  Setting pipeline to PLAYING ...
  New clock: GstSystemClock
  ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.
  Additional debug info:
  gstbasesrc.c(3064): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
  streaming stopped, reason not-negotiated (-4)
  Execution ended after 0:00:03.944998186
  Setting pipeline to PAUSED ...
  Setting pipeline to READY ...
  Setting pipeline to NULL ...
  Freeing pipeline ...
  </code></pre>
  
  <p>Output of this command for my camera is:</p>
  
  <pre><code>v4l2-ctl -d /dev/video1 --list-formats-ext
  </code></pre>
  
  <pre><code>ioctl: VIDIOC_ENUM_FMT
      Index       : 0
      Type        : Video Capture
      Pixel Format: 'MJPG' (compressed)
      Name        : Motion-JPEG
          Size: Discrete 3840x2160
              Interval: Discrete 0.200s (5.000 fps)
          Size: Discrete 2880x2880
              Interval: Discrete 0.200s (5.000 fps)
          Size: Discrete 2048x2048
              Interval: Discrete 0.200s (5.000 fps)
          Size: Discrete 1440x1440
              Interval: Discrete 0.067s (15.000 fps)
              Interval: Discrete 0.200s (5.000 fps)
          Size: Discrete 1920x1080
              Interval: Discrete 0.067s (15.000 fps)
              Interval: Discrete 0.200s (5.000 fps)
          Size: Discrete 1280x720
              Interval: Discrete 0.033s (30.000 fps)
              Interval: Discrete 0.067s (15.000 fps)
              Interval: Discrete 0.200s (5.000 fps)
          Size: Discrete 640x360
              Interval: Discrete 0.033s (30.000 fps)
              Interval: Discrete 0.067s (15.000 fps)
              Interval: Discrete 0.200s (5.000 fps)
  </code></pre>