IMX219 streaming using Jetson (Tegra) Multimedia API

Hello experts,

Is it possible to use tegra multimedia API to stream from IMX219? It seems IMX219 only supports RG10 and according to the following link it might not work.

https://docs.nvidia.com/jetson/archives/l4t-multimedia-archived/l4t-multimedia-282/l4t_mm_v4l2_cam_cuda_group.html

Hi,
Looks like the camera is Pi camera V2? If yes, please try 10_camera_recording, or the gstreamer pipeline:

$ gst-launch-1.0 nvarguscamerasrc ! nvoverlaysink

I know I can stream using gstreamer. However, I am trying to use v4l2/tegra multimedia API as other cameras (USB) using this for streaming. So, if it could be used I could leverage the code written for streaming for those cameras for IMX219 as well.

Hi,
You can modify the sample to do raw frame capture:

/usr/src/jetson_multimedia_api/samples/v4l2cuda/

Since it does not go through hardware ISP engine, you would need to implement de-bayering function. If you need ISP engine, please use Argus.

Ok, I decided to use OpenCV with gstreamer backend. One issue that I am having is, in case the OpenCV capture is not released gracefully (such situation can happen incase your program crashes) the gstreamer capture session is not terminated and therefore, next time when you try to run the program or gstreamer it complains that the capture session cannot be created since it is still running. This issue can be reproduced with gstreamer by closing the terminal instead of issuing CTRL-C. I need to find a solution on how to terminate a session programmatically incase it is running before I try to stream from the camera next time, restarting the system is not an option. Any help on this topic would be appreciated. Thanks,

You may try to use a signal handler such as here (second section with C++) for properly handling this.

This I am afraid will not work as the scenario is “program termination unusually”, such as crash, The program will not get any opportunity to catch SIGINT even if it is issued at all.

The thing that might work is if there is any way to restart or kill any existing gstreamer pipeline everytime the program starts so that before issuing OpenCV open() command, the capture session that was created is freed.

You may try to catch further signals depending on what you imagine to happen with your case, but I cant’t advise further.

Ok, here is the update on this issue. In the last few trials when I killed the program deliberately to simulate a crash did not cause the issue of holding the capture session and therefore the openCV could stream when I ran the program again. So, it seems it is not predictable when that situation of “not being able to create capture session” would occur. Therefore, as a fallback it would be useful to know how a previous capture session (if there is already any) could be forcefully terminated instead of restarting the system so that a new capture session could be created.

Looking for a gstreamer expert to answer my question.

Hi,
For abnormal shutdown, you may try to restart nvargus-daemon:

Thanks DaneDLL. yes, this seems to be the only solution.