Using docker image image nvcr.io/nvidia/l4t-cuda:11.4.19-devel as base for building CUDA helps:
-- Video I/O:
-- DC1394: YES (2.2.5)
-- FFMPEG: YES
-- avcodec: YES (58.54.100)
-- avformat: YES (58.29.100)
-- avutil: YES (56.31.100)
-- swscale: YES (5.5.100)
-- avresample: NO
-- GStreamer: YES (1.16.3)
-- v4l/v4l2: YES (linux/videodev2.h)
--
-- Parallel framework: pthreads
--
-- Trace: YES (with Intel ITT)
--
-- Other third-party libraries:
-- Lapack: NO
-- Eigen: NO
-- Custom HAL: YES (carotene (ver 0.0.1))
-- Protobuf: build (3.19.1)
--
-- NVIDIA CUDA: YES (ver 11.4, CUFFT CUBLAS)
-- NVIDIA GPU arch: 72 87
-- NVIDIA PTX archs:
Source: Unable to build OpenCV with CUDA in Docker on Jetson - #16 by AastaLLL
This means that some depencensies are missing in the image nvcr.io/nvidia/deepstream-l4t:6.2-samples