Nvidia的jetson盒子安装了gst-launch-1.0,可以直接使用。 有些命令需要特定硬件,所以官网上的命令并不一定能在本地跑起来,硬件是nvidia orin nx,有USB摄像头,未装CSI摄像头。
这里仅是本人的一些尝试命令,仅供参考。
直接显示画面
标题 | 命令 | 本机测试结果 |
---|---|---|
打开测试管道 | gst-launch-1.0 videotestsrc ! 'video/x-raw, width=(int)1280, height=(int)720, format=(string)I420, framerate=(fraction)30/1' ! nveglglessink -e | 成功 |
文件读取MP4 | gst-launch-1.0 filesrc location=xxx.mp4 ! qtdemux name=demux demux.video_0! queue ! h264parse ! nvv4l2decoder ! nvvidconv ! video/x-raw, width=1920, height=1280, format=BGRx ! videoconvert ! autovideosink | 成功 |
读取rtsp流 | gst-launch-1.0 rtspsrc user-id=xxxxx user-pw=xxxxx location=rtsp://192.168.1.x/Streaming/Channels/401 ! rtph264depay ! h264parse ! nvv4l2decoder ! nvvidconv ! video/x-raw, width=1920, height=1280, format=BGRx ! videoconvert ! autovideosink | 成功 |
读取usb摄像头 | gst-launch-1.0 v4l2src device=/dev/video0 ! decodebin ! nvvidconv ! video/x-raw, width=1280, height=720, format=BGRx ! videoconvert ! autovideosink | 成功 |
推流到rtp服务
先启动服务:./test-launch "udpsrc port=30000 ! h264parse ! rtph264pay name=pay0 pt=96"
test-launch需要编译gst-rtsp-server,参照github文档,需要注意如果不行的话试试1.14.3这个版本,本人已实测
标题 | 命令 | 测试结果 |
---|---|---|
测试源推流 | gst-launch-1.0 videotestsrc is-live=true ! video/x-raw ! videoconvert ! x264enc tune=zerolatency speed-preset=superfast ! udpsink host=127.0.0.1 port=30000 | 成功 |
usb摄像头推流到rtp服务器 | gst-launch-1.0 v4l2src device=/dev/video0 ! decodebin ! nvvidconv ! video/x-raw ! videoconvert ! x264enc speed-preset=ultrafast tune=zerolatency ! udpsink host=127.0.0.1 port=30000 | 成功 |
推流文件MP4到udp 测试通过 | gst-launch-1.0 filesrc location=out1.mp4 ! qtdemux name=demux demux.video_0 ! queue ! h264parse ! nvv4l2decoder ! nvvidconv ! video/x-raw ! x264enc speed-preset=ultrafast tune=zerolatency ! udpsink host=127.0.0.1 port=30000 | 成功 |
转推rtsp流 | gst-launch-1.0 rtspsrc user-id=xxxx user-pw=xxxx location=rtsp://192.168.1.xxx/Streaming/Channels/101 ! rtph264depay ! h264parse ! nvv4l2decoder ! nvvidconv ! video/x-raw ! x264enc speed-preset=ultrafast tune=zerolatency ! udpsink host=127.0.0.1 port=30000 | 成功 |
使用rtspclientsink直接推流到rtsp媒体服务
功能描述 | 命令 | 测试结果 |
---|---|---|
测试源 | gst-launch-1.0 videotestsrc is-live=true ! video/x-raw ! videoconvert ! x264enc tune=zerolatency speed-preset=superfast ! rtspclientsink location=rtsp媒体服务器地址 | 成功 |
usb摄像头推流 | gst-launch-1.0 v4l2src device=/dev/video0 ! decodebin ! nvvidconv ! video/x-raw ! videoconvert ! x264enc speed-preset=ultrafast tune=zerolatency ! rtspclientsink location=rtsp媒体服务器地址 | 成功 |
转推rtsp流 | gst-launch-1.0 rtspsrc user-id=xxxx user-pw=xxxx location=源地址 ! rtph264depay ! h264parse ! nvv4l2decoder ! nvvidconv ! video/x-raw ! x264enc speed-preset=ultrafast tune=zerolatency ! rtspclientsink location=rtsp媒体服务器地址 | 成功 |
mp4文件推流 | gst-launch-1.0 filesrc location=out1.mp4 ! qtdemux name=demux demux.video_0 ! queue ! h264parse ! nvv4l2decoder ! nvvidconv ! video/x-raw ! x264enc speed-preset=ultrafast tune=zerolatency ! rtspclientsink location=rtsp媒体服务器地址 | 成功 |
gst还有很多复杂的功能,这里只针对特定场景梳理了一下,如有错误,请指正。