# gstreamer uyvy camera stream not working on voxl2

Source: https://forum.modalai.com/topic/4001/gstreamer-uyvy-camera-stream-not-working-on-voxl2
Category: VOXL SDK and Software (https://forum.modalai.com/category/47/voxl-sdk-and-software)
Posted: 2024-12-05 00:45:17 UTC by Samuel Lehman
Replies: 4 · Views: 3647

## Samuel Lehman · 2024-12-05 00:45:17 UTC

Hello, I have been trying to use gstreamer to stream video from a usb camera that outputs uyvy but I have been unsuccessful. I am connected to the same network as the voxl2 and I am interacting with it through ssh. Running the following command 
```
gst-launch-1.0 v4l2src device=/dev/video2 ! video/x-raw,format=UYVY ! videoconvert ! x264enc ! rtph264pay name=pay0 ! udpsink host=192.168.0.149 port=8554

```
on the voxl2 and 
```
gst-launch-1.0  udpsrc port=8554 caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96" ! rtph264depay ! decodebin ! videoconvert  ! autovideosink
```
on my host machine results in the gstreamer on the voxl2 doing nothing and then eventually crashing.
```
$ gst-launch-1.0 v4l2src device=/dev/video2 ! video/x-raw,format=UYVY ! videoconvert ! x264enc ! rtph264pay name=pay0 ! udpsink host=192.168.0.149 port=8554
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Redistribute latency...
# it waits here for some time
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Could not read from resource.
Additional debug info:
gstv4l2bufferpool.c(1040): gst_v4l2_buffer_pool_poll (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
poll error 1: Invalid argument (22)
Execution ended after 0:08:31.639262049
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
```
However when I run the same commands on my host machine it works. Does anyone know of a way to get this working?

## Reply by cegeyer · 2024-12-05 18:32:59 UTC

Try to run this command on the VOXL-2 and see if it outputs anything when streaming from the host to make sure you actually are getting data into the VOXL:
```
gst-launch-1.0 udpsrc port=8554 num-buffers=1 ! fakesink dump=true
```
I also have issues with `decodebin` receiving an h264 stream as it uses `qtivdec` to decode the h264 and outputs `video/x-raw(memory:GBM)` which I have issues working with. You can try this pipeline to use a different decoder:
```
gst-launch-1.0  udpsrc port=8554 caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96" ! rtph264depay ! h264parse ! omxh264dec ! videoconvert ! autovideosink sync=false
```

## Reply by Samuel Lehman · 2024-12-05 20:15:19 UTC (in reply to cegeyer)

@cegeyer when streaming from the host to the voxl using the command you suggested I get 
```
voxl2:~$ gst-launch-1.0 udpsrc port=8554 num-buffers=1 ! fakesink dump=true
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
00000000 (0x7fa0004e80): 80 60 6f 28 47 41 41 80 bc 30 17 35 09 30        .`o(GAA..0.5.0  
Got EOS from element "pipeline0".
Execution ended after 0:00:00.034007066
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
```
I assume this means I am able to get data into the voxl. When running the second command I get this 
```
voxl2:~$ gst-launch-1.0  udpsrc port=8554 caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96" ! rtph264depay ! h264parse ! omxh264dec ! videoconvert ! autovideosink sync=false
Setting pipeline to PAUSED ...
gbm_create_device(156): Info: backend name is: msm_drm
Pipeline is live and does not need PREROLL ...
WARNING: from element /GstPipeline:pipeline0/GstAutoVideoSink:autovideosink0: Could not initialise Xv output
Additional debug info:
xvimagesink.c(1773): gst_xv_image_sink_open (): /GstXvImageSink:autovideosink0-actual-sink-xvimage:
Could not open display (null)
Setting pipeline to PLAYING ...
New clock: GstSystemClock
gbm_create_device(156): Info: backend name is: msm_drm
gbm_create_device(156): Info: backend name is: msm_drm
gbm_create_device(156): Info: backend name is: msm_drm
gbm_create_device(156): Info: backend name is: msm_drm
gbm_create_device(156): Info: backend name is: msm_drm
gbm_create_device(156): Info: backend name is: msm_drm
gbm_create_device(156): Info: backend name is: msm_drm
gbm_create_device(156): Info: backend name is: msm_drm
gbm_create_device(156): Info: backend name is: msm_drm
gbm_create_device(156): Info: backend name is: msm_drm
gbm_create_device(156): Info: backend name is: msm_drm
gbm_create_device(156): Info: backend name is: msm_drm
gbm_create_device(156): Info: backend name is: msm_drm
gbm_create_device(156): Info: backend name is: msm_drm
gbm_create_device(156): Info: backend name is: msm_drm
gbm_create_device(156): Info: backend name is: msm_drm
gbm_create_device(156): Info: backend name is: msm_drm
gbm_create_device(156): Info: backend name is: msm_drm
gbm_create_device(156): Info: backend name is: msm_drm
gbm_create_device(156): Info: backend name is: msm_drm
gbm_create_device(156): Info: backend name is: msm_drm
gbm_create_device(156): Info: backend name is: msm_drm
gbm_create_device(156): Info: backend name is: msm_drm
gbm_create_device(156): Info: backend name is: msm_drm
ERROR: from element /GstPipeline:pipeline0/GstOMXH264Dec-omxh264dec:omxh264dec-omxh264dec0: GStreamer encountered a general supporting library error.
Additional debug info:
../../gst-omx-1.14.4/omx/gstomxvideodec.c(1819): gst_omx_video_dec_loop (): /GstPipeline:pipeline0/GstOMXH264Dec-omxh264dec:omxh264dec-omxh264dec0:
OpenMAX component in error state Hardware (0x80001009)
Execution ended after 0:00:07.897981343
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

```

## Reply by cegeyer · 2024-12-06 18:19:38 UTC

How are you logged into the VOXL to get the window? I was able to get it by running `ssh -X root@<VOXL IP>` from a Linxu host were I was logged in with a display.  I don't have any peripheral to get a display directly from the VOXL.

You can test my method by connecting to the VOXL via `ssh -X` then running this `gst-launch-1.0 videotestsrc ! autovideosink`. You should see a window pop up with a test pattern.

Hopefully that fixes the issue, if not, you can try to switch `omxh264dec` with `avdec_h264` but it will then use CPU instead of GPU

## Reply by Alex Kushleyev (ModalAI staff) · 2024-12-06 18:56:31 UTC (in reply to cegeyer)

@cegeyer 

Here is a command to stream video from VOXL2 camera via ssh X forwading. FPS may be limited due to bandwidth (perhaps this is the command you meant in your reference above).

```
ssh -X root@<voxl-ip>
gst-launch-1.0 qtiqmmfsrc camera=0 ! "video/x-raw, width=1280,height=720,framerate=30/1" ! autovideoconvert ! autovideosink
```

This should pop up a window with the stream from the camera. Make sure `voxl-camera-server` is not running if you are testing one of the mipi cameras connected to voxl2.

Alex
