Video options

The command line options specified in this section apply only to video output.

To pass one of the following options to an application, prefix the option name with --. If the option requires a value, pass the value immediately after the option name, separated by a single space. If the value contains a space, surround the value in quotes.

Some options have shorthand aliases, for example -h instead of --help. Use these shorthand aliases instead of the full option name to save space and time at the expense of readability.

quality

Alias: -q

Default value: 50

Accepts an MJPEG quality level between 1 and 100. Only applies to videos encoded in the MJPEG format.

bitrate

Alias: -b

Controls the target bitrate used by the H.264 encoder in bits per second. Only applies to videos encoded in the H.264 format. Impacts the size of the output video.

Example: rpicam-vid -b 10000000 --width 1920 --height 1080 -o test.h264

intra

Alias: -g

Default value: 60

Sets the frequency of Iframes (intra frames) in the H.264 bitstream. Accepts a number of frames. Only applies to videos encoded in the H.264 format.

profile

Sets the H.264 profile. Accepts the following values:

  • baseline

  • main

  • high

Only applies to videos encoded in the H.264 format.

level

Sets the H.264 level. Accepts the following values:

  • 4

  • 4.1

  • 4.2

Only applies to videos encoded in the H.264 format.

codec

Sets the encoder to use for video output. Accepts the following values:

  • h264 – use H.264 encoder (the default)

  • mjpeg – use MJPEG encoder

  • yuv420 – output uncompressed YUV420 frames.

  • libav – use the libav backend to encode audio and video (for more information, see libav)

save-pts

Raspberry Pi 5 does not support the save-pts option. Use libav to automatically generate timestamps for container formats instead.

Enables frame timestamp output, which allow you to convert the bitstream into a container format using a tool like mkvmerge. Accepts a plaintext file name for the timestamp output file.

Example: rpicam-vid -o test.h264 --save-pts timestamps.txt

You can then use the following command to generate an MKV container file from the bitstream and timestamps file:

$ mkvmerge -o test.mkv --timecodes 0:timestamps.txt test.h264

keypress

Alias: -k

Allows the CLI to enable and disable video output using the Enter key. Always starts in the recording state unless specified otherwise with initial. Type the x key and press Enter to exit. Does not accept a value.

signal

Alias: -s

Allows the CLI to enable and disable video output using SIGUSR1. Use SIGUSR2 to exit. Always starts in the recording state unless specified otherwise with initial. Does not accept a value.

initial

Default value: record

Specifies whether to start the application with video output enabled or disabled. Accepts the following values:

  • record: Starts with video output enabled.

  • pause: Starts with video output disabled.

Use this option with either keypress or signal to toggle between the two states.

split

When toggling recording with keypress or signal, writes the video output from separate recording sessions into separate files. Does not accept a value. Unless combined with output to specify unique names for each file, overwrites each time it writes a file.

segment

Cuts video output into multiple files of the passed duration. Accepts a duration in milliseconds. If passed a very small duration (for instance, 1), records each frame to a separate output file to simulate burst capture.

You can specify separate filenames for each file using string formatting, for example, --output test%04d.h264.

circular

Default value: 4

Writes video recording into a circular buffer in memory. When the application quits, records the circular buffer to disk. Accepts an optional size in megabytes.

inline

Writes a sequence header in every Iframe (intra frame). This can help clients decode the video sequence from any point in the video, instead of just the beginning. Recommended with segment, split, circular, and streaming options.

Only applies to videos encoded in the H.264 format. Does not accept a value.

listen

Waits for an incoming client connection before encoding video. Intended for network streaming over TCP/IP. Does not accept a value.

frames

Records exactly the specified number of frames. Any non-zero value overrides timeout. Accepts a non-zero integer.

framerate

Records exactly the specified framerate. Accepts a non-zero integer.

low-latency

On a Raspberry Pi 5, the --low-latency option reduces the encoding latency, which might be beneficial for real-time streaming applications, in return for (slightly) less good coding efficiency (for example, B frames and arithmetic coding will no longer be used).

sync

Run the camera in software synchronisation mode, where multiple cameras synchronise frames to the same moment in time. The sync mode can be set to either client or server. For more information, see how software synchronisation works.