H265 Encoding Issues

Hey all,

I’ve run into an issue using the hardware encoding on the Jetson TX2 and am uncertain how to resolve it. Currently I have a pipeline which uses libv4l2 to encode a test pattern in either h264 or h265, and I am seeing some corruption artifacts within the streamed video.

Basically, sections of the video have little horizontal lines that copy across through pixels they should not be in. See video below to see the artifacts in action.

https://www.dropbox.com/s/glj5fpth715i82p/test_pattern.ts?dl=0

These are not present in the test pattern, and are present when the video is stored locally or streamed over the network.

If anyone could point me to a cause of this, that would be greatly appreciated.

HI,
If it happens in streaming over network only, it probably is an issue in limited network bandwidth. But you also observe it in saving to local file, it is mostly likely something wrong in the application. If you use tegra_multimedia_api, you may miss to call NvBufferMemSyncForDevice() or NvBufferMemSyncForCpu().

Thanks Dane.

Unfortunately, I haven’t been using the Multimedia API, to perform the encoding. I’m using the v4l2_m2m interface using libnvv4l2.

Is using NvBufferMemSync the only way to perform this operation, or is there something libnvv4l2 isn’t doing that it should be?

Hi,
Please refer to 01_video_encode sample. The v4l2 implementation depends on NvBuffer APIs and may not work properly in pure v42_m2M interface. Certain customization should be required in this usecase. From the description, it looks like buffers are not synchronized and NvBufferMemSyncForDevice(), NvBufferMemSyncForCpu() shall be called accordingly. 01_video_encode is a verified sample and you can compare your application code to it.

Dane, the solution seems to have worked nicely. Thanks very much for the pointer.

Only NvBufferMemSyncForDevice() is needed in the video encoder use case, as per the example.

Hi,
Good to hear that and thanks for sharing rootcause.