# using with Xavier Error: by jkjung-atv - tegra\_cam.py with Xavier

**URL:** <https://forums.developer.nvidia.com/t/using-with-xavier-error-by-jkjung-atv-tegra-cam-py-with-xavier/66715>\
**Category:** Jetson AGX Xavier\
**Created:** [October 27, 2018, 10:14am UTC](https://forums.developer.nvidia.com/t/using-with-xavier-error-by-jkjung-atv-tegra-cam-py-with-xavier/66715 "2018-10-27T10:14:53Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![ToTheFuture](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@ToTheFuture](https://forums.developer.nvidia.com/u/ToTheFuture)\
**Post date:** [October 27, 2018, 10:14am UTC](https://forums.developer.nvidia.com/t/using-with-xavier-error-by-jkjung-atv-tegra-cam-py-with-xavier/66715/1 "2018-10-27T10:14:53Z")

</div>

Hi all,

I’ve moved and mounted the on-board camera from TX2 DevKit to Xavier DevKit and it works perfectly, for example with jetson-inference demo.

Link: [https://jkjung-avt.github.io/tx2-camera-with-python/](https://jkjung-avt.github.io/tx2-camera-with-python/)

I’m trying to use jkjung-avt tutorials and I’m trying to use his GStreamer tegra\_cam.py but the cam is not working (/dev/video0) with the following error:

```auto
nvidia@JetsonXavier:/media/nvidia/SD32/Installazioni/tegra-cam$ python3 tegra-cam.py 
Called with args:
Namespace(image_height=360, image_width=720, rtsp_latency=200, rtsp_uri=None, use_rtsp=False, use_usb=False, video_dev=0)
OpenCV version: 3.4.3
^C
(python3:18349): GStreamer-CRITICAL **: 12:05:45.920: 
Trying to dispose element capsfilter0, but it is in PAUSED instead of the NULL state.
You need to explicitly set elements to the NULL state before
dropping the final reference, to allow them to clean up.
This problem may also be caused by a refcounting bug in the
application or some element.
...
Trying to dispose element nvvconv0, but it is in PAUSED instead of the NULL state.
...
Trying to dispose element pipeline0, but it is in READY instead of the NULL state.

```

Anybody could help me please? The same tutorial with tegra\_cam.py was well working on the TX2 DevKit, so I do not see why it could not work with Xavier DevKit.  
Both with original JetPack 4.1 OpenCV 3.3.1 and with the new installed OpenCV 3.4.3 the same error is raised with Xavier.

Thanks in advance

---

<div class="post-metadata">

**Author:** ![AastaLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/aastalll/32/14043_2.png) [@AastaLLL](https://forums.developer.nvidia.com/u/AastaLLL)\
**Post date:** [October 29, 2018, 3:22am UTC](https://forums.developer.nvidia.com/t/using-with-xavier-error-by-jkjung-atv-tegra-cam-py-with-xavier/66715/2 "2018-10-29T03:22:34Z")

</div>

Hi,

Have you built OpenCV with GStreamer support?

Please noticed that Xavier is using volta GPU architecture.  
If you use [this script](https://github.com/AastaNV/JEP/blob/master/script/install_opencv3.4.0.sh), please modify the flag into ’ _CUDA\_ARCH\_BIN=“7.2”_ '.

```auto
cmake -D WITH_CUDA=ON -D <b>CUDA_ARCH_BIN="7.2"</b> -D CUDA_ARCH_PTX="" -D WITH_GSTREAMER=ON -D WITH_LIBV4L=ON -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..

```

Thanks.

---

<div class="post-metadata">

**Author:** ![ToTheFuture](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@ToTheFuture](https://forums.developer.nvidia.com/u/ToTheFuture)\
**Post date:** [October 29, 2018, 8:42pm UTC](https://forums.developer.nvidia.com/t/using-with-xavier-error-by-jkjung-atv-tegra-cam-py-with-xavier/66715/3 "2018-10-29T20:42:22Z")

</div>

Thanks a lot for your reply, AastaLLL,

my script:

```auto
sudo cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local \
        -D WITH_CUDA=ON -D CUDA_ARCH_BIN=“7.2” -D CUDA_ARCH_PTX="" \
        -D WITH_CUBLAS=ON -D ENABLE_FAST_MATH=ON -D CUDA_FAST_MATH=ON \
        -D ENABLE_NEON=ON -D WITH_LIBV4L=ON -D BUILD_TESTS=OFF \
        -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF \
        -D WITH_QT=ON -D WITH_OPENGL=ON ..

```

I’ve missed

```auto
-D WITH_GSTREAMER=ON

```

I’ re-try to compile and install my OpenCV 3.4.3.

My best to all

---

<div class="post-metadata">

**Author:** ![ToTheFuture](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@ToTheFuture](https://forums.developer.nvidia.com/u/ToTheFuture)\
**Post date:** [October 30, 2018, 8:31am UTC](https://forums.developer.nvidia.com/t/using-with-xavier-error-by-jkjung-atv-tegra-cam-py-with-xavier/66715/4 "2018-10-30T08:31:17Z")

</div>

Hi!  
even recompiling opncv-3.4.3 and reinstalling it with GSTREAMER=ON I’m am still not able to use on board camera.

I’m still investigating on this issue, on board camera is working only with demo jetson-inference.

I’m able to use USB camera with:

- [https://github.com/jetsonhacks/buildOpenCVTX2/blob/master/Examples/cannyDetection.py](https://github.com/jetsonhacks/buildOpenCVTX2/blob/master/Examples/cannyDetection.py)

and with:

- tegra-cam.py - [https://gist.github.com/jkjung-avt/86b60a7723b97da19f7bfa3cb7d2690e](https://gist.github.com/jkjung-avt/86b60a7723b97da19f7bfa3cb7d2690e)

- tegra-cam-caffe.py - [https://gist.github.com/jkjung-avt/d408aaabebb5b0041c318f4518bd918f](https://gist.github.com/jkjung-avt/d408aaabebb5b0041c318f4518bd918f)

- ssd\_pascal\_webcam.py - [https://jkjung-avt.github.io/ssd/](https://jkjung-avt.github.io/ssd/)

only changing:

```auto
- return cv2.VideoCapture(gst_str, cv2.CAP_GSTREAMER)
+ return cv2.VideoCapture(1)

```

I’m suspecting something wrong with GStream.

Anybody could try to investigate with me on this issue?

Very thanks for sharing Xavier-experiences

---

<div class="post-metadata">

**Author:** ![javax66615](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@javax66615](https://forums.developer.nvidia.com/u/javax66615)\
**Post date:** [October 30, 2018, 3:31pm UTC](https://forums.developer.nvidia.com/t/using-with-xavier-error-by-jkjung-atv-tegra-cam-py-with-xavier/66715/5 "2018-10-30T15:31:18Z")

</div>

Hi, maybe you should try nvarguscamerasrc instead for the onboard cam. I had the same issue after migrating over to Xavier from TX2 but able to fix it.

---

<div class="post-metadata">

**Author:** ![Honey\_Patouceul](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/honey_patouceul/32/389777_2.png) [@Honey\_Patouceul](https://forums.developer.nvidia.com/u/Honey_Patouceul)\
**Post date:** [October 30, 2018, 6:35pm UTC](https://forums.developer.nvidia.com/t/using-with-xavier-error-by-jkjung-atv-tegra-cam-py-with-xavier/66715/6 "2018-10-30T18:35:53Z")

</div>

You may also check that the version used by python is the one you’ve installed.  
You may check cv version in python, and further check its build options:

```auto
import cv2
print(cv2. __version__ )
print(cv2.getBuildInformation())

```

In build info, you would check for gstreamer support (this comes from a R28.2 on TX2, versions may differ):

```auto
<b> Video I/O:</b>
    DC1394: YES (ver 2.2.4)
    FFMPEG: YES
      avcodec: YES (ver 56.60.100)
      avformat: YES (ver 56.40.101)
      avutil: YES (ver 54.31.100)
      swscale: YES (ver 3.1.101)
      avresample: NO
[b] GStreamer:                   
      base: YES (ver 1.8.3)
      video: YES (ver 1.8.3)
      app: YES (ver 1.8.3)
      riff: YES (ver 1.8.3)
      pbutils: YES (ver 1.8.3)
[/b] libv4l/libv4l2: NO
    v4l/v4l2: linux/videodev2.h

```

---

<div class="post-metadata">

**Author:** ![ToTheFuture](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@ToTheFuture](https://forums.developer.nvidia.com/u/ToTheFuture)\
**Post date:** [October 31, 2018, 6:25pm UTC](https://forums.developer.nvidia.com/t/using-with-xavier-error-by-jkjung-atv-tegra-cam-py-with-xavier/66715/7 "2018-10-31T18:25:15Z")

</div>

Here are mine, still GStreamer not working.

OpenCV 3.4.3 as expected:

```auto
>>> print(cv2. __version__ )
3.4.3

```

GStreamer YES as expected:

```auto
Video I/O:
    DC1394: YES (ver 2.2.5)
    FFMPEG: YES
      avcodec: YES (ver 57.107.100)
      avformat: YES (ver 57.83.100)
      avutil: YES (ver 55.78.100)
      swscale: YES (ver 4.8.100)
      avresample: NO
    GStreamer:                   
      base: YES (ver 1.14.1)
      video: YES (ver 1.14.1)
      app: YES (ver 1.14.1)
      riff: YES (ver 1.14.1)
      pbutils: YES (ver 1.14.1)
    libv4l/libv4l2: 1.14.2 / 1.14.2
    v4l/v4l2: linux/videodev2.h

```

---

<div class="post-metadata">

**Author:** ![Honey\_Patouceul](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/honey_patouceul/32/389777_2.png) [@Honey\_Patouceul](https://forums.developer.nvidia.com/u/Honey_Patouceul)\
**Post date:** [November 2, 2018, 6:07pm UTC](https://forums.developer.nvidia.com/t/using-with-xavier-error-by-jkjung-atv-tegra-cam-py-with-xavier/66715/8 "2018-11-02T18:07:06Z")

</div>

Seems ok for gstreamer support in opencv from python.  
Probably @javax66615 'solution will help further.

---

<div class="post-metadata">

**Author:** ![AastaLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/aastalll/32/14043_2.png) [@AastaLLL](https://forums.developer.nvidia.com/u/AastaLLL)\
**Post date:** [November 7, 2018, 6:28am UTC](https://forums.developer.nvidia.com/t/using-with-xavier-error-by-jkjung-atv-tegra-cam-py-with-xavier/66715/9 "2018-11-07T06:28:36Z")

</div>

Hi,

Could you check the sample in this comment?  
[url][https://devtalk.nvidia.com/default/topic/1042892/jetson-agx-xavier/nvarguscamerasrc-opencv-solved-/post/5290833/#5290833[/url]](https://devtalk.nvidia.com/default/topic/1042892/jetson-agx-xavier/nvarguscamerasrc-opencv-solved-/post/5290833/#5290833%5B/url%5D)

Thanks.

---

<div class="post-metadata">

**Author:** ![ToTheFuture](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@ToTheFuture](https://forums.developer.nvidia.com/u/ToTheFuture)\
**Post date:** [November 7, 2018, 9:07am UTC](https://forums.developer.nvidia.com/t/using-with-xavier-error-by-jkjung-atv-tegra-cam-py-with-xavier/66715/10 "2018-11-07T09:07:10Z")

</div>

Hi, thanks, I published the solution I found and tested here

[url][https://devtalk.nvidia.com/default/topic/1043623/jetson-agx-xavier/on-board-cam/[/url]](https://devtalk.nvidia.com/default/topic/1043623/jetson-agx-xavier/on-board-cam/%5B/url%5D)

Best regards

---

<div class="post-metadata">

**Author:** ![TomNVIDIA](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/tomnvidia/32/14181_2.png) [@TomNVIDIA](https://forums.developer.nvidia.com/u/TomNVIDIA)\
**Post date:** [October 18, 2021, 6:25pm UTC](https://forums.developer.nvidia.com/t/using-with-xavier-error-by-jkjung-atv-tegra-cam-py-with-xavier/66715/11 "2021-10-18T18:25:19Z")

</div>


