Lossless H264/HEVC

Hi there,

We are currently evaluating a new project and its feasibility on Jetson NX.
What we want to achieve is encoding 2 video streams Monochrome 2k (2464 x 2056 pixels) @ 60 FPS using the Xavier NX, using XImea cameras (PCI-express). We would prefer to have either VP or HEVC h265 encoding.

We want to achieve lossless compression on those streams.

  1. Is it possible to achieve such performances using this platform?
  2. As Ximea cameras can use PCIExpress DMA to forward captures frames, is it possible for nvenc to read frames without any copy for encoding? AFAIK, the memory switch fabric seems to be able to handle this use case.
  3. If frames provided by the camera need debayering or monochrome conversion, is this can be handled by NVENC?

Thanks!

Hi,
For lossless encoding, we support it in h264 with YUV444 input frames. On Xavier NX, it cannot achieve 2464x2056p60:

01_video_encode$ gst-launch-1.0 videotestsrc num-buffers=300 !  'video/x-raw, width=(int)2464, height=(int)2056, format=(string)Y444'  ! filesink location=~/origin.yuv
01_video_encode$ ./video_encode ~/origin.yuv 2464 2056 H264 ~/out.264 --elossless -p high444 --max-perf --stats
Creating Encoder in blocking mode
Opening in BLOCKING MODE
NvMMLiteOpen : Block : BlockType = 4
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4
875967048
875711833
H264: Profile = 244, Level = 51
NVMEDIA_ENC: bBlitMode is set to TRUE
Could not read complete frame from input file
File read complete.
Got 0 size buffer in capture
----------- Element = enc0 -----------
Total Profiling time = 10.0828
Average FPS = 29.8528
Total units processed = 302
Average latency(usec) = 320624
Minimum latency(usec) = 44855
Maximum latency(usec) = 338952
-------------------------------------
App run was successful

So you may look for other hardware platforms. Or may consider to encode YUV420.

Hi again,
Thank you for your quick feedback.

“Or may consider to encode YUV420”: not sure to well understand the relationship with lossless encoding here. YUV420p would be fine for us, especially because we have a monochrome camera, isn’t it?

To me lossless conversion is achievable by using CRF=0.

  1. Do you have other NVidia platforms to recommend for this use case?
  2. Does non-standard resolutions are impacting the performances?
  3. Do you have a comprehensive list of all preset/codec/resolution that are supported by the NVEnc layer for Jetson?
  4. In your example, is the frame re-uploaded for each frame or only once? I’m just considering that back-&-forth copies on the memory bus might the limitation in your command line example.

Hi,
On Jetpack 4.6(r32.6.1), we support YUV444 lossless encoding in h265. And is able to achieve two-instance 2464x2056p60 encoding on Xavier. You may consider to use Xavier if 2464x2056p60 is a hard requirement.

On Xavier NX, two-instance 2464x2056p30 encoding looks fine.