ffmpeg使用GPU编解码,实现多路推流

环境配置:[

参考博客地址

环境配置问题:

环境配置分为两个部分:
  1. 安装ffnvcodec
    结合自己的cuda driver版本去github上下载对应的版本 make + make install
  2. ffmpeg安装:
    下载ffmpeg项目源码,在其文件夹中运行 ./configure
./configure --enable-gpl --enable-version3 --enable-nonfree --enable-shared --enable-ffmpeg --enable-ffplay --enable-ffprobe --enable-ffserver --enable-libx264 --enable-nvenc --enable-cuda --enable-cuvid --enable-libnpp --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64
然后编译 sudo make + sudo make install

打开流媒体服务器easydarwin

在这里插入图片描述

进行推流

该命令可以将一个视频推20路rtsp流
在其中-rtsp_transport tcp 设置实效
且采取gpu进行编解码同时在本机上只能同时跑两条命令,多的会终止

ffmpeg -re -stream_loop -1 -hwaccel cuvid -vcodec h264_cuvid -i east_mod.mp4 -vcodec h264_nvenc -map 0 -f tee '[f=rtsp]rtsp://localhost/east5 | [f=rtsp]rtsp://localhost/east1 | [f=rtsp]rtsp://localhost/east2 | [f=rtsp]rtsp://localhost/east3 | [f=rtsp]rtsp://localhost/east4 | [f=rtsp]rtsp://localhost/east6| [f=rtsp]rtsp://localhost/east7| [f=rtsp]rtsp://localhost/east8| [f=rtsp]rtsp://localhost/east9| [f=rtsp]rtsp://localhost/east10| [f=rtsp]rtsp://localhost/east11 | [f=rtsp]rtsp://localhost/east12 | [f=rtsp]rtsp://localhost/east13 | [f=rtsp]rtsp://localhost/east14 | [f=rtsp]rtsp://localhost/east15 | [f=rtsp]rtsp://localhost/east16| [f=rtsp]rtsp://localhost/east17| [f=rtsp]rtsp://localhost/east18| [f=rtsp]rtsp://localhost/east19| [f=rtsp]rtsp://localhost/east20'

查看推流情况

在这里插入图片描述
在这里插入图片描述
查看显卡使用情况
nvidia-smi
在这里插入图片描述

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值