Continuing the discussion:
I followed the Jetson Nano FAQ and I found this Running gstreamer on ubuntu sending video through RTSP is too slow - Stack Overflow. I followed the instructions there and I got an output screen. Then I checked GStreamer device monitors with the command line testing tool:
$ gst-device-monitor-1.0
...
name : Integrated Camera: Integrated C
class : Video/Source
caps : video/x-raw, format=(string)YUY2, width=(int)1280, height=(int)720, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)10/1;
video/x-raw, format=(string)YUY2, width=(int)960, height=(int)540, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)15/1;
video/x-raw, format=(string)YUY2, width=(int)848, height=(int)480, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)20/1;
video/x-raw, format=(string)YUY2, width=(int)640, height=(int)480, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1;
video/x-raw, format=(string)YUY2, width=(int)640, height=(int)360, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1;
video/x-raw, format=(string)YUY2, width=(int)424, height=(int)240, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1;
video/x-raw, format=(string)YUY2, width=(int)352, height=(int)288, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1;
video/x-raw, format=(string)YUY2, width=(int)320, height=(int)240, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1;
video/x-raw, format=(string)YUY2, width=(int)320, height=(int)180, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1;
image/jpeg, width=(int)1280, height=(int)720, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1;
image/jpeg, width=(int)960, height=(int)540, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1;
image/jpeg, width=(int)848, height=(int)480, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1;
image/jpeg, width=(int)640, height=(int)480, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1;
image/jpeg, width=(int)640, height=(int)360, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1;
image/jpeg, width=(int)424, height=(int)240, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1;
image/jpeg, width=(int)352, height=(int)288, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1;
image/jpeg, width=(int)320, height=(int)240, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1;
image/jpeg, width=(int)320, height=(int)180, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1;
properties:
udev-probed = true
device.bus_path = pci-0000:05:00.3-usb-0:3:1.0
sysfs.path = /sys/devices/pci0000:00/0000:00:08.1/0000:05:00.3/usb1/1-3/1-3:1.0/video4linux/video0
device.bus = usb
device.subsystem = video4linux
device.vendor.id = 5986
device.vendor.name = "SunplusIT\\x20Inc"
device.product.id = 212b
device.product.name = "Integrated\ Camera:\ Integrated\ C"
device.serial = SunplusIT_Inc_Integrated_Camera
device.capabilities = :capture:
device.api = v4l2
device.path = /dev/video0
v4l2.device.driver = uvcvideo
v4l2.device.card = "Integrated\ Camera:\ Integrated\ C"
v4l2.device.bus_info = usb-0000:05:00.3-3
v4l2.device.version = 330518 (0x00050b16)
v4l2.device.capabilities = 2225078273 (0x84a00001)
v4l2.device.device_caps = 69206017 (0x04200001)
gst-launch-1.0 v4l2src ! ...
After I did as @DaneLLL said and I added the preferred parameters:
./test-launch '( v4l2src device=/dev/video0 ! video/x-raw, format=(string)YUY2, width=(int)640, height=(int)480, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1 ! videoconvert ! queue ! x264enc speed-preset=ultrafast tune=zerolatency byte-stream=true threads=1 key-int-max=15 intra-refresh=true ! rtph264pay name=pay0 pt=96 )'
which works pretty well when I connect from my phone with VLC, but latency is a little big, video is clear but slow, and encoder returns an error saying:
x264 [error]: baseline profile doesn’t support 4:2:2
Encoder doesn’t support YUY2 what I’m thinking.
When I try to connect with Jetson:
$ gst-launch-1.0 uridecodebin uri=‘rtsp://<IP_HOST>:8554/test’ ! nvoverlaysink
Setting pipeline to PAUSED ...
Opening in BLOCKING MODE
Pipeline is live and does not need PREROLL ...
Progress: (open) Opening Stream
Progress: (connect) Connecting to rtsp://<IP_HOST>:8554/test
Progress: (open) Retrieving server options
Progress: (open) Retrieving media info
Progress: (request) SETUP stream 0
Progress: (open) Opened Stream
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Progress: (request) Sending PLAY request
Progress: (request) Sending PLAY request
Progress: (request) Sent PLAY request
Opening in BLOCKING MODE
NvMMLiteOpen : Block : BlockType = 261
NVMEDIA: Reading vendor.tegra.display-size : status: 6
NvMMLiteBlockCreate : Block : BlockType = 261
NVMEDIA: NVMEDIABufferProcessing: 1507: NvMediaParserParse Unsupported Codec
What should I change to make it supported? And how can I implement that in a simple OpenCV python program?