Hell guys, I am now using the CSI camera in Jatson nano for Visual Computing. I have been testing this camera for days, in which the gstreamer cannot drive the camera properly. I have tried several commands and packages, none of them works.
the v4l2-ctl --device /dev/video0 --all
gives detailed camera info
Driver Info (not using libv4l2):
Driver name : tegra-video
Card type : vi-output, imx219 8-0010
Bus info : platform:54080000.vi:4
Driver version: 4.9.140
Capabilities : 0x84200001
Video Capture
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04200001
Video Capture
Streaming
Extended Pix Format
Priority: 2
Video input : 0 (Camera 4: ok)
Format Video Capture:
Width/Height : 1920/1080
Pixel Format : 'RG10'
Field : None
Bytes per Line : 3840
Size Image : 4147200
Colorspace : sRGB
Transfer Function : Default (maps to sRGB)
YCbCr/HSV Encoding: Default (maps to ITU-R 601)
Quantization : Default (maps to Full Range)
Flags :
Camera Controls
group_hold 0x009a2003 (bool) : default=0 value=0 flags=execute-on-write
sensor_mode 0x009a2008 (int64) : min=0 max=0 step=0 default=0 value=2 flags=slider
gain 0x009a2009 (int64) : min=0 max=0 step=0 default=0 value=16 flags=slider
exposure 0x009a200a (int64) : min=0 max=0 step=0 default=0 value=33330 flags=slider
frame_rate 0x009a200b (int64) : min=0 max=0 step=0 default=0 value=30000000 flags=slider
bypass_mode 0x009a2064 (intmenu): min=0 max=1 default=0 value=1
override_enable 0x009a2065 (intmenu): min=0 max=1 default=0 value=1
height_align 0x009a2066 (int) : min=1 max=16 step=1 default=1 value=1
size_align 0x009a2067 (intmenu): min=0 max=2 default=0 value=0
write_isp_format 0x009a2068 (bool) : default=0 value=0
sensor_signal_properties 0x009a2069 (u32) : min=0 max=0 step=0 default=0 flags=read-only, has-payload
sensor_image_properties 0x009a206a (u32) : min=0 max=0 step=0 default=0 flags=read-only, has-payload
sensor_control_properties 0x009a206b (u32) : min=0 max=0 step=0 default=0 flags=read-only, has-payload
sensor_dv_timings 0x009a206c (u32) : min=0 max=0 step=0 default=0 flags=read-only, has-payload
low_latency_mode 0x009a206d (bool) : default=0 value=0
preferred_stride 0x009a206e (int) : min=0 max=65535 step=1 default=0 value=0
sensor_modes 0x009a2082 (int) : min=0 max=30 step=1 default=30 value=6 flags=read-only
I am using gst-launch-1.0 nvarguscamerasrc sensor_id=0 ! nvoverlaysink
, the output does not tell Error, but just stuck there without any image or window prompt out.
Secondly, I tried
gst-launch-1.0 nvarguscamerasrc sensor_id=1 ! \ 'video/x-raw(memory:NVMM),width=3264, height=2464,framerate=21/1, format=NV12' ! \ nvvidconv flip-method=0 ! 'video/x-raw, width=816, height=616' ! \ nvvidconv ! nvegltransform ! nveglglessink -e
the result is wired that, the gst-launch window will immediately capture the upper left corner of the screen and and no longer shown any image.
I also tried python script to call the opencv and gstreamer functions, which still not working.
import cv2
def gstreamer_pipeline(
capture_width=1280,
capture_height=720,
display_width=1280,
display_height=720,
framerate=60,
flip_method=0,
):
return (
"nvarguscamerasrc ! "
"video/x-raw(memory:NVMM), "
"width=(int)%d, height=(int)%d, "
"format=(string)NV12, framerate=(fraction)%d/1 ! "
"nvvidconv flip-method=%d ! "
"video/x-raw, width=(int)%d, height=(int)%d, format=(string)BGRx ! "
"videoconvert ! "
"video/x-raw, format=(string)BGR ! appsink"
% (
capture_width,
capture_height,
framerate,
flip_method,
display_width,
display_height,
)
)
def show_camera():
# To flip the image, modify the flip_method parameter (0 and 2 are the most common)
print(gstreamer_pipeline(flip_method=0))
cap = cv2.VideoCapture(gstreamer_pipeline(flip_method=0), cv2.CAP_GSTREAMER)
if cap.isOpened():
window_handle = cv2.namedWindow("CSI Camera", cv2.WINDOW_AUTOSIZE)
# Window
while cv2.getWindowProperty("CSI Camera", 0) >= 0:
ret_val, img = cap.read()
cv2.imshow("CSI Camera", img)
print("I am showing Image !!!!\n")
# This also acts as
keyCode = cv2.waitKey(30) & 0xFF
# Stop the program on the ESC key
if keyCode == 27:
break
cap.release()
cv2.destroyAllWindows()
else:
print("Unable to open camera")
if __name__ == "__main__":
show_camera()
The results also wired, since the inserted print() function doesnot display the information “showing image”. And the camera is not opened properly.
)
Do you guys have any Any help or advice ?
---- Update: I replaced anther camera which should be identical to the previous one to make sure the camera is not breakdown. The driver can easily detect the camera, but still cannot display any captured video frames. The terminal output is shown below.
ludafu@ludafu:~$ ls /dev/vi*
/dev/video0
ludafu@ludafu:~$ v4l2-ctl --device /dev/video0 --all
Driver Info (not using libv4l2):
Driver name : tegra-video
Card type : vi-output, imx219 8-0010
Bus info : platform:54080000.vi:4
Driver version: 4.9.140
Capabilities : 0x84200001
Video Capture
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04200001
Video Capture
Streaming
Extended Pix Format
Priority: 2
Video input : 0 (Camera 4: ok)
Format Video Capture:
Width/Height : 1920/1080
Pixel Format : 'RG10'
Field : None
Bytes per Line : 3840
Size Image : 4147200
Colorspace : sRGB
Transfer Function : Default (maps to sRGB)
YCbCr/HSV Encoding: Default (maps to ITU-R 601)
Quantization : Default (maps to Full Range)
Flags :
Camera Controls
group_hold 0x009a2003 (bool) : default=0 value=0 flags=execute-on-write
sensor_mode 0x009a2008 (int64) : min=0 max=0 step=0 default=0 value=2 flags=slider
gain 0x009a2009 (int64) : min=0 max=0 step=0 default=0 value=16 flags=slider
exposure 0x009a200a (int64) : min=0 max=0 step=0 default=0 value=33330 flags=slider
frame_rate 0x009a200b (int64) : min=0 max=0 step=0 default=0 value=30000000 flags=slider
bypass_mode 0x009a2064 (intmenu): min=0 max=1 default=0 value=1
override_enable 0x009a2065 (intmenu): min=0 max=1 default=0 value=1
height_align 0x009a2066 (int) : min=1 max=16 step=1 default=1 value=1
size_align 0x009a2067 (intmenu): min=0 max=2 default=0 value=0
write_isp_format 0x009a2068 (bool) : default=0 value=0
sensor_signal_properties 0x009a2069 (u32) : min=0 max=0 step=0 default=0 flags=read-only, has-payload
sensor_image_properties 0x009a206a (u32) : min=0 max=0 step=0 default=0 flags=read-only, has-payload
sensor_control_properties 0x009a206b (u32) : min=0 max=0 step=0 default=0 flags=read-only, has-payload
sensor_dv_timings 0x009a206c (u32) : min=0 max=0 step=0 default=0 flags=read-only, has-payload
low_latency_mode 0x009a206d (bool) : default=0 value=0
preferred_stride 0x009a206e (int) : min=0 max=65535 step=1 default=0 value=0
sensor_modes 0x009a2082 (int) : min=0 max=30 step=1 default=30 value=6 flags=read-only
I have also tried gstreamter function playing test video in a window using command gst-launch-1.0 videotestsrc ! autovideosink
this works well, the test video is successfully displayed. So I think the true problem is the interaction between the Camera and gstreamer.