官网地址:https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_Quickstart.html
NVIDIA® DeepStream Software Development Kit (SDK) is an accelerated AI framework to build intelligent video analytics (IVA) pipelines. DeepStream runs on NVIDIA® T4, NVIDIA® Ampere and platforms such as NVIDIA® Jetson™ Nano, NVIDIA® Jetson AGX Xavier™, NVIDIA® Jetson Xavier NX™, NVIDIA®Jetson™ TX1 and TX2.
在安装 DeepStream SDK 之前,我们先来看一下如何为 Jetson 做些准备工作。
下载 NVIDIA SDK Manager,地址为 https://developer.nvidia.com/embedded/jetpack。 你接下来会基于这套系统安装 JetPack 4.5.1 GA (对应 L4T 32.5.1 发发布版本) 。
NVIDIA SDK Manager 是一个图形化的应用程序,负责烧录和安装 Jetpack 软件包。
烧录过程持续大约 10-30 分钟,这取决于你使用的电脑主机系统
这里我得补充说明一下。对于 Jetson 来讲,上述过程包括:
上述过程我会专门写文详细介绍,目前先大致了解这么多。
官方提示:如果你是用 Jetson Nano 或 Jetson Xavier NX 开发套件,你可以从 https://developer.nvidia.com/embedded/jetpack 下载 SD卡镜像文件。这套镜像包含了 CUDA、TensorRT 和 cuDNN。
输入下面的命令行,安装依赖项:
$ sudo apt install \
libssl1.0.0 \
libgstreamer1.0-0 \
gstreamer1.0-tools \
gstreamer1.0-plugins-good \
gstreamer1.0-plugins-bad \
gstreamer1.0-plugins-ugly \
gstreamer1.0-libav \
libgstrtspserver-1.0-0 \
libjansson4=2.11-1
安装 librdkafka (为消息代理启用Kafka协议适配器)
从 GitHub 克隆 librdkafka 库:
$ git clone https://github.com/edenhill/librdkafka.git
配置并编译构建库:
$ cd librdkafka
$ git reset --hard 7101c2310341ab3f4675fc565f64f0967e135a6a
$ ./configure
$ make
$ sudo make install
把生成的库文件复制到 deepstream 目录:
$ sudo mkdir -p /opt/nvidia/deepstream/deepstream-5.1/lib
$ sudo cp /usr/local/lib/librdkafka* /opt/nvidia/deepstream/deepstream-5.1/lib
Method 1: 使用 SDK Manager
在安装 JetPack 4.5.1 时从 Additional SDKs 中选择 DeepStreamSDK。
Method 2: 使用 DeepStream tar 压缩包安装
下载 DeepStream 5.1 Jetson tar 压缩包
eepstream_sdk_v5.1.0_jetson.tbz2 到
Jetson 设备。输入下面的命令解压并安装 DeepStream SDK:
$ sudo tar -xvf deepstream_sdk_v5.1.0_jetson.tbz2 -C / $ cd /opt/nvidia/deepstream/deepstream-5.1 $ sudo ./install.sh $ sudo ldconfig
亲测这个方法好使,后面的方法就不多介绍了。
Method 3: Using the DeepStream Debian package
Download the DeepStream 5.1 Jetson Debian package deepstream-5.1_5.1.0-1_arm64.deb
, to the Jetson device. Then enter the command:
$ sudo apt-get install ./deepstream-5.1_5.1.0-1_arm64.deb
Note
If you install the DeepStream SDK Debian package using the dpkg
command, you must install the following packages before installing the debian package:
libgstrtspserver-1.0-0
libgstreamer-plugins-base1.0-dev
Method 4: Using the apt-server
Open the apt source configuration file in a text editor, using a command similar to
$ sudo vi /etc/apt/sources.list.d/nvidia-l4t-apt-source.list
Change the repository name and download URL in the deb commands shown below:
deb https://repo.download.nvidia.com/jetson/common r32.5 main
Save and close the source configuration file.
Enter the commands:
$ sudo apt update $ sudo apt install deepstream-5.1
Method 5: Use Docker container DeepStream docker containers are available on NGC. See the Docker Containers section to learn about developing and deploying DeepStream using docker containers.
导航到开发套件的样例目录。
输入下面的命令运行样例程序:
$ deepstream-app -c <path_to_config_file>
Where <path_to_config_file>
is the pathname of one of the reference application’s configuration files, found in configs/deepstream-app/
. See Package Contents for a list of the available files.
Note
You can find sample configuration files under /opt/nvidia/deepstream/deepstream-5.1/samples
directory. Enter this command to see application usage:
$ deepstream-app --help
To save TensorRT Engine/Plan file, run the following command:
$ sudo deepstream-app -c <path_to_config_file>
To show labels in 2D Tiled display view, expand the source of interest with mouse left-click on the source. To return to the tiled display, right-click anywhere in the window.
Keyboard selection of source is also supported. On the console where application is running, press the
z
key followed by the desired row index (0 to 9), then the column index (0 to 9) to expand the source. To restore 2D Tiled display view, pressz
again.
... ...
Jetson Nano 已经安装了 GStreamer,但是,nVidia 并没有完成配置, include 路径需要自己在配置一下才行。方法如下:
在 /etc/profile 文件最后添加以下两行内容即可:
export C_INCLUDE_PATH=/usr/include/gstreamer-1.0:/usr/include/glib-2.0:/usr/lib/aarch64-linux-gnu/glib-2.0/include:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=/usr/include/gstreamer-1.0:/usr/include/glib-2.0:/usr/lib/aarch64-linux-gnu/glib-2.0/include:$CPLUS_INCLUDE_PATH
保存后重启系统,即可。用下面的程序(文件名 basic-tutorial-1.c )测试一下:
#include <gst/gst.h>
int
main (int argc, char *argv[])
{
GstElement *pipeline;
GstBus *bus;
GstMessage *msg;
/* Initialize GStreamer */
gst_init (&argc, &argv);
/* Build the pipeline */
pipeline =
gst_parse_launch
("playbin uri=https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm",
NULL);
/* Start playing */
gst_element_set_state (pipeline, GST_STATE_PLAYING);
/* Wait until error or EOS */
bus = gst_element_get_bus (pipeline);
msg =
gst_bus_timed_pop_filtered (bus, GST_CLOCK_TIME_NONE,
GST_MESSAGE_ERROR | GST_MESSAGE_EOS);
/* Free resources */
if (msg != NULL)
gst_message_unref (msg);
gst_object_unref (bus);
gst_element_set_state (pipeline, GST_STATE_NULL);
gst_object_unref (pipeline);
return 0;
}
用下面的命令编译:
gcc basic-tutorial-1.c -o basic-tutorial-1 `pkg-config --cflags --libs gstreamer-1.0`
运行编译好的程序,应该能看到来自 https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm一段很有趣的视频。
其实到此为止,已经可以正常工作了,本文就先写这么多,谢谢阅读!