Inference + depth + encoding + streaming example ?

Hi All

I am trying to combine inference using the jetson nano examples, a video codec using the tegra multimedia api samples and depth from an Intel realsense D4xx camera. I am able to get the realsense depth + inference to work by, but dont know how to send the packed RGB8 color frame from the camera to NvVideoEncoder

An example or some pointer to how this can be done is greatly appreciated!

Thanks

Hi,

Does this sample help?
/usr/src/tegra_multimedia_api/samples/10_camera_recording

Thanks.

The camera_recording example always fails for me. I tried different cameras, including logitech c920 and I get the following error

Set governor to performance before enabling profiler
PRODUCER: Creating output stream
PRODUCER: Launching consumer thread
Failed to query video capabilities: Inappropriate ioctl for device
Opening in BLOCKING MODE
NvMMLiteOpen : Block : BlockType = 4
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4
875967048
842091865
create video encoder return true
H264: Profile = 100, Level = 50
PRODUCER: Starting repeat capture requests.
Segmentation fault (core dumped)

Folks - any thoughts on this please ? The camera recording sample fails with the same error no matter which camera I use

Hi,

Sorry for the late reply.

The sample try to open the camera mounted at /dev/video0
You will need to update the camera index if the camera is mounted at other position.

${tegra_multimedia_api}/samples/10_camera_recording/main.cpp

static uint32_t     CAMERA_INDEX = 0;

You can verify the mount informaiton with these command:

sudo apt install v4l-utils
v4l2-ctl -l

Thanks.

Hi @AastaLL

I rechecked and confirmed CAMERA_INDEX = 0, checked device is /dev/video0, rebuilt and ran again. Still same problem “Failed to query video capabilities: Inappropriate ioctl for device”.

I have pasted the whole session below

This is on jetson nano

ls /dev/v*
/dev/vcs /dev/vcs2 /dev/vcs4 /dev/vcs6 /dev/vcsa1 /dev/vcsa3 /dev/vcsa5 /dev/vhci
/dev/vcs1 /dev/vcs3 /dev/vcs5 /dev/vcsa /dev/vcsa2 /dev/vcsa4 /dev/vcsa6 /dev/video0

/dev/v4l:
by-id by-path

/dev/vfio:
vfio

grep CAMERA_INDEX *
main.cpp:static uint32_t CAMERA_INDEX = 0;
main.cpp: if (CAMERA_INDEX >= cameraDevices.size())
main.cpp: PRODUCER_PRINT(“CAMERA_INDEX out of range. Fall back to 0\n”);
main.cpp: CAMERA_INDEX = 0;
main.cpp: iCameraProvider->createCaptureSession(cameraDevices[CAMERA_INDEX]));
main.cpp: CAMERA_INDEX = atoi(optarg);
v4l2-ctl -l
brightness 0x00980900 (int) : min=0 max=255 step=1 default=128 value=128
contrast 0x00980901 (int) : min=0 max=255 step=1 default=32 value=32
saturation 0x00980902 (int) : min=0 max=255 step=1 default=32 value=32
white_balance_temperature_auto 0x0098090c (bool) : default=1 value=1
gain 0x00980913 (int) : min=0 max=255 step=1 default=64 value=64
power_line_frequency 0x00980918 (menu) : min=0 max=3 default=2 value=2
white_balance_temperature 0x0098091a (int) : min=2800 max=6500 step=1 default=5500 value=5500 flags=inactive
sharpness 0x0098091b (int) : min=0 max=255 step=1 default=22 value=22
backlight_compensation 0x0098091c (int) : min=0 max=1 step=1 default=1 value=1
exposure_auto 0x009a0901 (menu) : min=0 max=3 default=3 value=3
exposure_absolute 0x009a0902 (int) : min=3 max=2047 step=1 default=166 value=166 flags=inactive
exposure_auto_priority 0x009a0903 (bool) : default=0 value=1
pan_absolute 0x009a0908 (int) : min=-36000 max=36000 step=3600 default=0 value=0
tilt_absolute 0x009a0909 (int) : min=-36000 max=36000 step=3600 default=0 value=0
focus_absolute 0x009a090a (int) : min=0 max=255 step=5 default=60 value=60 flags=inactive
focus_auto 0x009a090c (bool) : default=1 value=1
zoom_absolute 0x009a090d (int) : min=1 max=5 step=1 default=1 value=1

make
Compiling: main.cpp
make[1]: Entering directory ‘/home/arun/work/tegra_multimedia_api/samples/common/classes’
Compiling: NvElementProfiler.cpp
Compiling: NvElement.cpp
Compiling: NvApplicationProfiler.cpp
Compiling: NvVideoDecoder.cpp
Compiling: NvJpegEncoder.cpp
Compiling: NvVideoConverter.cpp
Compiling: NvDrmRenderer.cpp
Compiling: NvLogging.cpp
Compiling: NvEglRenderer.cpp
Compiling: NvUtils.cpp
Compiling: NvBuffer.cpp
Compiling: NvJpegDecoder.cpp
Compiling: NvVideoEncoder.cpp
Compiling: NvV4l2ElementPlane.cpp
Compiling: NvV4l2Element.cpp
make[1]: Leaving directory ‘/home/arun/work/tegra_multimedia_api/samples/common/classes’
Compiling: /home/arun/work/tegra_multimedia_api/argus/samples/utils/Thread.cpp
Compiling: /home/arun/work/tegra_multimedia_api/argus/samples/utils/NativeBuffer.cpp
Compiling: /home/arun/work/tegra_multimedia_api/argus/samples/utils/nvmmapi/NvNativeBuffer.cpp
Linking: camera_recording
./camera_recording
Set governor to performance before enabling profiler
PRODUCER: Creating output stream
PRODUCER: Launching consumer thread
Failed to query video capabilities: Inappropriate ioctl for device
Opening in BLOCKING MODE
NvMMLiteOpen : Block : BlockType = 4
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4
875967048
842091865
create video encoder return true
H264: Profile = 100, Level = 50
PRODUCER: Starting repeat capture requests.
Segmentation fault (core dumped)

This, in itself, is a warning, not a fatal error – this is not entirely uncommon on Video4Linux devices.

The segmentation fault is the problem. Generally, you should step through the program in the debugger (gdb) and figure out what format it’s trying to specify, and what format the camera you have actually supports, and then update the code to adapt to the video format you have.