How can I get BGRx image with nvvidconv

Hi all,

I’m trying to get BGRx raw format image with nvvidconv.
With below gstreamer command, I think I should get normal BGRx format image but I can see the file size is 976.

gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,width=1280,height=720,format=UYVY,framerate=30/1 ! nvvidconv ! ‘video/x-raw(memory:NVMM),format=BGRx’ ! multifilesink location=test_%d.raw -e

Could you let me know why I can’t get BGRx format image with nvvidconv?

Dongjin Ha.

Since you get frames in CPU memory from v4l2src and want output in CPU memory as well for multifilesink, you would use double nvvidconv, as it expects at least one of its input or output to be in NVMM memory.
You may try:

gst-launch-1.0 -ev v4l2src device=/dev/video0 ! video/x-raw,width=1280,height=720,format=UYVY,framerate=30/1 ! nvvidconv ! 'video/x-raw(memory:NVMM)' ! nvvidconv ! video/x-raw,format=BGRx ! multifilesink location=test_%d.raw 
1 Like

Hi @Honey_Patouceul ,

Your solution is exactly what I want. Thank you for your kind reply.
Can I ask below questions, if it’s not bothering you?

  1. If I use just one nvvidconv, my frame data would be in GPU memory?

  2. In jetson nano case, do you think double nvvidconv has better performance than one videoconvert plugin?
    Actually I could change format with videoconvert but it’s performance was very bad. That’s why I’m trying to use nvvidconv.

For 1, I should first say that it is the same physical memory, as Jetsons have integrated GPU sharing the same memory chip.
I use to say ‘CPU memory’, but I should say CPU allocated memory. NVMM memory in gstreamer refers to contiguous (DMA-able) memory allocation suitable for HW accelerators.
The first nvvidconv has input in CPU allocated memory, so it will output into NVMM memory. Yes, this could be used by GPU, or video-encoder for example.

For 2, I think that unless you are using low resolution and framerate, the double nvvidconv would be faster than videoconvert. Note in my pipeline I haven’t specified if the UYVY to BGRx conversion should be done with the first nvvidconv or by the second one. You may also try to see if this make a difference.

1 Like

Hi @Honey_Patouceul

I really appreciate to your comment. It’s really helpful for me.

Thank you,
Dongjin Ha.