00_video_decode

Hi Folks,

I am running into error (segmentation fault) while running video decode example. Please help.

Thanks

ubuntu@tegra-ubuntu:~/tegra_multimedia_api/samples/00_video_decode$ ./video_decode cars.mp4 H264
./video_decode cars.mp4 H264
Set governor to performance before enabling profiler
Failed to query video capabilities: Inappropriate ioctl for device
NvMMLiteOpen : Block : BlockType = 261 
TVMR: NvMMLiteTVMRDecBlockOpen: 7907: NvMMLiteBlockOpen 
NvMMLiteBlockCreate : Block : BlockType = 261 
Failed to query video capabilities: Inappropriate ioctl for device
Starting decoder capture loop thread
Input file read complete
TVMR: NvMMLiteTVMRDecDoWork: 6768: NVMMLITE_TVMR: EOS detected
TVMR: TVMRBufferProcessing: 5723: Processing of EOS 
TVMR: TVMRBufferProcessing: 5800: Processing of EOS Done
Segmentation fault (core dumped)

You might want to run this under gdb and get a stack frame from the “backtrace” command to post what it sees as the location of the error.

Hi linuxdev,

Thanks. Following is the attached log from gdb. BTW I have same problem with 02_video_dec_cuda too.

ubuntu@tegra-ubuntu:~/tegra_multimedia_api/samples/00_video_decode$ gdb video_decode
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "aarch64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from video_decode...done.
(gdb) set args cars.mp4 H264
(gdb) run
Starting program: /home/ubuntu/tegra_multimedia_api/samples/00_video_decode/video_decode cars.mp4 H264
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".
Set governor to performance before enabling profiler
Failed to query video capabilities: Inappropriate ioctl for device
NvMMLiteOpen : Block : BlockType = 261 
TVMR: NvMMLiteTVMRDecBlockOpen: 7907: NvMMLiteBlockOpen 
[New Thread 0x7fb6b3b1e0 (LWP 7863)]
[New Thread 0x7fb633b1e0 (LWP 7864)]
[New Thread 0x7fb5b3b1e0 (LWP 7865)]
[New Thread 0x7fb533b1e0 (LWP 7866)]
NvMMLiteBlockCreate : Block : BlockType = 261 
Failed to query video capabilities: Inappropriate ioctl for device
[New Thread 0x7fafead1e0 (LWP 7867)]
[New Thread 0x7faf6ad1e0 (LWP 7868)]
Starting decoder capture loop thread
Input file read complete
TVMR: NvMMLiteTVMRDecDoWork: 6768: NVMMLITE_TVMR: EOS detected
TVMR: TVMRBufferProcessing: 5723: Processing of EOS 
TVMR: TVMRBufferProcessing: 5800: Processing of EOS Done

Thread 6 "video_decode" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fafead1e0 (LWP 7867)]
0x0000007fb71eefb0 in NvMMQueueGetNumEntries () from /usr/lib/aarch64-linux-gnu/tegra/libnvmm_utils.so
(gdb) where
#0  0x0000007fb71eefb0 in NvMMQueueGetNumEntries () from /usr/lib/aarch64-linux-gnu/tegra/libnvmm_utils.so
#1  0x0000007fb72bb048 in ?? () from /usr/lib/aarch64-linux-gnu/tegra/libtegrav4l2.so
#2  0x0000007fb76d66dc in ?? () from /usr/lib/aarch64-linux-gnu/tegra/libnvos.so
#3  0x0000007fb7f84fc4 in start_thread (arg=0x7fb76d66a0) at pthread_create.c:335
#4  0x0000007fb7b47290 in thread_start () at ../sysdeps/unix/sysv/linux/aarch64/clone.S:89
(gdb)

I don’t know if there are debug symbols in libnvmm_utils.so, but if you can switch to frame 0 (“f 0”), and then list the source (“l”), it may provide insight into a specific block of code which went bad.

Thanks linuxdev for your help. libnvmm_utils.so does seem to have debug info.

ubuntu@tegra-ubuntu:~/tegra_multimedia_api/samples/00_video_decode$ gdb video_decode
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "aarch64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from video_decode...done.
(gdb) set args cars.mp4 H264
(gdb) run
Starting program: /home/ubuntu/tegra_multimedia_api/samples/00_video_decode/video_decode cars.mp4 H264
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".
Set governor to performance before enabling profiler
Failed to query video capabilities: Inappropriate ioctl for device
NvMMLiteOpen : Block : BlockType = 261 
TVMR: NvMMLiteTVMRDecBlockOpen: 7907: NvMMLiteBlockOpen 
[New Thread 0x7fb6b3b1e0 (LWP 17754)]
[New Thread 0x7fb633b1e0 (LWP 17755)]
[New Thread 0x7fb5b3b1e0 (LWP 17756)]
[New Thread 0x7fb533b1e0 (LWP 17757)]
NvMMLiteBlockCreate : Block : BlockType = 261 
Failed to query video capabilities: Inappropriate ioctl for device
[New Thread 0x7fafead1e0 (LWP 17758)]
[New Thread 0x7faf6ad1e0 (LWP 17759)]
Starting decoder capture loop thread
Input file read complete
TVMR: NvMMLiteTVMRDecDoWork: 6768: NVMMLITE_TVMR: EOS detected
TVMR: TVMRBufferProcessing: 5723: Processing of EOS 
TVMR: TVMRBufferProcessing: 5800: Processing of EOS Done

Thread 6 "video_decode" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fafead1e0 (LWP 17758)]
0x0000007fb71eefb0 in NvMMQueueGetNumEntries () from /usr/lib/aarch64-linux-gnu/tegra/libnvmm_utils.so
(gdb) where
#0  0x0000007fb71eefb0 in NvMMQueueGetNumEntries () from /usr/lib/aarch64-linux-gnu/tegra/libnvmm_utils.so
#1  0x0000007fb72bb048 in ?? () from /usr/lib/aarch64-linux-gnu/tegra/libtegrav4l2.so
#2  0x0000007fb76d66dc in ?? () from /usr/lib/aarch64-linux-gnu/tegra/libnvos.so
#3  0x0000007fb7f84fc4 in start_thread (arg=0x7fb76d66a0) at pthread_create.c:335
#4  0x0000007fb7b47290 in thread_start () at ../sysdeps/unix/sysv/linux/aarch64/clone.S:89
(gdb) f 0
#0  0x0000007fb71eefb0 in NvMMQueueGetNumEntries () from /usr/lib/aarch64-linux-gnu/tegra/libnvmm_utils.so
(gdb) list
752	    ctx->window_x = 0;
753	    ctx->window_y = 0;
754	    ctx->out_pixfmt = 1;
755	    ctx->fps = 30;
756	    ctx->memory_type = V4L2_MEMORY_MMAP;
757	    ctx->vp9_file_header_flag = 0;
758	
759	    ctx->conv_output_plane_buf_queue = new queue < NvBuffer * >;
760	    pthread_mutex_init(&ctx->queue_lock, NULL);
761	    pthread_cond_init(&ctx->queue_cond, NULL);
(gdb) f 1
#1  0x0000007fb72bb048 in ?? () from /usr/lib/aarch64-linux-gnu/tegra/libtegrav4l2.so
(gdb) list
762	}
763	
764	int
765	main(int argc, char *argv[])
766	{
767	    context_t ctx;
768	    int ret = 0;
769	    int error = 0;
770	    uint32_t i;
771	    bool eos = false;
(gdb)

This isn’t something I can debug, but this sticks out:

Failed to query video capabilities: Inappropriate ioctl for device

…this would tend to imply the related driver and libraries are incorrect or mismatched. Then it seems that simply declaring something without any execution results in the segmentation fault.

Do all of the drivers installed show as ok from this?

sha1sum -c /etc/nv_tegra_release

Also, has there been any kernel customization on this?

Hi Linuxdev

I have requested folks at leopard to help. I am using IMX274 from leopard imaging.

Yes all drivers look ok.

ubuntu@tegra-ubuntu:~/opencv/build$ sudo sha1sum -c /etc/nv_tegra_release
[sudo] password for ubuntu: 
/usr/lib/aarch64-linux-gnu/libv4l/plugins/libv4l2_nvvideocodec.so: OK
/usr/lib/aarch64-linux-gnu/libv4l/plugins/libv4l2_nvvidconv.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvomx.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnveglstreamproducer.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvtx_helper.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvddk_vic.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libglx.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libargus_socketserver.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvmmlite.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvddk_2d_v2.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvwinsys.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libargus.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvmm.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvjpeg.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvexif.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvdc.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvavp.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvtestresults.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libargus_socketclient.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvmm_utils.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvfnet.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvll.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvcameratools.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvapputil.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnveglstream_camconsumer.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvrm.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvcam_imageencoder.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libtegrav4l2.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvparser.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvtvmr.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvrm_gpu.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvtnr.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvcamerautils.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvidia-egl-wayland.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvfnetstoredefog.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvodm_imager.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvmmlite_utils.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvcolorutil.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvmmlite_video.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvmmlite_image.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvmm_contentpipe.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvimp.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvos.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvrm_graphics.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvmedia.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvfnetstorehdfx.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvomxilclient.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvcamlog.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvmm_parser.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libscf.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvosd.so: OK
/usr/lib/xorg/modules/drivers/nvidia_drv.so: OK
/usr/lib/xorg/modules/extensions/libglx.so: OK
ubuntu@tegra-ubuntu:~/opencv/build$

Hi dumbogeorge, the input is raw H264/H265 stream, not with container mp4/mkv/ts/…