Environment variables for the agent

You can use environment variables to control Formant agent behavior by editing the following .bashrc file:

/var/lib/formant/.bashrc

The formant user which runs the formant-agent process sources /var/lib/formant/.bashrc before running the agent process.

This guide will outline the list of available environment variables, their default values, and their usage.

📘

If the default value for an environment variable is empty, this variable has no effect until you set a value.

❗️

Restart the agent for changes to take effect

Please make sure to restart the agent (systemctl restart formant-agent for native installations) for any changes to environment variables to take effect.

For more information, see Installing the Formant agent: Starting and stopping the agent.

ROS environment variables

NameDefault valueDescription
ROS_MASTER_URIhttp://localhost:11311The address of the ROS master to which the Formant ROS Bridge connects.
CATKIN_WSThe path to the root of the catkin workspace. The Formant agent uses this to find custom ROS message definitions.
SOURCE_SCRIPTIf the ROS setup files are not in <catkin_ws>/devel/setup.bash, the custom location of ROS setup script.
FORMANT_AGENT_PYTHON_PATHpythonThe file location of the Python interpreter used by the tf2 bridge.
FORMANT_OVERRIDE_TIMESTAMPfalseEnables replacement of timestamps on ROS messages with the current time.

General environment variables

NameDefault valueDescription
FORMANT_AGENT_GRPC_PORT5501The port where the Formant Agent will expose the gRPC interface.
FORMANT_AGENT_GRPC_UNIX_SOCKET/var/lib/formant/agent.sockThe Unix Socket where the Formant Agent will start its server.
FORMANT_AGENT_HTTP_PORT5502The port where the Formant Agent will expose the HTTP interface.
FORMANT_AGENT_IPlocalhostThe IP address where the Formant Agent will start it's server.
FORMANT_AGENT_PYTHON3_PATHpython3The file location of the python3 interpreter used by the ROS bridge and media encoder.
FORMANT_AGENT_SERVER_CERTFile location of the TLS cert.
FORMANT_AGENT_SERVER_KEYFile location of the TLS key
FORMANT_DEBUGfalseEnables debug logs.
FORMANT_DISABLE_PYTHONfalseDisables all python subprocesses for the agent. This includes the media encoder, ROS bridge, and ROS TF bridge. Since the media encoder is a python subprocess, disabling python will disable all video and audio encoding.
FORMANT_DISABLE_STANDARD_HOST_METRICSfalseDisables the automatic collection and ingestion of default telemetry streams, such as CPU, memory, and IP-based location.
FORMANT_DISABLE_SYSINFOfalseDisables system information collection. (Used for NVIDIA containers).
FORMANT_DISABLE_TEGRA_STATSfalseDisables the automatic collection and ingestion of default telemetry streams specific to Tegra systems. Jetson products (Nano, Xavier, etc.) are Tegra systems.
FORMANT_DISABLE_TERMINALfalseDisables the web terminal feature that allows users to run a shell through the agent.
FORMANT_MEMORY_STATSfalseUsed to monitor ROS 1 bridge performance.

If FORMANT_PYTHON_GC_COLLECT is set to force, and this variable is set to true, garbage collection statistics from the ROS 1 bridge will be printed in the Formant agent log.
FORMANT_NAMEName of the Formant Agent, used to override Agent name during provisioning.
FORMANT_POLL_FILE_TAILINGWhen FORMANT_POLL_FILE_TAILING is set to true, file tail streams will ingest from any file with the file name specified, even if the original file is renamed and a new file is created with the same name.

When FORMANT_POLL_FILE_TAILING is set to false, file tail streams will follow the original file specified, even if it is later renamed.
FORMANT_PORT_FORWARDINGtrueEnables the local port forwarding feature.
FORMANT_PROVISIONING_TOKENFormant provisioning token used to provision an agent.
FORMANT_PYTHON_GC_COLLECTforceWhen set to force, ROS 1 bridge will run a Python garbage collection routine at the interval set by FORMANT_PYTHON_GC_INTERVAL.

When set to auto, the Python garbage collector will run automatically according to its own parameters.

If FORMANT_MEMORY_STATS is set to true, statistics from this process will be printed to the Formant agent log.
FORMANT_PYTHON_GC_INTERVAL600If FORMANT_PYTHON_GC_COLLECT is set to true, ROS 1 bridge will run a Python garbage collection routine at this interval (seconds).
FORMANT_TERMINAL_BUFFER_SIZE40000Size in bytes of the terminal buffer.
FORMANT_UPLOAD_DEBUG_OUTPUTfalseEnables the uploading of debug logs when the environment is not production.
STALE_MESSAGE_MSTimeout for teleoperation messages. Messages which are older than the timeout are deemed 'stale' and disregarded.

For example, if you set STALE_MESSAGE_MS to 10, but have a ping of 50 ms to your device, all messages will be thrown out, because they will be older than the 10 ms limit.
WEBRTC_INTERFACEN/ASet the network interface to connect via webRTC

Media environment variables

FORMANT_ACCELERATED_VIDEO_ENCODINGtrueEnables jetson hardware accelerated encoding of video.
FORMANT_ACCELERATED_ENCODE_SPEED_PRESET1The speed-preset for Jetson hardware-accelerated video encoding. Values are in the range [0,4].
FORMANT_ALLOW_H264_SOURCEfalseIf other pixel formats do not work well, allow H264 to also be chosen. This will be true if FORMANT_PREFER_H264_SOURCE is also true.
FORMANT_AUDIO_BITRATE96kDesired bitrate of uploaded audio.
FORMANT_AUDIO_NUM_CHANNELS1Number of channels of the audio device.
FORMANT_AUDIO_USE_FILTERtrueUse anlmdn filter on audio to reduce noise.
FORMANT_AUDIO_SAMPLE_FORMATs16leSample format of the audio device.
FORMANT_AUDIO_SAMPLE_RATE16000Sample rate of audio device's signal.
FORMANT_DISABLE_RESIZE_VIDEOfalseDisable Formant agent resizing the aspect ratio of the video.
FORMANT_ENABLE_ADAPTIVE_BITRATEtrueAllow Formant to automatically reduce the video bitrate if network degradation is detected during teleoperation. Note: this will also affect encoding for telemetry streams.
FORMANT_ENABLE_ENCODER_STATSfalseAdds encoder statistics to Formant agent logs.

Experimental feature.
FORMANT_ENCODE_SPEED_PRESET"ultrafast"Set the quality/speed tradeoff with GStreamer speed preset (corresponds to the enum GstX264EncPreset).

Options from fastest (least CPU time) to slowest (highest quality):
"ultrafast"
"superfast"
"veryfast"
"faster"
"fast"
"medium"
"slow"
"slower"
"veryslow"
FORMANT_ENCODING_BITRATE512Overrides the bitrate (Kbps) of all agent-encoded video streams.
FORMANT_ENCODING_BUFFER_SIZE30Set the Video Buffering Verifier buffer size in milliseconds.

This is used to control the maximum bitrate that the encoder can produce at any given time. The default of 30 milliseconds favors a stricter control suitable for high bitrate and framerate. Shorter buffer times may allow for more consistent throughput, while being more vulnerable to network spikes.
FORMANT_FLV_DECODEtrueDecode RTMP stream as FLV (Turn off if RTMP stream isn't working, usually because it has an audio stream).
FORMANT_FORCE_ACCELERATED_VIDEO_ENCODINGfalseIf the Jetson accelerated encoder crashes, the Formant agent will turn it off. Set this to true to prevent this and keep retrying with acceleration.
FORMANT_FORCE_ALLOW_PICAMfalseEnable use of Picam on Raspberry Pi or Jetson
FORMANT_FRAMERATE_CAP24Formant's encoder will not output frames at a rate higher than the frame rate cap.

If the hardware source is greater than this value, Formant will re-encode it to this value.
FORMANT_GST_INFOfalseEnable log info for GStreamer.
FORMANT_KEY_FRAME_INTERVAL10Interval in frames at which the encoder should insert full frames into output video.

If you are experiencing blocky or glitchy video, consider decreasing this interval. This will transmit full frames more frequently. This may increase data consumption.
FORMANT_LOW_BANDWIDTH_BITRATE64Bitrate to set video to when low bandwidth mode is enabled.
FORMANT_OVERRIDE_AUDIO_CONFIGURATIONfalseOverride audio configuration with provided values.
FORMANT_OVERRIDE_BITRATEfalseOverride video bitrate from configuration.
FORMANT_PREFER_H264_SOURCEfalseReceive h264 video directly from hardware camera if offered.
FORMANT_PREFER_MJPGfalsePrefer the MJPG hardware video stream, if there is one. Typically, MJPG will be the last choice.
FORMANT_RTSP_BUFFER_LENGTH0Length in ms of RTSP buffer. Increase this to add stability to RTSP video (at cost of latency).
FORMANT_RTSP_PROTOCOLS'"udp+tcp"'Protocol for RTSP stream. Choose udp, tcp or udp+tcp.
FORMANT_TARGET_FRAMERATE30Target framerate for hardware video streams.
FORMANT_USE_RTP_JITTER_BUFFERfalseEnables use of jitter buffer (debug only).
FORMANT_VIDEO_FRAMERATE24Assumed framerate of video, if framerate cannot be determined from source.
FORMANT_VIDEO_GST_STRING" ! clockoverlay"Overlay a timestamp and other GStreamer strings on your video stream
FORMANT_VIDEO_PASS0 (or "cbr")Sets the 'rate control' of the video encoder. Corresponds to the enum "GstX264EncPass".

If it is "cbr", "pass1", "pass2", or "pass3", then the bitrate that is specified (either by FORMANT_OVERRIDE_BITRATE or by Formant) will be the target bitrate. See this page for more details.
FORMANT_VIDEO_QUANTIZER21If using "quant" (4) or "qual" (5) above, then this will be the parameter passed to the quantizer. See the documentation here for more details.
FORMANT_X264ENC_PARAMS''Override Formant's standard x264enc encoder parameters.

Refer to x264enc documentation .

See also

👋

If you notice an issue with this page or need help, please reach out to us! Use the 'Did this page help you?' buttons below, or get in contact with our Customer Success team via the Intercom messenger in the bottom-right corner of this page, or at [email protected].