4k 10bit HDR Hardware decode and encode on Jetson TX2 with ffmpeg

I can decode/encode 4K 8bit videos on TX2 using nvdec hardware accelerator with ffmpeg. But decoding failes for 10bit videos with error Unsupported pixel format. The pixel format I am using is “yuv420p10le”. And I am using “GitHub - jocover/jetson-ffmpeg: ffmpeg support on jetson nano” to enable the hardware support.

I have tested nvv4l2dec also with same error. Is there a support for 10bit hardware decode?

Or a cuda based solution?

Hi,
10-bit decoding may not work properly in ffmpeg. We would suggest use jetson_multimedia_api. Please check this sample and give it a try:

/usr/src/jetson_multimedia_api/samples/08_video_dec_drm

If a HDR TV is connected, it can do HDR video playback through DRM.

Hi,
Thanks for the reply. Is this example using GPU for decoding? And can it be integrated with ffmpeg with some work? If yes, then could you pls point to some resources?

I want to use this for streaming on local network.

Hi,
We have the implementation to enable hardware decoding in ffmpeg. You can download the source code and do customization:
Jetson TX2 and FFmpeg - Can't initialize nvrm channel - #5 by DaneLLL
The implementation is based on jetson_multimedia_api. And please check developer user guide

There are individual hardware engines NVDEC ad NVENC. GPU is not used for encoding/decoding tasks.

Hi,
I followed the above steps, built the ffmpeg and used the below command:-

./ffmpeg -c:v hevc_nvv4l2dec -i <videofile> -f null -

Video File specs:- Stream #0:0: Video: hevc (Main 10), yuv420p10le(tv, bt709), 1920x816 [SAR 1:1 DAR 40:17], 23.98 fps, 23.98 tbr, 1k tbn, 23.98 tbc (default)

Error:- [hevc_nvv4l2dec @ 0x55b9a14e20] Unsupported pixel format Assertion ((src_linesize) >= 0 ? (src_linesize) : (-(src_linesize))) >= bytewidth failed at libavutil/imgutils.c:314 Aborted (core dumped)

Does this mean NVDEC hardware decoder does not support 10bit pixel format?

Hi,
Please run 08_video_dec_drm and check if the stream is decode-able. Hardware decoder supports HEVC YUV420 10-bit.

When I run this, it hangs and NVDEC is shown as OFF in jtop.

`./video_dec_drm <video_file_HEVC_10bit.mkv> H265 --disable-ui
Set governor to performance before enabling profiler
can’t open /dev/tty0 err=Permission denied
Opening in BLOCKING MODE
NvMMLiteOpen : Block : BlockType = 279
NVMEDIA: Reading vendor.tegra.display-size : status: 6
NvMMLiteBlockCreate : Block : BlockType = 279
Starting decoder capture loop thread

`

where as for H264 8bit

./video_dec_drm <video_file_H264_8bit.mkv> H264 --disable-ui Set governor to performance before enabling profiler Using VT number 3 VT_WAITACTIVE failed, err=Input/output error Opening in BLOCKING MODE NvMMLiteOpen : Block : BlockType = 261 NVMEDIA: Reading vendor.tegra.display-size : status: 6 NvMMLiteBlockCreate : Block : BlockType = 261 Starting decoder capture loop thread NVMEDIA: NvMediaMixerInit: 119: frameWidth = 48, frameHeight = 32 NVMEDIA: DeinterlaceThread: 786: DeinterlaceThread is created Video Resolution: 48x32 APP_INFO : mastering display data not found [ERROR] (NvDrmRenderer.cpp:231) <renderer0> Requested connnector is not connected Error in setting up drm renderer [NvMediaParserParse:357] Video parser parse failed: 0[ERROR] (NvV4l2ElementPlane.cpp:178) <dec0> Output Plane:Error while DQing buffer: Broken pipe Error DQing buffer at output plane KDSETMODE failed, err=Bad file descriptor Error in query_and_set_capture Exiting decoder capture loop thread Decoder is in error KDSETMODE failed, err=Bad file descriptor NVMEDIA: DeinterlaceThread: 864: Closing Deinterlace Thread App run failed

I am running them from an ssh session as my jetson is running headless.

Hi,
Please extract the stream from mkv. The sample supports h264/h265 stream only. You can extract the stream by running gstreamer commands:

$ gst-launch-1.0 filesrc location=test.mkv ! matroskademux ! h265parse ! 'video/x-h265,stream-format=byte-stream' ! filesink location=test.h265

And please disable Ubuntu desktop by running:

   $ sudo systemctl stop gdm
   $ sudo loginctl terminate-seat seat0

Document:
Jetson Linux API Reference: 08_video_dec_drm (Direct Rendering Manager) | NVIDIA Docs

If the issue persists, it is very likely specific to the stream. Then please share the stream so that we can replicate the failure and debug.

Hi,
Its still not working with both the streams. Pls find the streams below.

10bit h265:-
h265_10bit

8bit h264:-
h264_8bit

Hi,
Please run with sudo for a try:

08_video_dec_drm$ sudo ./video_dec_drm ~/test.h265 H265 --disable-ui
Set governor to performance before enabling profiler
Using VT number 1
VT_WAITACTIVE failed, err=Input/output error
Opening in BLOCKING MODE
NvMMLiteOpen : Block : BlockType = 279
NVMEDIA: Reading vendor.tegra.display-size : status: 6
NvMMLiteBlockCreate : Block : BlockType = 279
Starting decoder capture loop thread
Video Resolution: 1920x816
APP_INFO : mastering display data not found
Query and set capture successful
Input file read complete
Exiting decoder capture loop thread
App run was successful

We can run successfully. The h265 stream is valid.

I am getting this error, is it because I am running it over ssh and in a headless mode i.e. without a display connected. My installation of Ubuntu is very bare minimum almost equivalent to Ubuntu server. Can that be an issue?

Set governor to performance before enabling profiler Using VT number 3 VT_WAITACTIVE failed, err=Input/output error Opening in BLOCKING MODE NvMMLiteOpen : Block : BlockType = 279 NVMEDIA: Reading vendor.tegra.display-size : status: 6 NvMMLiteBlockCreate : Block : BlockType = 279 Starting decoder capture loop thread Video Resolution: 1920x816 APP_INFO : mastering display data not found [ERROR] (NvDrmRenderer.cpp:231) <renderer0> Requested connnector is not connected Error in setting up drm renderer Error in query_and_set_capture Exiting decoder capture loop thread KDSETMODE failed, err=Bad file descriptor App run failed

Hi,
The sample is for HDR vide playback. If you don’t need rendering in your use-case, you would need to remove NvDrmRenderer and rebuild the sample.

Hi,
Thanks a lot for your help. I will try building it without the NvDrmRenderer.

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