Problems with "... ! nvvidconv ! video/x-raw, format=P010_10LE ! ..."

My setup:
Jetson Xavier 16Gb
cat /etc/nv_tegra_release → R32 (release), REVISION: 6.1, GCID: 27863751, BOARD: t186ref, EABI: aarch64, DATE: Mon Jul 26 19:36:31 UTC 2021
Running in a nvcr.io/nvidia/l4t-cuda:10.2.460-runtime container.

I am struggling to save 10-bit (P010_10LE) video data.

When I run the following:
gst-launch-1.0 videotestsrc num-buffers=1 ! video/x-raw, format=P010_10LE ! nvvidconv ! “video/x-raw(memory:NVMM)” ! nvvidconv ! video/x-raw, format=P010_10LE ! filesink location=output.raw

I get the error:
WARNING: erroneous pipeline: could not link nvvconv1 to filesink0, nvvconv1 can’t handle caps video/x-raw, format=(string)P010_10LE

This is weird as gst-inspect-1.0 nvvidconv states that video/x-raw, format=P010_10LE is a valid sink.

If I instead run
gst-launch-1.0 videotestsrc num-buffers=1 ! video/x-raw, format=P010_10LE ! nvvidconv ! “video/x-raw(memory:NVMM)” ! nvvidconv ! video/x-raw ! filesink location=output.raw

The output is converted to NV12, which is not desired.

Any help is appreciated!

Not fully understand why you convert the format to NVMM and then convert back, as there is no NV hardare accelerator, this convert is not needed.
I think you can simply output the file to filesink, pipeline as below, can it work for your case?
gst-launch-1.0 videotestsrc num-buffers=1 ! video/x-raw, format=P010_10LE ! filesink location=output.raw

Sorry for my bad explanation. This was just a test example to illustrate the problem. The actual pipeline is decompressing a 10-bit h265 stream using the nvv4l2decoder and I struggle to save the output data.

You can inspect the nvvidconv on Xavier and find the src of “video/x-raw” doesn’t support P010_10LE, thus your first pipeline is not working. You may use add videoconvert behind nvvidconv for such convertion:
gst-launch-1.0 videotestsrc num-buffers=1 ! video/x-raw, format=P010_10LE ! nvvidconv ! "video/x-raw(memory:NVMM)" ! nvvidconv ! videoconvert! video/x-raw, format=P010_10LE ! filesink location=output. Raw

btw, which tool can inspect the raw file to output format infomation?

Thanks for the rapid feedback!

The method you suggest runs, but the output is not consistent with the output from:

gst-launch-1.0 videotestsrc num-buffers=1 ! video/x-raw, format=P010_10LE ! filesink location=output.raw

Inspecting the pads during operation, I can see that the data is transformed to video/x-raw format=I420 as an intermediate step, thus removing 2 bits of information.

Do you have a solution for this?

Answer to your question: I have constructed the same pipeline in Python using the PyGobject library so that I can inspect the pads using gst probes.

My output from gst-inspect-1.0 nvvidconv is:

  Factory Details:
  Rank                     primary (256)
  Long-name                NvVidConv Plugin
  Klass                    Filter/Converter/Video/Scaler
  Description              Converts video from one colorspace to another & Resizes
  Author                   amit pandya <apandya@nvidia.com>

Plugin Details:
  Name                     nvvidconv
  Description              video Colorspace conversion & scaler
  Filename                 /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvvidconv.so
  Version                  1.2.3
  License                  Proprietary
  Source module            gstreamer-nvvconv-plugin
  Binary package           GStreamer nvvconv Plugin
  Origin URL               http://nvidia.com/

GObject
 +----GInitiallyUnowned
       +----GstObject
             +----GstElement
                   +----GstBaseTransform
                         +----Gstnvvconv

Pad Templates:
  SRC template: 'src'
    Availability: Always
    Capabilities:
      video/x-raw(memory:NVMM)
                 format: { (string)I420, (string)I420_10LE, (string)P010_10LE, (string)UYVY, (string)YUY2, (string)YVYU, (string)NV12, (string)NV16, (string)NV24, (string)GRAY8, (string)BGRx, (string)RGBA, (string)Y42B }
                  width: [ 1, 2147483647 ]
                 height: [ 1, 2147483647 ]
              framerate: [ 0/1, 2147483647/1 ]
      video/x-raw
                 format: { (string)I420, (string)UYVY, (string)YUY2, (string)YVYU, (string)NV12, (string)NV16, (string)NV24, (string)GRAY8, (string)BGRx, (string)RGBA, (string)Y42B }
                  width: [ 1, 2147483647 ]
                 height: [ 1, 2147483647 ]
              framerate: [ 0/1, 2147483647/1 ]
  
  SINK template: 'sink'
    Availability: Always
    Capabilities:
      video/x-raw(memory:NVMM)
                 format: { (string)I420, (string)I420_10LE, (string)P010_10LE, (string)I420_12LE, (string)UYVY, (string)YUY2, (string)YVYU, (string)NV12, (string)NV16, (string)NV24, (string)GRAY8, (string)BGRx, (string)RGBA, (string)Y42B }
                  width: [ 1, 2147483647 ]
                 height: [ 1, 2147483647 ]
              framerate: [ 0/1, 2147483647/1 ]
      video/x-raw
                 format: { (string)I420, (string)UYVY, (string)YUY2, (string)YVYU, (string)NV12, (string)NV16, (string)NV24, (string)P010_10LE, (string)GRAY8, (string)BGRx, (string)RGBA, (string)Y42B }
                  width: [ 1, 2147483647 ]
                 height: [ 1, 2147483647 ]
              framerate: [ 0/1, 2147483647/1 ]

Element has no clocking capabilities.
Element has no URI handling capabilities.

Pads:
  SINK: 'sink'
    Pad Template: 'sink'
  SRC: 'src'
    Pad Template: 'src'

Element Properties:
  name                : The name of the object
                        flags: readable, writable
                        String. Default: "nvvconv0"
  parent              : The parent of the object
                        flags: readable, writable
                        Object of type "GstObject"
  qos                 : Handle Quality-of-Service events
                        flags: readable, writable
                        Boolean. Default: false
  silent              : Produce verbose output ?
                        flags: readable, writable
                        Boolean. Default: false
  flip-method         : video flip methods
                        flags: readable, writable, controllable
                        Enum "GstNvVideoFlipMethod" Default: 0, "none"
                           (0): none             - Identity (no rotation)
                           (1): counterclockwise - Rotate counter-clockwise 90 degrees
                           (2): rotate-180       - Rotate 180 degrees
                           (3): clockwise        - Rotate clockwise 90 degrees
                           (4): horizontal-flip  - Flip horizontally
                           (5): upper-right-diagonal - Flip across upper right/lower left diagonal
                           (6): vertical-flip    - Flip vertically
                           (7): upper-left-diagonal - Flip across upper left/lower right diagonal
  output-buffers      : number of output buffers
                        flags: readable, writable, changeable in NULL, READY, PAUSED or PLAYING state
                        Unsigned Integer. Range: 1 - 4294967295 Default: 4 
  interpolation-method: Set interpolation methods
                        flags: readable, writable, controllable
                        Enum "GstInterpolationMethod" Default: 0, "Nearest"
                           (0): Nearest          - Nearest
                           (1): Bilinear         - Bilinear
                           (2): 5-Tap            - 5-Tap
                           (3): 10-Tap           - 10-Tap
                           (4): Smart            - Smart
                           (5): Nicest           - Nicest
  left                : Pixels to crop at left
                        flags: readable, writable
                        Integer. Range: 0 - 2147483647 Default: 0 
  right               : Pixels to crop at right
                        flags: readable, writable
                        Integer. Range: 0 - 2147483647 Default: 0 
  top                 : Pixels to crop at top
                        flags: readable, writable
                        Integer. Range: 0 - 2147483647 Default: 0 
  bottom              : Pixels to crop at bottom
                        flags: readable, writable
                        Integer. Range: 0 - 2147483647 Default: 0 
  bl-output           : Blocklinear output, applicable only for memory:NVMM NV12 format output buffer
                        flags: readable, writable
                        Boolean. Default: true

Which suggests that video/x-raw, format=P010_10LE should be available, but I might interpret it wrong?

So you mean pipeline gst-launch-1.0 videotestsrc num-buffers=1 ! video/x-raw, format=P010_10LE ! filesink location=output.raw works with the correct format, but pipeline
gst-launch-1.0 videotestsrc num-buffers=1 ! video/x-raw, format=P010_10LE ! nvvidconv ! "video/x-raw(memory:NVMM)" ! nvvidconv ! videoconvert! video/x-raw, format=P010_10LE ! filesink location=output.raw
uses format I420 instead of the identified “P010_10LE”? It may be caused by auto negotiation of the plugins, may be you also need add format=P010_10LE in the middle nvvidconv & videoconvert.

format=P010_10LE is supported in “video/x-raw(memory:NVMM)”, not “video/x-raw”. When you are putting stream a filesink, it uses format “video/x-raw”, this is the reason why the first pipeline does not work.

Both commands output the correct format, but the second one has an intermediate step where it is converted to the 8-bit I420 format:
video/x-raw(NVMM), format=P010_10LE → video/x-raw, format=I420 → video/x-raw, format=P010_10LE

Is there any other way to convert video/x-raw(NVMM) to video/x-raw or save video/x-raw(NVMM) to a file?

The P010_10LE format is listed under both video/x-raw(NVMM) and video/x-raw in the output above (quite far to the right under video/x-raw). Does that not mean that it’s available for both memory types? If that is not the case, I guess the inspection output is wrong.

As src of nvvidconv, video/x-raw doesn’t support format P010_10LE, meaning it cannot output in format P010_10LE. video/x-raw(NVMM) is DMA memory for hardware accelerator, cannot be used by CPU directly, thus converting to “video/x-raw” is needed.

Have you installed DeepStream on your Xavier? Just checked nvvideoconvert and found it supports P010_10LE in src.

Plugin Details:
  Name                     nvvideoconvert
  Description              video Colorspace conversion & scaler
  Filename                 /usr/lib/aarch64-linux-gnu/gstreamer-1.0/deepstream/libgstnvvideoconvert.so
  Version                  1.2.3
  License                  Proprietary
  Source module            nvvideoconvert
  Binary package           GStreamer nvvideoconvert Plugin
  Origin URL               http://nvidia.com/

GObject
 +----GInitiallyUnowned
       +----GstObject
             +----GstElement
                   +----GstBaseTransform
                         +----Gstnvvideoconvert

Pad Templates:
  SINK template: 'sink'
    Availability: Always
    Capabilities:
      video/x-raw(memory:NVMM)
                 format: { (string)I420, (string)NV12, (string)P010_10LE, (string)BGRx, (string)RGBA, (string)GRAY8, (string)YUY2, (string)UYVY, (string)YVYU, (string)Y42B, (string)RGB, (string)BGR, (string)UYVP }
                  width: [ 1, 2147483647 ]
                 height: [ 1, 2147483647 ]
              framerate: [ 0/1, 2147483647/1 ]
      video/x-raw
                 format: { (string)I420, (string)P010_10LE, (string)NV12, (string)BGRx, (string)RGBA, (string)GRAY8, (string)YUY2, (string)UYVY, (string)YVYU, (string)Y42B, (string)RGB, (string)BGR, (string)UYVP }
                  width: [ 1, 2147483647 ]
                 height: [ 1, 2147483647 ]
              framerate: [ 0/1, 2147483647/1 ]

  SRC template: 'src'
    Availability: Always
    Capabilities:
      video/x-raw(memory:NVMM)
                 format: { (string)I420, (string)NV12, (string)P010_10LE, (string)BGRx, (string)RGBA, (string)GRAY8, (string)YUY2, (string)UYVY, (string)YVYU, (string)Y42B, (string)BGR, (string)RGB, (string)UYVP }
                  width: [ 1, 2147483647 ]
                 height: [ 1, 2147483647 ]
              framerate: [ 0/1, 2147483647/1 ]
      video/x-raw
                 format: { (string)I420, (string)NV12, (string)P010_10LE, (string)BGRx, (string)RGBA, (string)GRAY8, (string)YUY2, (string)UYVY, (string)YVYU, (string)Y42B, (string)BGR, (string)RGB, (string)UYVP }
                  width: [ 1, 2147483647 ]
                 height: [ 1, 2147483647 ]
              framerate: [ 0/1, 2147483647/1 ]

Hi, sorry I misinterpreted the output from gst-inspect-1.0. Thanks for a good visualization.

I don’t have it in the current docker container, but I’ll install it and test if it works. I’ll get back to you when I’m done.

This works; thank you!

I had to flash the Xavier to get DeepStream working.

The following is a working example:

gst-launch-1.0 videotestsrc num-buffers=1 ! video/x-raw, format=P010_10LE ! nvvideoconvert ! "video/x-raw(memory:NVMM)" ! nvvideoconvert ! video/x-raw, format=P010_10LE ! filesink location=output2.raw

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.