Nvvidconv unsupported resolution

Model: AGX Orin Industrial
L4T version: 35.4.1
Jetpack version: 5.1.2-b104


I wanted to encode some test videos on my Jetson for testing purposes, but I was not able to encode a video with the following resolution : 854 × 480

Heres a minimum failing example:

gst-launch-1.0 videotestsrc ! "video/x-raw,width=854,height=480" ! nvvidconv ! fakesink

nvvidconv fails with the following error:

nvbufsurface: NvBufSurfaceCopy: mem copy failed
nvbufsurface: NvBufSurfaceCopy: failed to copy

I tried with a video in a different resolution (848 × 480) and it worked fine:

gst-launch-1.0 videotestsrc ! "video/x-raw,width=848,height=480" ! nvvidconv ! fakesink
  • Can you explain in detail what is going on ?
  • Can you explain what resolutions cannot be used?

Thanks !

Hi,
We can observe the issue on 5.1.3. Will investigate further and update.

1 Like

Hi,

Source code of nvvidconv is available in https://developer.nvidia.com/downloads/embedded/l4t/r35_release_v4.1/sources/public_sources.tbz2
Please apply this patch and build the plugin to fix this issue:

diff --git a/gst-nvvidconv-1.0/gstnvvconv.c b/gst-nvvidconv-1.0/gstnvvconv.c
index 1cd8058..fd2b656 100644
--- a/gst-nvvidconv-1.0/gstnvvconv.c
+++ b/gst-nvvidconv-1.0/gstnvvconv.c
@@ -3112,8 +3112,7 @@
     surf->surfaceList->planeParams.offset[0] = space->in_info.offset[0];
     surf->surfaceList->width = space->from_width;
     surf->surfaceList->height = space->from_height;
-    surf->surfaceList->planeParams.width[0] =
-        GST_ROUND_UP_4 (space->from_width * bytesPerPixel) / bytesPerPixel;
+    surf->surfaceList->planeParams.width[0] = space->from_width;
     surf->surfaceList->planeParams.height[0] = space->from_height;
     surf->surfaceList->planeParams.psize[0] =
         space->from_height * surf->surfaceList->pitch;
@@ -3126,8 +3125,7 @@
     surf->surfaceList->planeParams.offset[0] = space->out_info.offset[0];
     surf->surfaceList->width = space->to_width;
     surf->surfaceList->height = space->to_height;
-    surf->surfaceList->planeParams.width[0] =
-        GST_ROUND_UP_4 (space->to_width * bytesPerPixel) / bytesPerPixel;
+    surf->surfaceList->planeParams.width[0] = space->to_width;
     surf->surfaceList->planeParams.height[0] = space->to_height;
     surf->surfaceList->planeParams.psize[0] =
         space->to_height * surf->surfaceList->pitch;
@@ -3149,8 +3147,7 @@
     surf->surfaceList->planeParams.psize[j] = comp_pitch * comp_height;
     bytesPerPixel =
         get_bytes_per_pix_from_color (surf->surfaceList->colorFormat, j);
-    surf->surfaceList->planeParams.width[j] =
-        GST_ROUND_UP_4 (comp_width * bytesPerPixel) / bytesPerPixel;
+    surf->surfaceList->planeParams.width[j] = comp_width;
     surf->surfaceList->planeParams.bytesPerPix[j] = bytesPerPixel;
   }
 }
1 Like

@DaveYYY Thanks for the solution!
Can you explain what this change does and why it didn’ t work before?

Take RGB as the color format, bytesPerPixel equals 3 now.
Then apparently it’s causing an issue when you multiply a number by 3 then round it up to 4.

1 Like

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