cannot run example: 12_camera_v4l2_cuda

Hello ALL:
I bulit the sample “12_camera_v4l2_cuda” from “multi-media-api-sample” and run it,but i got run error :
ERROR: camera_initialize(): (line:234) Failed to set camera output format: Invalid argument (22)
ERROR: init_components(): (line:332) Failed to initialize camera device
ERROR: main(): (line:715) Failed to initialize v4l2 components
App run failed

I have tried all “-f XXXX”,but not works.

Is there some advice?
Thanks.

Below is the make and run information:

nvidia@tegra-ubuntu:~/tegra_multimedia_api/samples/12_camera_v4l2_cuda$ make
g++ -I"/usr/include/aarch64-linux-gnu" -I"…/…/include" -I"…/common/algorithm/cuda" -c camera_v4l2_cuda.cpp
make -C …/common/classes
make[1]: Entering directory ‘/home/nvidia/tegra_multimedia_api/samples/common/classes’
g++ -I"/usr/include/aarch64-linux-gnu" -I"…/…/include" -I"…/…/…/include" -I"…/…/…/include/libjpeg-8b" -c NvElementProfiler.cpp
g++ -I"/usr/include/aarch64-linux-gnu" -I"…/…/include" -I"…/…/…/include" -I"…/…/…/include/libjpeg-8b" -c NvElement.cpp
g++ -I"/usr/include/aarch64-linux-gnu" -I"…/…/include" -I"…/…/…/include" -I"…/…/…/include/libjpeg-8b" -c NvApplicationProfiler.cpp
g++ -I"/usr/include/aarch64-linux-gnu" -I"…/…/include" -I"…/…/…/include" -I"…/…/…/include/libjpeg-8b" -c NvVideoDecoder.cpp
g++ -I"/usr/include/aarch64-linux-gnu" -I"…/…/include" -I"…/…/…/include" -I"…/…/…/include/libjpeg-8b" -c NvBuffer.cpp
g++ -I"/usr/include/aarch64-linux-gnu" -I"…/…/include" -I"…/…/…/include" -I"…/…/…/include/libjpeg-8b" -c NvJpegEncoder.cpp
g++ -I"/usr/include/aarch64-linux-gnu" -I"…/…/include" -I"…/…/…/include" -I"…/…/…/include/libjpeg-8b" -c NvVideoConverter.cpp
g++ -I"/usr/include/aarch64-linux-gnu" -I"…/…/include" -I"…/…/…/include" -I"…/…/…/include/libjpeg-8b" -c NvLogging.cpp
g++ -I"/usr/include/aarch64-linux-gnu" -I"…/…/include" -I"…/…/…/include" -I"…/…/…/include/libjpeg-8b" -c NvEglRenderer.cpp
g++ -I"/usr/include/aarch64-linux-gnu" -I"…/…/include" -I"…/…/…/include" -I"…/…/…/include/libjpeg-8b" -c NvUtils.cpp
g++ -I"/usr/include/aarch64-linux-gnu" -I"…/…/include" -I"…/…/…/include" -I"…/…/…/include/libjpeg-8b" -c NvJpegDecoder.cpp
g++ -I"/usr/include/aarch64-linux-gnu" -I"…/…/include" -I"…/…/…/include" -I"…/…/…/include/libjpeg-8b" -c NvVideoEncoder.cpp
g++ -I"/usr/include/aarch64-linux-gnu" -I"…/…/include" -I"…/…/…/include" -I"…/…/…/include/libjpeg-8b" -c NvV4l2ElementPlane.cpp
g++ -I"/usr/include/aarch64-linux-gnu" -I"…/…/include" -I"…/…/…/include" -I"…/…/…/include/libjpeg-8b" -c NvV4l2Element.cpp
make[1]: Leaving directory ‘/home/nvidia/tegra_multimedia_api/samples/common/classes’
make -C …/common/algorithm/cuda
make[1]: Entering directory ‘/home/nvidia/tegra_multimedia_api/samples/common/algorithm/cuda’
/usr/local/cuda/bin/nvcc -ccbin g++ -I"…/…/…/…/include" --shared -Xcompiler -I"/usr/include/aarch64-linux-gnu" -Xcompiler -I"…/…/include" -Xcompiler -fPIC -gencode arch=compute_53,code=sm_53 -gencode arch=compute_62,code=sm_62 -o NvAnalysis.o -c NvAnalysis.cu
/usr/local/cuda/bin/nvcc -ccbin g++ -I"…/…/…/…/include" --shared -Xcompiler -I"/usr/include/aarch64-linux-gnu" -Xcompiler -I"…/…/include" -Xcompiler -fPIC -gencode arch=compute_53,code=sm_53 -gencode arch=compute_62,code=sm_62 -o NvCudaProc.o -c NvCudaProc.cpp
make[1]: Leaving directory ‘/home/nvidia/tegra_multimedia_api/samples/common/algorithm/cuda’
g++ -o camera_v4l2_cuda camera_v4l2_cuda.o …/common/classes/NvElementProfiler.o …/common/classes/NvElement.o …/common/classes/NvApplicationProfiler.o …/common/classes/NvVideoDecoder.o …/common/classes/NvBuffer.o …/common/classes/NvJpegEncoder.o …/common/classes/NvVideoConverter.o …/common/classes/NvLogging.o …/common/classes/NvEglRenderer.o …/common/classes/NvUtils.o …/common/classes/NvJpegDecoder.o …/common/classes/NvVideoEncoder.o …/common/classes/NvV4l2ElementPlane.o …/common/classes/NvV4l2Element.o …/common/algorithm/cuda/NvAnalysis.o …/common/algorithm/cuda/NvCudaProc.o -I"/usr/include/aarch64-linux-gnu" -I"…/…/include" -I"…/common/algorithm/cuda" -L"/usr/lib/aarch64-linux-gnu" -L"/usr/lib/aarch64-linux-gnu/tegra" -L"/usr/local/cuda/targets/aarch64-linux/lib" -lpthread -lv4l2 -lEGL -lGLESv2 -lX11 -lnvbuf_utils -lnvjpeg -lcuda -lcudart
[i]nvidia@tegra-ubuntu:~/tegra_multimedia_api/samples/12_camera_v4l2_cuda$ ./camera_v4l2_cuda -d /dev/video0 -s 1280x720 -f YUYV -c
ERROR: camera_initialize(): (line:234) Failed to set camera output format: Invalid argument (22)
ERROR: init_components(): (line:332) Failed to initialize camera device
ERROR: main(): (line:715) Failed to initialize v4l2 components
App run failed[/i]

Hi, please plug in a USB camera and give correct path ‘-d /dev/video1’ and format ‘-f xxxx’

Thanks,DaneLLL,I will try that later.
But is that mean this example do not support my Jetson TX2 Onboard Camera?

The sample code is not for onboard camera. Please run 09_camera_jpeg_capture and 10_camera_recording for onboard camera.

I got this error with 10_camera_recording

nvidia@tegra-ubuntu:~/tegra_multimedia_api/samples/10_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
NvMMLiteOpen : Block : BlockType = 4 
===== MSENC =====
NvMMLiteBlockCreate : Block : BlockType = 4 
875967048
842091865
create vidoe encoder return true
CONSUMER: Waiting until producer is connected...
PRODUCER: Starting repeat capture requests.
CONSUMER: Producer has connected; continuing.
SCF: Error BadValue: not available (in src/services/gyro/SensorsManager.cpp, function initSensors(), line 278)
SCF: Error BadValue: not available (in src/services/gyro/SensorsManager.cpp, function initSensors(), line 278)
SCF: Error BadValue: not available (in src/services/gyro/SensorsManager.cpp, function initSensors(), line 278)
SCF: Error BadValue: not available (in src/services/gyro/SensorsManager.cpp, function initSensors(), line 278)
SCF: Error BadValue: motionMonitorThread failure (in src/services/gyro/MotionMonitorService.cpp, function motionMonitorThread(), line 343)
===== MSENC blits (mode: 1) into tiled surfaces =====
CONSUMER: Got EOS, exiting...
CONSUMER: Done.
PRODUCER: Done -- exiting.
************************************
Total Profiling Time = 0 sec
************************************

Please refer to https://devtalk.nvidia.com/default/topic/1001197/jetson-tx2/error-in-src-services-gyro-sensorsmanager-cpp-initsensors-when-accessing-camera-on-tx2/post/5115524/#5115524

The default capture time is 1 second. You have run it successfully.