Using h265 with resolutions bigger than 4096

I’m trying to run a pipeline containing a very large frame of a size 4320x1080, if I try to run a pipeline with a width of 4096 everything works fine:

gst-launch-1.0 \
     videotestsrc pattern=checkers-1 num-buffers=100 ! \
     'video/x-raw, width=4096, height=1080' ! \
     nvvidconv ! \
     'video/x-raw(memory:NVMM), width=4096' ! \
     nvv4l2h265enc bitrate=20000000 ! \
     h265parse ! \
     qtmux ! \ 
     filesink location='pipeline_test.mp4'

This produces a perfect checkerboard pattern, however, trying to increase the resolution to 4320 fails.

1. If the videotestsrc is changed to output 4320 without downscaling to 4096 the pipeline looks like this

gst-launch-1.0 \
     videotestsrc pattern=checkers-1 num-buffers=100 ! \
     'video/x-raw, width=4320, height=1080' ! \
     nvvidconv ! \
     nvv4l2h265enc bitrate=20000000 ! \
     h265parse ! \
     qtmux ! \ 
     filesink location='pipeline_test.mp4'

which produces these errors:

tvmrVideoEncoderBitsAvailable_MSENC: ucode ERROR = 144 
NvVideoEncTransferOutputBufferToBlock: DoWork failed line# 667 
NvVideoEnc: NvVideoEncTransferOutputBufferToBlock TransferBufferToBlock failed Line=678

2. If I add downscaling after the nvvidconv element (width=4096) then something strange happens, the output is still with a width of 4320, but with strange artifacts:

What I would like is to get either an output of 4320 to work, or to downscale to 4096 without getting artifacts.

Thanks for the help.

Hi,
Max width = 4096 is limitation of hardware encoder. Please try

gst-launch-1.0 \
     videotestsrc pattern=checkers-1 num-buffers=100 ! \
     'video/x-raw, width=4320, height=1080' ! \
     nvvidconv ! \
     'video/x-raw(memory:NVMM), width=4096, height=1080,format=NV12' ! \
     nvv4l2h265enc bitrate=20000000 ! \
     h265parse ! \
     qtmux ! \ 
     filesink location='pipeline_test.mp4'

Hello Dane, thank you for replying.

As I mentioned in the post, downscaling the video produces the artifacts shown in the image. I’m trying to avoid those artifacts.

Hi,
Please share where the artifacts are. Not able to tell it from the attached screenshot.
Let’s see if we can work out a solution under the hardware limit.

Using the pipeline provided here produces a video with a horizontal resolution of 4320, here is what ffprobe returns:

Stream #0:0(und): Video: hevc (Main) (hvc1 / 0x31637668), yuv420p(tv, progressive), 4096x1080, 6639 kb/s, SAR 135:128 DAR 4:1, 30 fps, 30 tbr, 3k tbn, 3k tbc (default)

So we can see that the SAR is not 1:1.

Screenshot from 2020-04-16 13-29-01

Using “ball” as the origin pattern we can see that the ball is not completely symmetric (notice the minor glitch on the right side).

The only way I found to avoid those artifacts was adding a compositor element after nvvidconv with sink_0::width=4096, only then it encodes the output frame with the correct resolution.

Is there any plan to increase the width limit on the h265 encoder? Since the h265 standard should support a horizontal resolution of 7680.

Hi,

I am afraid we cannot support this since it is limitation in hardware design. TX2 and Xavier are with same limit also.

1 Like

Hi DaneLLL,

What is the max height when set to the max width = 4096?

Thanks.

Hi,

It depends on width value. The maximum pixel is close to 4096x3840, so maximum resolution can be 4096x3840 or 3840x4096. 4096x4096 exceeds hardware constraint.