### start () Source: https://docs.nvidia.com/metropolis/deepstream/9.1/sdk-api/classgstnvinferserver_1_1GstNvInferServerImpl.html Starts the inference server by reading configuration and setting up processing context. ```APIDOC ## NvDsInferStatus start () ### Description Reads the configuration file and sets up processing context. ### Returns - **NvDsInferStatus** - Status of the start operation. ``` -------------------------------- ### Example 1: Video data transfer with nvdsucxserversink and nvdsucxclientsrc Source: https://docs.nvidia.com/metropolis/deepstream/9.1/text/DS_plugin_gst-nvdsucx.html Example 1: server and client pipelines for sending video data over RDMA using nvdsucxserversink and nvdsucxclientsrc. Start the server program before the client program. ```bash gst-launch-1.0 uridecodebin uri="file:///sample_1080p.mp4" async-handling=1 name=src1 src1. ! \ queue ! nvvideoconvert ! 'video/x-raw(memory:NVMM),format=NV12,width=1920,height=1080' ! \ nvdsucxserversink addr=192.168.100.1 port=4000 buf-type=nvdsucx-buf-video ``` ```bash gst-launch-1.0 nvdsucxclientsrc addr=192.168.100.1 port=4000 nvbuf-memory-type=2 num-nvbuf=4 buf-type=nvdsucx-buf-video ! \ 'video/x-raw(memory:NVMM),format=NV12,width=1920,height=1080,framerate=30/1' ! \ queue ! nvvideoconvert ! nvv4l2h264enc ! h264parse ! qtmux name=mux_0 ! \ filesink sync=1 async=0 qos=0 location=~/out_1080p.mp4 ``` -------------------------------- ### mg_start2 Source: https://docs.nvidia.com/metropolis/deepstream/9.1/sdk-api/sources_2includes_2civetweb_8h.html Initializes and starts a new server context with the given configuration. ```APIDOC ## mg_start2 ### Description Starts a CivetWeb server context with initialization data. ### Function Signature ```c CIVETWEB_API struct mg_context *mg_start2(struct mg_init_data *init, struct mg_error_data *error); ``` ### Parameters - **init** (struct mg_init_data*) - Initialization data structure. - **error** (struct mg_error_data*) - Structure to receive error information on failure. ### Return Value Returns a pointer to the new context, or NULL on failure. ``` -------------------------------- ### Get startup info with curl GET Source: https://docs.nvidia.com/metropolis/deepstream/9.1/text/DS_RestServer.html Gets startup info. The endpoint can be /api/v1/startup or /startup. The response indicates whether the service has started. ```bash curl -XGET 'http://localhost:9000/api/v1/startup' OR curl -XGET 'http://localhost:9000/startup' ``` ```json { "startup-info" : { "ds-startup" : "YES" }, "reason" : "GET_STARTUP_INFO_SUCCESS", "status" : "HTTP/1.1 200 OK" } ``` -------------------------------- ### Start Kafka server and create topic Source: https://docs.nvidia.com/metropolis/deepstream/9.1/text/DS_3D_MultiModal_Lidar_Camera_BEVFusion.html Starts a Kafka server on port 9092 and creates the 'quick-test' topic for messaging tests. Requires Kafka Quick Start setup. ```bash $ docker run -p 9092:9092 apache/kafka:3.7.0 # start kafka server with port 9092 $ bin/kafka-topics.sh --create --topic quick-test --bootstrap-server localhost:9092 # creat topic 'quick-test' ``` -------------------------------- ### Download and setup sample data Source: https://docs.nvidia.com/metropolis/deepstream/9.1/text/Pipetuner-guide.html Unzip the sample file and run setup.sh to prepare sample data. Choose either 'deepstream' or 'metropolis' based on your usage; run only one of the two commands. ```bash $ unzip pipe-tuner-sample.zip $ cd pipe-tuner-sample/scripts $ # DeepStream or Metropolis Microservices users should run only one of the following two commands based on their usage $ bash setup.sh deepstream # DeepStream users $ bash setup.sh metropolis # Metropolis Microservices users ``` -------------------------------- ### Start and wait for a video player pipeline with pyservicemaker Source: https://docs.nvidia.com/metropolis/deepstream/9.1/text/DS_service_maker_python_quick_start.html Equivalent to the previous example but uses Pipeline.start() and Pipeline.wait() instead of invoking the flow with '()'. This approach explicitly starts the pipeline and waits for it to finish. ```python from pyservicemaker import Pipeline, Flow pipeline = Pipeline("playback") video_file = "/opt/nvidia/deepstream/deepstream/samples/streams/sample_1080p_h264.mp4" Flow(pipeline).capture([video_file]).render() pipeline.start() pipeline.wait() ``` -------------------------------- ### Example: run mosquitto with default config Source: https://docs.nvidia.com/metropolis/deepstream/9.1/text/DS_plugin_gst-nvmsgbroker.html Example of running mosquitto with the default configuration file located at /etc/mosquitto/mosquitto.conf. ```bash mosquitto -c /etc/mosquitto/mosquitto.conf ``` -------------------------------- ### REDIS adapter configuration example Source: https://docs.nvidia.com/metropolis/deepstream/9.1/text/DS_plugin_gst-nvmsgbroker.html Example configuration file entries for a REDIS protocol adapter, placed in a custom configuration file such as cfg_redis.txt. Adjust values for your redis server setup. ```ini [message-broker] hostname=localhost port=6379 password=password payloadkey=metadata consumergroup=mygroup consumername=myname streamsize=10000 ``` -------------------------------- ### Start DeepStream Container with X11 and GPU Source: https://docs.nvidia.com/metropolis/deepstream/9.1/text/DS_on_WSL2.html Installs X11 utilities, enables X server access, and starts the DeepStream container with GPU, display, and audio support. The bind-mount destinations are for an x86_64 WSL2 host. ```bash sudo apt install x11-xserver-utils xhost + sudo docker run -it --privileged --rm --name=docker --net=host --gpus all -e DISPLAY=$DISPLAY -e CUDA_CACHE_DISABLE=0 -e NVIDIA_DRIVER_CAPABILITIES=all --device /dev/snd -v /tmp/.X11-unix/:/tmp/.X11-unix -v /usr/lib/wsl/lib/libnvcuvid.so.1:/usr/lib/x86_64-linux-gnu/libnvcuvid.so.1:ro -v /usr/lib/wsl/lib/libnvidia-encode.so.1:/usr/lib/x86_64-linux-gnu/libnvidia-encode.so.1:ro nvcr.io/nvidia/deepstream:9.1-triton-multiarch ``` -------------------------------- ### Gst-nvmsgbroker configuration file example Source: https://docs.nvidia.com/metropolis/deepstream/9.1/text/DS_plugin_gst-nvmsgbroker.html Example configuration file in gkey format with [message-broker] group, proto-cfg, consumer-group-id, and partition-key settings. ```ini [message-broker] proto-cfg="message.timeout.ms=2000;retries=5" consumer-group-id = groupid partition-key = keyid ``` -------------------------------- ### mg_start Source: https://docs.nvidia.com/metropolis/deepstream/9.1/sdk-api/sources_2includes_2civetweb_8h_source.html Starts the web server with the given callbacks and configuration options. It initializes the server context and returns a handle for further operations. ```APIDOC ## mg_start ### Description Starts the web server with the given callbacks and configuration options. It initializes the server context and returns a handle for further operations. ### Method Function call ### Endpoint `struct mg_context *mg_start(const struct mg_callbacks *callbacks, void *user_data, const char **configuration_options)` ### Parameters - **callbacks** (struct mg_callbacks*) - Required - User-defined callbacks structure. - **user_data** (void*) - Required - User data pointer passed to callbacks. - **configuration_options** (const char**) - Required - NULL terminated list of option_name, option_value pairs. ### Return Value - **struct mg_context*** - Web server context, or NULL on error. ### Example ```c const char *options[] = { "document_root", "/var/www", "listening_ports", "80,443s", NULL }; struct mg_context *ctx = mg_start(&my_func, NULL, options); ``` ``` -------------------------------- ### install (std::function< void(Pipeline &, int key)> keyboard_listener) Source: https://docs.nvidia.com/metropolis/deepstream/9.1/sdk-api/classdeepstream_1_1Pipeline.html Install a callback to capture keyboard events. ```APIDOC ## Pipeline & install (std::function< void(Pipeline &, int key)> keyboard_listener) ### Description Install a callback to capture keyboard events. ### Method install ### Parameters - **keyboard_listener** (std::function) - Required - Callback function for keyboard events. ### Returns Reference to the Pipeline object. ``` -------------------------------- ### size_t getBufOffset(uint32_t batchIdx) const override Source: https://docs.nvidia.com/metropolis/deepstream/9.1/sdk-api/classnvdsinferserver_1_1BaseBatchBuffer.html Gets the offset from start of the memory allocation to the buffer pointer. ```APIDOC ## size_t getBufOffset(uint32_t batchIdx) const override ### Description Gets the offset from start of the memory allocation to the buffer pointer. ### Method getBufOffset ### Parameters - **batchIdx** (uint32_t) - The batch index. ### Returns - **size_t** - The offset in bytes. ``` -------------------------------- ### getBufOffset() Source: https://docs.nvidia.com/metropolis/deepstream/9.1/sdk-api/classnvdsinferserver_1_1BaseBatchBuffer.html Gets the offset from the start of the memory allocation to the buffer pointer. Needed for sharing CUDA memory with Triton server. ```APIDOC ## getBufOffset() ### Description Gets the offset from the start of the memory allocation to the buffer pointer. Needed for sharing CUDA memory with Triton server. ### Method `size_t getBufOffset(uint32_t _batchIdx_) const` ### Parameters - **_batchIdx_** (uint32_t) - Required - The batch index for which to get the offset. ### Returns - **size_t** - The offset from the start of the memory allocation to the buffer pointer. ### Implementation Details - Implements `nvdsinferserver::IBatchBuffer::getBufOffset`. - Reimplemented in `nvdsinferserver::RefBatchBuffer`, `nvdsinferserver::BatchSurfaceBuffer`, and `nvdsinferserver::SurfaceBuffer`. - Defined at line 105 of `infer_batch_buffer.h`. ``` -------------------------------- ### Pipeline::install Source: https://docs.nvidia.com/metropolis/deepstream/9.1/sdk-api/9_81_2service-maker_2includes_2pipeline_8hpp_source.html Installs a keyboard listener callback. ```APIDOC ## Pipeline::install ### Description Installs a keyboard listener callback that will be invoked when a key is pressed while the pipeline is running. ### Method `Pipeline& install(std::function keyboard_listener)` ### Parameters - **keyboard_listener** (std::function) - Required - Callback function that receives the pipeline reference and the key code. ### Returns - **Pipeline&** - Reference to the Pipeline object for chaining. ### Example ```cpp pipeline.install([](Pipeline& p, int key) { /* handle key */ }); ``` ``` -------------------------------- ### getBufOffset(uint32_t _batchIdx_) const Source: https://docs.nvidia.com/metropolis/deepstream/9.1/sdk-api/classnvdsinferserver_1_1SurfaceBuffer.html Gets the offset from the start of the memory allocation to the buffer pointer for a given batch index. Needed for sharing CUDA memory with Triton server. ```APIDOC ## getBufOffset(uint32_t _batchIdx_) const ### Description Gets the offset from the start of the memory allocation to the buffer pointer for the specified batch index. This is needed for sharing CUDA memory with Triton server. ### Method `size_t getBufOffset(uint32_t _batchIdx_) const` ### Parameters - `_batchIdx_` (uint32_t) - Required - The batch index for which to get the offset. ### Returns - `size_t` - The offset from the start of the memory allocation to the buffer pointer. ### Notes - This method is an inline override of `BaseBatchBuffer::getBufOffset`. - It references `BaseBatchBuffer::getBatchSize()` and `NvBufSurface::isContiguous`. ``` -------------------------------- ### setup Source: https://docs.nvidia.com/metropolis/deepstream/9.1/sdk-api/search/functions_13.html Sets up the SensorFusionApp with configuration and window closed callback. ```APIDOC ## setup ### Description Sets up the SensorFusionApp with a configuration path and a window closed callback. ### Method setup ### Signature `SensorFusionApp::setup(const std::string &configPath, std::function< void()> windowClosed)` ### Parameters - **configPath** (const std::string&) - Required - Path to the configuration file. - **windowClosed** (std::function) - Required - Callback function invoked when the window is closed. ``` -------------------------------- ### size_t nvdsinferserver::BaseBatchBuffer::getBufOffset(uint32_t _batchIdx_) const Source: https://docs.nvidia.com/metropolis/deepstream/9.1/sdk-api/classnvdsinferserver_1_1DetectionOutput.html Gets the offset from the start of the memory allocation to the buffer pointer. Needed for sharing CUDA memory with Triton server. ```APIDOC ## size_t nvdsinferserver::BaseBatchBuffer::getBufOffset(uint32_t _batchIdx_) const ### Description Gets the offset from the start of the memory allocation to the buffer pointer. Needed for sharing CUDA memory with Triton server. ### Method size_t nvdsinferserver::BaseBatchBuffer::getBufOffset(uint32_t _batchIdx_) const ### Parameters - **uint32_t _batchIdx_** - The batch index for which to get the offset. ### Returns size_t - The offset from the start of the memory allocation to the buffer pointer. ### Remarks - Implements nvdsinferserver::IBatchBuffer - Reimplemented in nvdsinferserver::RefBatchBuffer, nvdsinferserver::BatchSurfaceBuffer, and nvdsinferserver::SurfaceBuffer - Definition at line 105 of file sources/libs/nvdsinferserver/infer_batch_buffer.h ``` -------------------------------- ### parse_dsexample() Source: https://docs.nvidia.com/metropolis/deepstream/9.1/sdk-api/search/functions_10.html Parses DS Example configuration from a GKeyFile. ```APIDOC ## parse_dsexample() ### Description Parses DS Example configuration from a GKeyFile. ### Method parse_dsexample ### Signature - `parse_dsexample(NvDsDsExampleConfig *config, GKeyFile *key_file)` ### Parameters - `config` (NvDsDsExampleConfig*) - Required - Output configuration structure. - `key_file` (GKeyFile*) - Required - The GKeyFile to parse. ``` -------------------------------- ### Create virtual environment and install dependencies Source: https://docs.nvidia.com/metropolis/deepstream/9.1/text/DS_Inference_Builder.html Set up a Python virtual environment and install required dependencies for Inference Builder. ```bash cd inference_builder git submodule update --init --recursive python3 -m venv .venv source .venv/bin/activate pip3 install -r requirements.txt ``` -------------------------------- ### Minimal L4T setup commands for Jetson Source: https://docs.nvidia.com/metropolis/deepstream/9.1/text/DS_docker_containers.html Commands to install Docker and NVIDIA container runtime on Jetson after flashing only the BSP from Jetpack. Run these in order after booting the flashed BSP. ```bash Flash BSP from Jetpack and boot Run "sudo apt update" Run "sudo apt install docker.io" Run "sudo apt install nvidia-container" Run "sudo apt install nvidia-l4t-gstreamer" Run "sudo service docker restart" ``` -------------------------------- ### mg_start2() Source: https://docs.nvidia.com/metropolis/deepstream/9.1/sdk-api/globals_func_m.html Starts the CivetWeb web server with additional options. Defined in the CivetWeb header file. ```APIDOC ## mg_start2() ### Description Starts the CivetWeb web server with additional options. Defined in the CivetWeb header file. ### Source - `9.1/sources/includes/civetweb.h` - `sources/includes/civetweb.h` ``` -------------------------------- ### CUDA GPG error output Source: https://docs.nvidia.com/metropolis/deepstream/9.1/text/DS_Installation.html Example error output during CUDA installation when the GPG public key is not available. Refer to the NVIDIA blog for updating the CUDA Linux GPG repository key. ```text W: GPG error: https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64 InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY A4B469963BF863CC E: The repository 'https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64 InRelease' is no longer signed. ``` -------------------------------- ### Set up Triton Server and backends on Jetson Source: https://docs.nvidia.com/metropolis/deepstream/9.1/text/DS_Quickstart.html Set up Triton Server and backends on Jetson by running the setup script from the samples directory. The script downloads Triton Server Release 2.68.0 by default and installs backends into /opt/nvidia/deepstream/deepstream/lib/triton_backends. To use a different backend directory, update the infer_config with the shown model_repo block. ```bash $ cd /opt/nvidia/deepstream/deepstream/samples/ $ sudo ./triton_backend_setup.sh ``` ```text model_repo { backend_dir: /opt/nvidia/tritonserver/backends/ } ``` -------------------------------- ### start() Source: https://docs.nvidia.com/metropolis/deepstream/9.1/sdk-api/classds3d_1_1GuardDataRender.html Starts the data render process with the given content and optional path. Returns an ErrCode indicating success or failure. ```APIDOC ## start() ### Description Starts the data render process with the given content and optional path. Returns an ErrCode indicating success or failure. ### Method start ### Signature `ErrCode ds3d::GuardDataProcess::start(const std::string &_content_, const std::string &_path_ = "")` ### Parameters - **content** (const std::string&) - Required - The content to be processed. - **path** (const std::string&) - Optional - The path associated with the content. Defaults to empty string. ### Returns - **ErrCode** - The result of the start operation. ``` -------------------------------- ### PipeTuner console output during tuning Source: https://docs.nvidia.com/metropolis/deepstream/9.1/text/Pipetuner-guide.html Example console output from a PipeTuner run. It shows dependency installation, BBO client/server launch, progress updates (0% to 100%), and a message to press CTRL+C to stop tuning. Note that TensorRT engine files are generated during the first iteration, which may take 10 to 30 minutes longer. ```text Installing dependencies... Installing dependencies (1/2) Installing dependencies (2/2) Launch BBO client... Launch BBO server... PipeTuner started successfully! !!!!! To stop tuning process in the middle, press CTRL+C !!!!! adding: DsAppServer (deflated 63%) 2024-03-19 08:09:52,108 root INFO seq_list: ['Retail_Synthetic_Cam01', 'Retail_Synthetic_Cam02', 'Retail_Synthetic_Cam03', 'Retail_Synthetic_Cam04', 'Retail_Synthetic_Cam05', 'Retail_Synthetic_Cam06', 'Retail_Synthetic_Cam07', 'Retail_Synthetic_Cam08'] 2024-03-19 08:09:52,169 root INFO Writing configs to /output/SDG_sample_PeopleNet-ResNet34_NvDCF-ResNet50_MOT_test.yml_output/results/configs_03-19-2024_08-09-52 2024-03-19 08:09:52,169 root INFO send backend init 2024-03-19 08:09:52,170 root INFO creating optimizers... 2024-03-19 08:09:52,170 root INFO done. created 2 * Serving Flask app 'ds_bbo_frontend_server' * Debug mode: on 2024-03-19 08:09:52,186 root INFO init jobs done 2024-03-19 08:09:52,187 root INFO progress: 0% (0/4) 2024-03-19 08:09:52,193 root INFO wait backend ready ... 2024-03-19 08:12:15,232 root INFO progress: 25% (1/4) ETA 00:07:09 2024-03-19 08:12:25,447 root INFO progress: 25% (1/4) ETA 00:07:39 ... 2024-03-19 08:13:47,190 root INFO progress: 50% (2/4) ETA 00:03:55 2024-03-19 08:13:57,413 root INFO progress: 75% (3/4) ETA 00:01:21 ... 2024-03-19 08:14:58,719 root INFO progress: 100% (4/4) ETA 00:00:00 2024-03-19 08:14:58,720 root INFO OPTIMIZATION DONE! … stopping workers... number of workers to stop: 2 number of workers to stop: 0 done. !!!!! Press CTRL+C key to end PipeTuner !!!!! ``` -------------------------------- ### Pipeline::install Source: https://docs.nvidia.com/metropolis/deepstream/9.1/sdk-api/9_81_2service-maker_2includes_2pipeline_8hpp_source.html Installs a callback to capture keyboard events. ```APIDOC ## Pipeline::install ### Description Install a callback to capture keyboard events. ### Method install ### Signature `Pipeline & install(std::function< void(Pipeline &, int key)> keyboard_listener)` ### Parameters - **keyboard_listener** (std::function) - Required - Callback function to handle keyboard events. ### Returns - **Pipeline&** - Reference to the pipeline for chaining. ### Definition 9.1/service-maker/includes/pipeline.hpp:276 ``` -------------------------------- ### Install prerequisite packages Source: https://docs.nvidia.com/metropolis/deepstream/9.1/text/DS_Installation.html Installs the prerequisite packages required before installing the DeepStream SDK on Ubuntu. ```bash $ sudo apt install \ libssl3 \ libssl-dev \ libcurl4-openssl-dev \ libgles2-mesa-dev \ libgstreamer1.0-0 \ gstreamer1.0-tools \ gstreamer1.0-plugins-good \ gstreamer1.0-plugins-bad \ gstreamer1.0-plugins-ugly \ gstreamer1.0-libav \ libgstreamer-plugins-base1.0-dev \ libgstrtspserver-1.0-0 \ libjansson4 \ libyaml-cpp-dev \ libjsoncpp-dev \ protobuf-compiler \ libmosquitto1 \ gcc \ make \ git \ python3 ``` -------------------------------- ### Basic Pipeline Setup with nvdsdynamicsrcbin Source: https://docs.nvidia.com/metropolis/deepstream/9.1/text/DS_plugin_gst-nvdsdynamicsrcbin.html Creates a GStreamer pipeline with nvdsdynamicsrcbin as the source element and a fakesink, adds and links them, then sets the pipeline to PLAYING state. ```c // Create pipeline elements GstElement *pipeline = gst_pipeline_new("dynamicsrcbin-test"); GstElement *src = gst_element_factory_make("nvdsdynamicsrcbin", "src"); GstElement *sink = gst_element_factory_make("fakesink", "sink"); // Add elements to pipeline and link them gst_bin_add_many(GST_BIN(pipeline), src, sink, NULL); gst_element_link_many(src, sink, NULL); // Set pipeline to PLAYING state gst_element_set_state(pipeline, GST_STATE_PLAYING); ``` -------------------------------- ### Extract video frames with MediaExtractor and custom BufferProvider Source: https://docs.nvidia.com/metropolis/deepstream/9.1/text/DS_service_maker_python_advanced_features.html Use MediaExtractor to decode video frames from multiple MediaChunk sources and feed them into a custom BufferProvider for rendering. Only applicable on x86 systems. The example extracts 1-second chunks starting at 40 seconds from a sample video, using a ThreadPoolExecutor to render each chunk's queue with a renderer pipeline. ```python from pyservicemaker import BufferProvider, Buffer, Flow, Pipeline, ColorFormat, RenderMode from pyservicemaker.utils import MediaExtractor, MediaChunk from concurrent.futures import ThreadPoolExecutor import queue VIDEO_FILE = "/opt/nvidia/deepstream/deepstream/samples/streams/sample_720p.mp4" N_CHUNKS = 8 # Enable display if you have one on your system and want to see the frames ENABLE_DISPLAY = False class MyBufferProvider(BufferProvider): def __init__(self, queue, width, height): print("MyBufferProvider") super().__init__() self._queue = queue self.format = "RGB" self.width = width self.height = height self.framerate = 30 self.device = 'gpu' self.frames = 0 def generate(self, size): try: frame = self._queue.get(timeout=5) if frame is None: # Done with the frame queue return Buffer() self.frames += 1 return frame.tensor.wrap(ColorFormat.RGB) except queue.Empty: print("Buffer empty") return Buffer() # extract 1 second video frame starting from 40 seconds chunks = [MediaChunk(f, start_pts=int(40*1e9), duration=int(1e9)) for f in [VIDEO_FILE]*N_CHUNKS] with MediaExtractor(chunks=chunks, batch_size=N_CHUNKS) as extractor: qs = extractor() with ThreadPoolExecutor(max_workers=N_CHUNKS) as exe: render_mode = RenderMode.DISPLAY if ENABLE_DISPLAY else RenderMode.DISCARD exe.map(lambda q: Flow(Pipeline("renderer")).inject([MyBufferProvider(q, 1280, 720)]).render(render_mode, sync=False)(), qs) ``` -------------------------------- ### mg_start_domain() Source: https://docs.nvidia.com/metropolis/deepstream/9.1/sdk-api/9_81_2sources_2includes_2civetweb_8h.html Starts a domain (virtual host) on an existing server context. ```APIDOC ## mg_start_domain() ### Description Starts a domain (virtual host) on an existing server context. ### Method Function call ### Signature `CIVETWEB_API int mg_start_domain(struct mg_context *_ctx_, const char **_configuration_options_)` ### Parameters - **`_ctx_`** (struct mg_context*) - Required - Pointer to the server context. - **`_configuration_options_`** (const char**) - Required - Array of configuration options. ### Return Value - **int** - 0 on success, non-zero on failure. ``` -------------------------------- ### Compile and install Gst-nvreplay Source: https://docs.nvidia.com/metropolis/deepstream/9.1/text/DS_plugin_gst-nvreplay.html Compile and install the Gst-nvreplay plugin from its source directory. Requires sudo for the install step. ```bash cd deepstream/sources/gst-plugins/gst-nvreplay/ make && sudo -E make install ``` -------------------------------- ### MQTT adapter configuration file (cfg_mqtt.txt) Source: https://docs.nvidia.com/metropolis/deepstream/9.1/text/DS_plugin_gst-nvmsgbroker.html Example configuration file entries for the MQTT protocol adapter. Includes username, password, client-id, and commented TLS options. Uncomment share-connection to generate a connection signature. ```ini [message-broker] username = user password = password client-id = uniqueID #enable-tls = 1 #tls-cafile = #tls-capath = #tls-certfile = #tls-keyfile = #share-connection = 1 #loop-timeout = 2000 #keep-alive = 60 ``` -------------------------------- ### Start a DS3D dataloader manually Source: https://docs.nvidia.com/metropolis/deepstream/9.1/text/DS_3D_Custom_Manual.html Manually start a DS3D dataloader after it has been created. The dataloader can also be started automatically by gst-pipeline. ```cpp GuardDataLoader dataloader = loaderSrc.customProcessor; ErrCode c = dataloader.start(); ``` -------------------------------- ### DsExampleCtxInit Source: https://docs.nvidia.com/metropolis/deepstream/9.1/sdk-api/9_81_2sources_2gst-plugins_2gst-dsexample-cuda_2dsexample__lib_2dsexample__lib_8h.html Initializes the DsExample context with the provided initialization parameters. ```APIDOC ## DsExampleCtxInit ### Description Initializes the DsExample context with the provided initialization parameters. ### Syntax ```c DsExampleCtx * DsExampleCtxInit (DsExampleInitParams *init_params) ``` ### Parameters - **init_params** (DsExampleInitParams*) - Required - Pointer to the initialization parameters. ### Returns - **DsExampleCtx*** - Pointer to the initialized context, or NULL on failure. ``` -------------------------------- ### Verify installed WSL distributions Source: https://docs.nvidia.com/metropolis/deepstream/9.1/text/DS_on_WSL2.html Verifies that Ubuntu is installed properly after a potential restart. If the distribution is not listed, re-run the install command. ```bash $ wsl --list ``` -------------------------------- ### mg_start Source: https://docs.nvidia.com/metropolis/deepstream/9.1/sdk-api/9_81_2sources_2includes_2civetweb_8h_source.html Starts the CivetWeb web server with user-defined callbacks and configuration options. ```APIDOC ## mg_start ### Description Starts the web server with the given callbacks and configuration options. Returns a context handle or NULL on error. ### Method Function call ### Signature ```c CIVETWEB_API struct mg_context *mg_start(const struct mg_callbacks *callbacks, void *user_data, const char **configuration_options); ``` ### Parameters - **callbacks** (const struct mg_callbacks*) - Required - User-defined callbacks structure. - **user_data** (void*) - Required - User data pointer passed to callbacks. - **configuration_options** (const char**) - Required - NULL terminated list of option_name, option_value pairs. ### Return Value - **struct mg_context*** - Web server context, or NULL on error. ### Example ```c const char *options[] = { "document_root", "/var/www", "listening_ports", "80,443s", NULL }; struct mg_context *ctx = mg_start(&my_func, NULL, options); ``` ``` -------------------------------- ### Remove previous DeepStream installations Source: https://docs.nvidia.com/metropolis/deepstream/9.1/text/DS_Installation.html Removes all previous DeepStream 3.0 or prior installations. Run these commands before installing the DeepStream SDK on Ubuntu. ```bash $ sudo rm -rf /usr/local/deepstream /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstnv* /usr/bin/deepstream* /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libnvdsgst* /usr/lib/x86_64-linux-gnu/gstreamer-1.0/deepstream* /opt/nvidia/deepstream/deepstream* $ sudo rm -rf /usr/lib/x86_64-linux-gnu/libv41/plugins/libcuvidv4l2_plugin.so ``` -------------------------------- ### DsExampleCtxInit Source: https://docs.nvidia.com/metropolis/deepstream/9.1/sdk-api/9_81_2sources_2gst-plugins_2gst-dsexample-cuda_2dsexample__lib_2dsexample__lib_8h.html Initializes a DsExampleCtx context with the given initialization parameters and returns a pointer to the new context. ```APIDOC ## DsExampleCtxInit ### Description Initializes a DsExampleCtx context with the given initialization parameters and returns a pointer to the new context. ### Function Signature ```c DsExampleCtx* DsExampleCtxInit(DsExampleInitParams* _init_params_) ``` ### Parameters - `_init_params_` (DsExampleInitParams*) - Required - Pointer to initialization parameters. ### Returns - `DsExampleCtx*` - Pointer to the newly created context, or NULL on failure. ``` -------------------------------- ### Install librdkafka-dev Source: https://docs.nvidia.com/metropolis/deepstream/9.1/text/DS_Installation.html Installs the librdkafka development package, enabling the Kafka protocol adaptor for message broker integration. Run after installing confluent-platform. ```bash sudo apt-get install librdkafka-dev ``` -------------------------------- ### Run sample_app.py with a media URI Source: https://docs.nvidia.com/metropolis/deepstream/9.1/text/DS_service_maker_python_intro_to_pipeline_api.html Command to run the sample application with a media file URI. ```bash $ python3 sample_app.py file:///opt/nvidia/deepstream/deepstream/samples/streams/sample_720p.mp4 ``` -------------------------------- ### Get readiness info with curl GET Source: https://docs.nvidia.com/metropolis/deepstream/9.1/text/DS_RestServer.html Gets readiness info. The endpoint can be /api/v1/ready or /ready. The response indicates whether the service is ready. ```bash curl -XGET 'http://localhost:9000/api/v1/ready' OR curl -XGET 'http://localhost:9000/ready' ``` ```json { "ready-info" : { "ds-ready" : "YES" }, "reason" : "GET_READY_INFO_SUCCESS", "status" : "HTTP/1.1 200 OK" } ``` -------------------------------- ### mg_start2 Source: https://docs.nvidia.com/metropolis/deepstream/9.1/sdk-api/9_81_2sources_2includes_2civetweb_8h_source.html Initializes the CivetWeb server context with the provided initialization data and error handling. ```APIDOC ## mg_start2 ### Description Initializes the CivetWeb server context with the provided initialization data and error handling. ### Function Signature ```c CIVETWEB_API struct mg_context *mg_start2(struct mg_init_data *init, struct mg_error_data *error); ``` ### Parameters - **init** (struct mg_init_data*) - Required - Pointer to initialization data containing callbacks, user data, and configuration options. - **error** (struct mg_error_data*) - Required - Pointer to error data structure to receive error details on failure. ### Return Value - **struct mg_context*** - Pointer to the created server context, or NULL on failure. ### Error Codes - **MG_ERROR_DATA_CODE_INVALID_PARAM** - Caller provided invalid parameter. - **MG_ERROR_DATA_CODE_INVALID_OPTION** - "configuration_option" contains invalid element. - **MG_ERROR_DATA_CODE_INIT_TLS_FAILED** - Initializing TLS/SSL library failed. - **MG_ERROR_DATA_CODE_MISSING_OPTION** - Mandatory "configuration_option" missing. - **MG_ERROR_DATA_CODE_DUPLICATE_DOMAIN** - Duplicate "authentication_domain" option. - **MG_ERROR_DATA_CODE_OUT_OF_MEMORY** - Not enough memory. - **MG_ERROR_DATA_CODE_SERVER_STOPPED** - Server already stopped. - **MG_ERROR_DATA_CODE_INIT_LIBRARY_FAILED** - mg_init_library must be called first. - **MG_ERROR_DATA_CODE_OS_ERROR** - Operating system function failed. - **MG_ERROR_DATA_CODE_INIT_PORTS_FAILED** - Failed to bind to server ports. - **MG_ERROR_DATA_CODE_INIT_USER_FAILED** - Failed to switch user (option "run_as_user"). - **MG_ERROR_DATA_CODE_INIT_ACL_FAILED** - Access Control List error. - **MG_ERROR_DATA_CODE_INVALID_PASS_FILE** - Global password file error. - **MG_ERROR_DATA_CODE_SCRIPT_ERROR** - Lua background script init error. ``` -------------------------------- ### start() Source: https://docs.nvidia.com/metropolis/deepstream/9.1/sdk-api/classds3d_1_1gst_1_1PipelineContext.html Starts the pipeline context by playing the pipeline and running the main loop. The provided callback is invoked when the loop quits. ```APIDOC ## start() ### Description Starts the pipeline context by playing the pipeline and running the main loop. The provided callback is invoked when the loop quits. ### Method start ### Signature `virtual ErrCode ds3d::gst::PipelineContext::start(std::function _loopQuitCb_)` ### Parameters - `_loopQuitCb_` (std::function) - Required - Callback invoked when the main loop quits. ### Return Value - `ErrCode` - Returns `ds3d::kGood` on success, or an error code on failure. ### Remarks - Calls `playPipeline()` and `runMainLoop()`. - Defined in `sources/libs/ds3d/gst/nvds3d_pipeline_context.h`. ``` -------------------------------- ### Get liveness info with curl GET Source: https://docs.nvidia.com/metropolis/deepstream/9.1/text/DS_RestServer.html Gets liveness info. The endpoint can be /api/v1/live or /live. The response indicates whether the service is live. ```bash curl -XGET 'http://localhost:9000/api/v1/live' OR curl -XGET 'http://localhost:9000/live' ``` ```json { "live-info" : { "ds-liveness" : "YES" }, "reason" : "GET_LIVE_INFO_SUCCESS", "status" : "HTTP/1.1 200 OK" } ```