Commands for camera

Hi Team,

I want to capture the CSI data from the camera sensor and store it in a file (raw data).
I am using the following command for sensor preview.
$ gst-launch-1.0 nvarguscamerasrc sensor_id=0 ! ‘video/x-raw(memory:NVMM),width=3820, height=2464, framerate=21/1,format=NV12’ ! nvvidconv flip-method=0 ! ‘video/x-raw,width=960,height=616’ ! nvvidconv ! nvegltransform ! nveglglessink -e

Can I use the same nvarguscamerasrc command to store the raw data in a file or I need to follow some other procedure?

Thanks,
Ajith.

hello ajith.kumaresh,

please refer to Camera Architecture Stack, you’ll need to bypass ISP to dump Raw data.
here’s Applications Using V4L2 IOCTL Directly it uses V4L2 IOCTL to verify basic functionality during sensor bring-up.
thanks

1 Like

Hi @JerryChang

Can I use the Applications Using GStreamer with V4L2 Source Plugin procedure to capture the raw data from the sensor and bypass the ISP processing or I should use the direct v4l2 ioctl method only ?

Thanks,
Ajith.

hello ajith.kumaresh,

no, v4l2src doesn’t support with bayer sensors.

You may use gstreamer for saving to file.
Before trying, be aware that saving raw video can fill your filesystem very quickly, so I’ll limit the number of frames to 100 in the following examples in order to prevent problems, but be sure you have at least 9 GB free on the filesystem you will record to with:

df -H -T

So you may record 100 raw (NV12) frames with:

gst-launch-1.0 -e nvarguscamerasrc num-buffers=100 ! 'video/x-raw(memory:NVMM),width=3820, height=2464, framerate=21/1,format=NV12' ! nvvidconv ! video/x-raw,width=960,height=616 ! filesink location=test.NV12

Be aware that first frames may be dark, or else, argus takes some time to auto adjust everything.

If you want to save individual frames into jpg, you can also try (here limiting to 10 files so keeping frames 90 to 99:

gst-launch-1.0 -e nvarguscamerasrc num-buffers=100 ! 'video/x-raw(memory:NVMM),width=3820, height=2464, framerate=21/1,format=NV12' ! nvvidconv ! video/x-raw,width=960,height=616 ! multifilesink location=test_%05d.jpg max-files=10

If you don’t look for high quality video, you may encode into H264 video (this would save storage space by compressing more than JPG) and save into mp4 container file:

gst-launch-1.0 -e nvarguscamerasrc num-buffers=100 ! 'video/x-raw(memory:NVMM),width=3820, height=2464, framerate=21/1,format=NV12' ! nvvidconv ! 'video/x-raw(memory:NVMM),width=960,height=616' ! nvv4l2h264enc insert-vui=1 ! h264parse ! qtmux ! filesink location=test.mp4