LinuxCommandLibrary

rpicam-raw

Capture raw camera data on Raspberry Pi

TLDR

Capture a video for a specific amount of seconds

$ rpicam-raw [[-t|--timeout]] [2000] [[-o|--output]] [path/to/file.raw]
copy

Change video dimensions and framerate
$ rpicam-raw [[-t|--timeout]] [5000] --width [4056] --height [3040] [[-o|--output]] [path/to/file.raw] --framerate [8]
copy

SYNOPSIS

rpicam-raw [options] -o

PARAMETERS

-o, --output
    Specifies the output file for the raw image data. This option is mandatory.

-t, --timeout
    Sets the duration (in milliseconds) for the camera to run and capture. After this time, the application will exit.

--width
    Sets the desired width of the captured raw image in pixels.

--height
    Sets the desired height of the captured raw image in pixels.

--mode :::[P|S]
    Specifies the camera operating mode, defining resolution, bit depth, and packing (P for packed, S for unpacked/sparse).

--gain
    Sets the analogue gain of the sensor. Typically a floating-point value.

--exposure
    Sets the exposure time of the sensor in microseconds.

--tuning-file
    Specifies a custom tuning file to load for camera configuration, allowing advanced control over ISP (if used) and sensor parameters.

-n, --no-display
    Prevents the application from displaying a preview window on the screen.

--segment
    If capturing continuous raw data, this option causes the output to be split into new files every specified number of seconds. It works by adding a frame counter and timestamp to the output filename.

DESCRIPTION

rpicam-raw is a command-line utility for Raspberry Pi that enables the direct capture of raw sensor data from connected camera modules. Unlike rpicam-still or rpicam-vid, which typically apply in-camera Image Signal Processor (ISP) processing, rpicam-raw bypasses this processing, providing unprocessed sensor output. This makes it invaluable for applications requiring precise control over image data, such as scientific imaging, custom ISP development, computer vision research, or situations where post-processing algorithms are to be applied to the pristine sensor output.

It is built on the libcamera camera stack, offering a modern, modular, and performant interface to Raspberry Pi camera hardware. Users gain fine-grained control over various camera parameters, including exposure, gain, sensor mode, and output format. The raw data captured by rpicam-raw is typically provided in formats like DNG or a custom raw format, which often requires specialised software for viewing and processing.

CAVEATS

rpicam-raw requires a Raspberry Pi with a compatible camera module and the libcamera software stack installed. The output consists of raw sensor data, which is typically uncompressed and not directly viewable by standard image viewers without specialised post-processing. Users are expected to have knowledge of raw image formats and potentially their own processing pipelines to make use of the captured data.

OUTPUT FORMAT

The raw image data captured by rpicam-raw is typically saved in a proprietary raw format specific to the camera sensor, or occasionally in DNG (Digital Negative) format if supported by the camera and driver. These files contain the unprocessed Bayer array data, which requires demosaicing and other ISP steps to produce a viewable RGB image.

HISTORY

rpicam-raw is part of the new generation of Raspberry Pi camera tools built upon the libcamera framework, which began to replace the older 'MMAL' (Multi-Media Abstraction Layer) camera stack and its associated utilities (like raspistill and raspivid) around 2020-2021. The shift to libcamera was driven by the need for a modern, open-source, and standardised camera stack, allowing for greater flexibility and control over camera hardware. rpicam-raw specifically addresses the demand for direct access to sensor data, a feature that was less robust or more complex to achieve with the legacy tools.

SEE ALSO

rpicam-still(1), rpicam-vid(1), libcamera-still(1), libcamera-vid(1), v4l2-ctl(1)

Copied to clipboard