Nvgstcapture streaming issue

Hell All,

I’m testing custom camera sensor.

v4l2-ctl command is working good.

v4l2-ctl -d /dev/video0 --set-fmt-video=width=4608,height=3456 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=10

gst-launch-1.0 is working good.

gst-launch-1.0 nvarguscamerasrc sensor-id=0 aelock=1 ee-mode=1 ee-strength=0 tnr-strength=0 tnr-mode=1 exposurecompensation=1 ! 'video/x-raw(memory:NVMM), width=4608, height=3456, framerate=4/1, format=NV12' ! nvvidconv flip-method=0 ! xvimagesink -e

but nvgstcapture was not working.

as shown below.

livsmed@livsmed-desktop:~/Documents$ nvgstcapture-1.0 --cus-prev-res=4608x3456
Encoder null, cannot set bitrate!
Encoder Profile = High
Supported resolutions in case of ARGUS Camera
  (2) : 640x480
  (3) : 1280x720
  (4) : 1920x1080
  (5) : 2104x1560
  (6) : 2592x1944
  (7) : 2616x1472
  (8) : 3840x2160
  (9) : 3896x2192
  (10): 4208x3120
  (11): 5632x3168
  (12): 5632x4224

Runtime ARGUS Camera Commands:

  Help : 'h'
  Quit : 'q'
  Set Capture Mode:
      mo:<val>
          (1): image
          (2): video
  Get Capture Mode:
      gmo
  Set sensor orientation:
      so:<val>
          (0): none
          (1): Rotate counter-clockwise 90 degrees
          (2): Rotate 180 degrees
          (3): Rotate clockwise 90 degrees
  Get sensor orientation:
      gso
  Set sensor mode:
      smo:<val> e.g., smo:1
  Get sensor mode:
      gsmo
  Set Whitebalance Mode:
      wb:<val>
          (0): off
          (1): auto
          (2): incandescent
          (3): fluorescent
          (4): warm-fluorescent
          (5): daylight
          (6): cloudy-daylight
          (7): twilight
          (8): shade
          (9): manual
  Get Whitebalance Mode:
      gwb
  Set Saturation (0 to 2):
      st:<val> e.g., st:1.25
  Get Saturation:
      gst
  Set Exposure Compensation (-2 to 2):
      ec:<val> e.g., ec:-2
  Get Exposure Compensation:
      gec
  Set Auto Whitebalance Lock:
      awbl:<val> e.g., awbl:0
  Get Auto Whitebalance Lock:
      awbl
  Set Auto Exposure Lock:
      ael:<val> e.g., ael:0
  Get Auto Exposure Lock:
      gael
  Set TNR Mode:
      tnrm:<val> e.g., tnrm:1
          (0): OFF
          (1): FAST
          (2): HIGH QUALITY
  Get TNR Mode:
      gtnrm
  Set TNR Strength (-1 to 1):
      tnrs:<val> e.g., tnrs:0.5
  Get TNR Strength:
      gtnrs
  Set EE Mode:
      eem:<val> e.g., eem:1
          (0): OFF
          (1): FAST
          (2): HIGH QUALITY
  Get EE Mode:
      geem
  Set EE Strength (-1 to 1):
      ees:<val> e.g., ees:0.5
  Get EE Strength:
      gees
  Set Auto Exposure Anti-Banding (0 to 3):
      aeab:<val> e.g., aeab:2
          (0): OFF
          (1): MODE AUTO
          (2): MODE 50HZ
          (3): MODE 60HZ
  Get Auto Exposure Anti-Banding:
      gaeab
  Set Gain Range:
      gr:<val><space><val> e.g., gr:1 16
  Get Gain Range:
      ggr
  Set Exposure Time Range:
      etr:<val><space><val> e.g., etr:34000 35000
  Get Exposure Time Range:
      getr
  Set ISP Digital Gain Range:
      dgr:<val><space><val> e.g., dgr:2 152
  Get ISP Digital Gain Range:
      gdgr
  Capture: enter 'j' OR
           followed by a timer (e.g., jx5000, capture after 5 seconds) OR
           followed by multishot count (e.g., j:6, capture 6 images)
           timer/multihot values are optional, capture defaults to single shot with timer=0s
  Start Recording : enter '1'
  Stop Recording  : enter '0'
  Video snapshot  : enter '2' (While recording video)
  Get Preview Resolution:
      gpcr
  Get Image Capture Resolution:
      gicr
  Get Video Capture Resolution:
      gvcr


Runtime encoder configuration options:

  Set Encoding Bit-rate(in bytes):
      br:<val> e.g., br:4000000
  Get Encoding Bit-rate(in bytes):
      gbr
  Set Encoding Profile(only for H.264):
      ep:<val> e.g., ep:1
          (0): Baseline
          (1): Main
          (2): High
  Get Encoding Profile(only for H.264):
      gep
  Force IDR Frame on video Encoder(only for H.264):
      Enter 'f' 


bitrate = 4000000
Encoder Profile = High
Encoder control-rate = 1
Encoder EnableTwopassCBR = 0
Opening in BLOCKING MODE
Opening in BLOCKING MODE 
** Message: 11:16:36.147: <main:4670> iterating capture loop ....
NvMMLiteOpen : Block : BlockType = 4 
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4 
GST_ARGUS: Creating output stream
CONSUMER: Waiting until producer is connected...
GST_ARGUS: Available Sensor modes :
GST_ARGUS: 4624 x 3472 FR = 18.000000 fps Duration = 55555556 ; Analog Gain range min 1.000000, max 36.000000; Exposure Range min 34000, max 550385000;

GST_ARGUS: 4608 x 3456 FR = 18.000000 fps Duration = 55555556 ; Analog Gain range min 1.000000, max 36.000000; Exposure Range min 34000, max 550385000;

GST_ARGUS: 3840 x 3472 FR = 21.000000 fps Duration = 47619048 ; Analog Gain range min 1.000000, max 36.000000; Exposure Range min 34000, max 550385000;

GST_ARGUS: 3840 x 2160 FR = 36.000000 fps Duration = 27777778 ; Analog Gain range min 1.000000, max 36.000000; Exposure Range min 34000, max 550385000;

ARGUS_ERROR: Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, execute: 787 Frame Rate specified is greater than supported
GST_ARGUS: Running with following settings:
   Camera index = 0 
   Camera mode  = 0 
   Output Stream W = 4624 H = 3472 
   seconds to Run    = 0 
   Frame Rate = 18.000000 
GST_ARGUS: Setup Complete, Starting captures for 0 seconds
GST_ARGUS: Starting repeat capture requests.
CONSUMER: Producer has connected; continuing.
ARGUS_ERROR: Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, execute: 1007 InvalidState.
GST_ARGUS: Cleaning up
nvbuf_utils: dmabuf_fd -1 mapped entry NOT found
nvbuf_utils: Can not get HW buffer from FD... Exiting...
ERROR on bus: by /GstPipeline:capture_native_pipeline/GstBin:cap_bin/GstNvArgusCameraSrc:nvarguscamerasrc0: CANCELLED
debug info:
Argus Error Status

(nvgstcapture-1.0:8588): GStreamer-CRITICAL **: 11:16:36.984: gst_mini_object_set_qdata: assertion 'object != NULL' failed
** Message: 11:16:36.989: <main:4680> Capture completed
** Message: 11:16:36.989: <main:4729> Camera application will now exit
livsmed@livsmed-desktop:~/Documents$

It’s could be the frame rate report in device tree incorrect.
What the command shows v4l2-ctl -d /dev/video0 --list-formats-ext

This is v4l2-ctl -d /dev/video2 --list-formats-ext message.

livsmed@livsmed-desktop:~/Documents$ v4l2-ctl -d /dev/video2 --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
	Index       : 0
	Type        : Video Capture
	Pixel Format: 'RG10'
	Name        : 10-bit Bayer RGRG/GBGB
		Size: Discrete 4624x3472
			Interval: Discrete 0.056s (18.000 fps)
		Size: Discrete 4608x3456
			Interval: Discrete 0.056s (18.000 fps)
		Size: Discrete 3840x3472
			Interval: Discrete 0.048s (21.000 fps)
		Size: Discrete 3840x2160
			Interval: Discrete 0.033s (30.000 fps)

What’s the min_framerate in device tree. Modify it to try.

here is device tree codes.

i want to display streamming 4624x3472 18fps mode in nvgstcapture.

			mode0 {/*mode imx686_MODE_4624x3472_CROP_18FPS*/
				mclk_khz = "24000";
				num_lanes = "4";
				tegra_sinterface = "serial_e";
				phy_mode = "DPHY";
	
				discontinuous_clk = "no";
				dpcm_enable = "false";
				cil_settletime = "0";

				/*dynamic_pixel_bit_depth = "12";*/
				csi_pixel_bit_depth = "10";
				mode_type = "bayer";
				pixel_phase = "rggb";

				active_w = "4624";  
				active_h = "3472";  
				readout_orientation = "0";
				line_length = "13856"; 
				inherent_gain = "1";
				mclk_multiplier = "37.5";
				pix_clk_hz = "900000000";

				gain_factor = "1000000";
				min_gain_val = "1000000"; /* dB */
				max_gain_val = "36000000"; /* dB */
				step_gain_val = "1"; /* 0.3 */
				default_gain = "1000000";
				min_hdr_ratio = "";
				max_hdr_ratio = "";
				framerate_factor = "1000000";
				min_framerate = "16000000";
				max_framerate = "18000000";
				step_framerate = "1";
				default_framerate = "17000000";
				exposure_factor = "1000000";
				min_exp_time = "34"; /* us, 2 lines*/
				max_exp_time = "550385"; /* us */
				step_exp_time = "1";
				default_exp_time = "55555";/* us */
				embedded_metadata_height = "2";
			};

Could you try below configure.

				min_framerate = "4000000";
				default_framerate = "18000000";

As your recomend , i modified configure in device tree.

4624x3472 18fps : not working
4608x3456 18fps : not working
3840x3472 21fps : not working
3840x2160 30fps : working

i think it look like nvgstcapture only support frame rate control over 30fps .

what do you think about it?

Yes, your are right. You can download the source code of libgstnvarguscamerasrc.so(nvarguscamerasrc) to modify it.

You can also get source of nvgstcapture-1.0 to modify it.
And I will report to fix it in future release.

Have replace below libs at /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvarguscamerasrc.so by attached file to try.
libgstnvarguscamerasrc.so.txt (85.0 KB)

hello ShaneCCC,

As your recommend , i replaced libary file.
It works good!!!

Thank you very much.