Ubuntu X86编译安装Gstreamer nvenc插件(硬件编码)

1.软件版本:

  • 显卡驱动:≥470.57.02
  • CUDA版本:≥11.4 (sudo apt install cuda-11-7)
  • Video_Codec_SDK: ≥11.1.5
    (链接:https://developer.nvidia.com/nvidia-video-codec-sdk)
  • gtk-doc版本 : ≥1.12 (sudo apt install gtk-doc-tools)

2.下载Gstreamer源码:

git clone https://github.com/GStreamer/gst-plugins-bad

查看本机gstreamer版本:

gst-launch-1.0 –version

切换插件版本与本机源码版本一致:

cd gst-plugins-bad
git branch -b 1.14.5 (当前我的版本)
chmod 777 autogen.sh
./autogen.sh

3.编译安装:
解压 Video_Codec_SDK_11.1.5 执行下面命令:NVIDIA VIDEO CODEC SDK
Video_Codec_SDK_11.1.5 执行下面命令:

sudo cp Interface/* /usr/local/cuda/include
sudo cp Lib/linux/stubs/x86_64/* /usr/local/cuda/lib64/stubs
cd gst-plugins-bad
NVENCODE_LIBS="-L/usr/local/cuda/lib64/stubs" NVENCODE_CFLAGS="-I/usr/local/cuda/include" ./configure --enable-nvenc --enable-openh264 --with-cuda-prefix="/usr/local/cuda-11.7"
(当前我的cuda版本为11.7)
cd nvenc
make -j4
sudo make install

添加环境变量:

echo export GST_PLUGIN_PATH="/usr/local/lib/gstreamer-1.0" >> ~/.bashrc

4.验证插件是否安装成功:

gst-inspect-1.0 nvh264enc

rtp推拉流测试

拉流端:

gst-launch-1.0 udpsrc port=9876 ! application/x-rtp,encoding-name=H264,payload=96 ! rtph264depay ! h264parse ! avdec_h264 ! queue ! videoscale  ! videoconvert ! ximagesink sync=false -e

推流端:

gst-launch-1.0 -v v4l2src device=/dev/video0 ! video/x-raw,format=YUY2,width=640,height=480,framerate=30/1 ! videoconvert ! nvh264enc ! video/x-h264, stream-format=byte-stream ! rtph264pay ! udpsink host=127.0.0.1 port=9876
  • 2
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值