In version R35.3.1, I tried to use some commands to capture the camera data and save it as a jpg image

Hi NV:
Due to some need, I need to save the raw camera data as jpg pictures in Orin nano, I use the following command:

 gst-launch-1.0 -e nvarguscamerasrc sensor-id=1 num-buffers=4 ! "video/x-raw(memory:NVMM), width=(int)4056, height=(int)3040, format=(string)NV12" ! nvjpegenc ! multifilesink location=/home/nvidia/Pictures/imx577_${current_time}.jpg

When I execute this command every 2 seconds, I can’t capture an image in 2 seconds.


Therefore, I would like to ask if there is a more efficient instruction? Or how do I optimize my instructions? thank you.

hello FANYX,

may I have more details about your use-case?
you’ve assign buffer settings (i.e. num-buffers=4) to the gst pipeline, it’ll terminate after 4 buffers has captured.

When I set the buffer to less than 4, it will save to empty frames. Can you provide the command to save raw camera data as jpg picture?

hello FANYX,

is there any frame drops?
please refer to Camera Architecture Stack, you cannot dump raw by nvarguscamerasrc plugin as it’s already processed by ISP.

is your real use-case to capture raw and jpg file concurrently?
you may running with nvargus_nvraw utility,
for instance,
$ sudo nvargus_nvraw --c 0 --mode 0 --format "nvraw, jpg" --file /home/nvidia/output
please see-also developer guide, Argus NvRaw Tool for more details.

I don’t need it to be raw data, as long as I can save jpg images. When I use the following command to take a picture, I find that I cannot save the picture.

nvgstcapture-1.0 --sensor-id=1 --sensor-mode=0 -A -C 1 --capture-auto --image-res=12 --file-name=/home/nvidia/Pictrues/imx283

The following error occurs when the command is executed:

GST_ARGUS: Creating output stream
CONSUMER: Waiting until producer is connected...
GST_ARGUS: Available Sensor modes :
GST_ARGUS: 5496 x 3694 FR = 20.000000 fps Duration = 50000000 ; Analog Gain range min 1.000000, max 22.500000; Exposure Range min 3000000, max 40000000;

GST_ARGUS: 5496 x 3694 FR = 25.000000 fps Duration = 40000000 ; Analog Gain range min 1.000000, max 22.500000; Exposure Range min 3000000, max 40000000;

GST_ARGUS: 2748 x 1842 FR = 50.000000 fps Duration = 20000000 ; Analog Gain range min 1.000000, max 22.500000; Exposure Range min 1000000, max 20000000;

GST_ARGUS: 1832 x 1234 FR = 59.999999 fps Duration = 16666667 ; Analog Gain range min 1.000000, max 22.500000; Exposure Range min 3000000, max 16670000;

GST_ARGUS: 3872 x 2174 FR = 59.999999 fps Duration = 16666667 ; Analog Gain range min 1.000000, max 22.500000; Exposure Range min 1000000, max 16670000;

ARGUS_ERROR: Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, execute: 903 Frame Rate specified is greater than supported
GST_ARGUS: Running with following settings:
   Camera index = 1
   Camera mode  = 0
   Output Stream W = 5496 H = 3694
   seconds to Run    = 0
   Frame Rate = 20.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: 1139 InvalidState.
GST_ARGUS: Cleaning up
nvbuf_utils: dmabuf_fd -1 mapped entry NOT found

In addition, after loading the driver, you can preview normally. Is this due to the excessive resolution of the camera, or is it due to the improper configuration of the driver? Thank you very much for your help.

hello FANYX,

here’s error reported.

you may try running with nvarguscamerasrc instead.

So how should I use nvarguscamerasrc to save jpg images?

So what causes this problem?

hello FANYX,

here’s sample pipeline for your reference,
please note that you should given "-e" flag for it sending an EoS at shutdown, to ensure correct file writing.
for instance,
$ gst-launch-1.0 -e nvarguscamerasrc num-buffers=1 ! "video/x-raw(memory:NVMM), width=(int)5496, height=(int)3694, framerate=20/1" ! nvvidconv ! jpegenc ! filesink location=capture0.jpeg

this is error for DMA buffer allocation failed, which is caused by Argus receive an error of stream setup.

After executing the above command, the following error occurs:

it looks like you don’t have permission for writing file to this path. please try another folder.

After I changed the path, it still didn’t work.

hello FANYX,

had you valid this sensor stream?
please try below to disable preview and shows frame-rate only for checking.
$ gst-launch-1.0 nvarguscamerasrc sensor-id=0 ! 'video/x-raw(memory:NVMM), width=(int)5496, height=(int)3694, framerate=20/1, format=NV12' ! nvvidconv ! 'video/x-raw(memory:NVMM),format=I420' ! fpsdisplaysink text-overlay=0 video-sink=fakesink sync=0 -v -e

When I execute the above command, the message printed is as follows:

Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0/GstFakeSink:fakesink0: sync = false
Setting pipeline to PLAYING ...
New clock: GstSystemClock
/GstPipeline:pipeline0/GstNvArgusCameraSrc:nvarguscamerasrc0.GstPad:src: caps = video/x-raw(memory:NVMM), width=(int)5496, height=(int)3694, format=(string)NV12, framerate=(fraction)20/1
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-raw(memory:NVMM), width=(int)5496, height=(int)3694, format=(string)NV12, framerate=(fraction)20/1
/GstPipeline:pipeline0/Gstnvvconv:nvvconv0.GstPad:src: caps = video/x-raw(memory:NVMM), width=(int)5496, height=(int)3694, framerate=(fraction)20/1, format=(string)I420
/GstPipeline:pipeline0/GstCapsFilter:capsfilter1.GstPad:src: caps = video/x-raw(memory:NVMM), width=(int)5496, height=(int)3694, framerate=(fraction)20/1, format=(string)I420
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0.GstGhostPad:sink.GstProxyPad:proxypad0: caps = video/x-raw(memory:NVMM), width=(int)5496, height=(int)3694, framerate=(fraction)20/1, format=(string)I420
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0/GstFakeSink:fakesink0.GstPad:sink: caps = video/x-raw(memory:NVMM), width=(int)5496, height=(int)3694, framerate=(fraction)20/1, format=(string)I420
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0.GstGhostPad:sink: caps = video/x-raw(memory:NVMM), width=(int)5496, height=(int)3694, framerate=(fraction)20/1, format=(string)I420
/GstPipeline:pipeline0/GstCapsFilter:capsfilter1.GstPad:sink: caps = video/x-raw(memory:NVMM), width=(int)5496, height=(int)3694, framerate=(fraction)20/1, format=(string)I420
/GstPipeline:pipeline0/Gstnvvconv:nvvconv0.GstPad:sink: caps = video/x-raw(memory:NVMM), width=(int)5496, height=(int)3694, format=(string)NV12, framerate=(fraction)20/1
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = video/x-raw(memory:NVMM), width=(int)5496, height=(int)3694, format=(string)NV12, framerate=(fraction)20/1
GST_ARGUS: Creating output stream
CONSUMER: Waiting until producer is connected...
GST_ARGUS: Available Sensor modes :
GST_ARGUS: 5496 x 3694 FR = 20.000000 fps Duration = 50000000 ; Analog Gain range min 1.000000, max 22.500000; Exposure Range min 3000000, max 40000000;

GST_ARGUS: 5496 x 3694 FR = 25.000000 fps Duration = 40000000 ; Analog Gain range min 1.000000, max 22.500000; Exposure Range min 3000000, max 40000000;

GST_ARGUS: 2748 x 1842 FR = 50.000000 fps Duration = 20000000 ; Analog Gain range min 1.000000, max 22.500000; Exposure Range min 1000000, max 20000000;

GST_ARGUS: 1832 x 1234 FR = 59.999999 fps Duration = 16666667 ; Analog Gain range min 1.000000, max 22.500000; Exposure Range min 3000000, max 16670000;

GST_ARGUS: 3872 x 2174 FR = 59.999999 fps Duration = 16666667 ; Analog Gain range min 1.000000, max 22.500000; Exposure Range min 1000000, max 16670000;

GST_ARGUS: Running with following settings:
   Camera index = 1 
   Camera mode  = 1 
   Output Stream W = 5496 H = 3694 
   seconds to Run    = 0 
   Frame Rate = 25.000000 
GST_ARGUS: Setup Complete, Starting captures for 0 seconds
GST_ARGUS: Starting repeat capture requests.
CONSUMER: Producer has connected; continuing.
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0/GstFakeSink:fakesink0: sync = false
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 15, dropped: 0, current: 29.19, average: 29.19
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 28, dropped: 0, current: 25.05, average: 27.11
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 41, dropped: 0, current: 25.09, average: 26.44
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 54, dropped: 0, current: 24.83, average: 26.03
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 67, dropped: 0, current: 25.10, average: 25.85
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 80, dropped: 0, current: 25.04, average: 25.71
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 93, dropped: 0, current: 24.91, average: 25.60
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 106, dropped: 0, current: 25.00, average: 25.52
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 119, dropped: 0, current: 25.05, average: 25.47
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 132, dropped: 0, current: 24.94, average: 25.42
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 145, dropped: 0, current: 24.97, average: 25.38
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 158, dropped: 0, current: 24.99, average: 25.34
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 171, dropped: 0, current: 25.02, average: 25.32
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 184, dropped: 0, current: 24.95, average: 25.29
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 197, dropped: 0, current: 25.10, average: 25.28
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 210, dropped: 0, current: 25.04, average: 25.27
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 223, dropped: 0, current: 25.02, average: 25.25
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 236, dropped: 0, current: 24.93, average: 25.23
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 249, dropped: 0, current: 25.01, average: 25.22
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 262, dropped: 0, current: 25.00, average: 25.21
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 275, dropped: 0, current: 25.04, average: 25.20
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 288, dropped: 0, current: 25.06, average: 25.20
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 301, dropped: 0, current: 24.89, average: 25.18
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 314, dropped: 0, current: 24.99, average: 25.17
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 327, dropped: 0, current: 24.96, average: 25.17
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 340, dropped: 0, current: 24.95, average: 25.16
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 353, dropped: 0, current: 25.16, average: 25.16
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 366, dropped: 0, current: 24.92, average: 25.15
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 379, dropped: 0, current: 25.08, average: 25.15
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 392, dropped: 0, current: 24.99, average: 25.14
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 405, dropped: 0, current: 24.90, average: 25.13
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 418, dropped: 0, current: 25.04, average: 25.13
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 431, dropped: 0, current: 25.04, average: 25.13
^Chandling interrupt.
Interrupt: Stopping pipeline ...
EOS on shutdown enabled -- Forcing EOS on the pipeline
Waiting for EOS...
Got EOS from element "pipeline0".
EOS received - stopping pipeline...
Execution ended after 0:00:18.296177659
Setting pipeline to NULL ...
GST_ARGUS: Cleaning up
CONSUMER: Done Success
GST_ARGUS: Done Success
Freeing pipeline ...


hello FANYX,

it means your sensor stream is functional, your JPG capture fail might due to encoder side.
please try adding video converter to downscale image size for saving to filesystem,
$ gst-launch-1.0 nvarguscamerasrc sensor-id=0 sensor-mode=0 num-buffers=10 ! 'video/x-raw(memory:NVMM), width=(int)5496, height=(int)3694, framerate=20/1, format=NV12' ! nvvidconv ! 'video/x-raw, format=(string)I420, width=640, height=480' ! jpegenc ! multifilesink location=~/Desktop/capture%d.jpeg -e

please do check developer guide for some sample pipelines.
for instance, Capturing with GStreamer-1.0.

It can be saved after compression, but I want to know the maximum resolution that can save the picture. Because I keep the complete data.

Hi,
Orin Nano does no thave hardware encoders, so please use software encoder jpegenc plugin. 5120x3840 should be good for software encoder.

thanks!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.