CentOS硬解码+ffmpeg+Nvidia硬解码

0.yum换源:

bash 复制代码
  mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
  wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
  yum install wget
  curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
  cd  /etc/yum.repos.d/
  ll
  yum install wget
  yum install lrzsz

1.环境配置:

bash 复制代码
  yum update -y
  yum install -y     epel-release     git     wget     yasm     nasm     pkgconfig     gcc     gcc-c++     make     autoconf     automake     libtool     zlib-devel     bzip2     bzip2-devel     freetype-devel     gnutls-devel     libvorbis-devel     libX11-devel     libXfixes-devel     x264-devel     cmake3     libvpx-devel     SDL2-devel     opencv-devel     libass-devel     openjpeg2-devel
  yum -y install autoconf automake make gcc gcc-c++   libass-devel freetype-devel SDL2-devel libtheora-devel   libtool libva-devel libvdpau-devel libvorbis-devel   libxcb-devel texinfo zlib-devel
  yum -y install yasm   x264-devel x265-devel   libvpx-devel fdk-aac-devel   lame-devel opus-devel
  yum -y install glew glew-devel freeglut freeglut-devel   libXmu-devel libGLU-devel

  wget https://archive.mozilla.org/pub/opus/opus-1.3.1.tar.gz
  tar -xzf opus-1.3.1.tar.gz
  cd opus-1.3.1
  ./configure
  make
  make install

2.下载 nv-codec-headers

bash 复制代码
  tar zxvf nv-codec-headers-old-sdk-9.1.zip 
  unzip nv-codec-headers-old-sdk-9.1.zip 
  yum install unzip
  unzip nv-codec-headers-old-sdk-9.1.zip 
  cd nv-codec-headers-old-sdk-9.1
  make
  make install

3.下载 ffmpeg

bash 复制代码
  wget http://ffmpeg.org/releases/ffmpeg-4.2.10.tar.gz && tar zxvf ffmpeg-4.2.10.tar.gz
  ll
  cd ffmpeg-4.2.10
  export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
  ./configure --prefix=/usr/local/ffmpeg   --disable-asm   --disable-x86asm   --enable-cuda   --enable-cuvid   --enable-nvenc   --enable-nonfree   --enable-gpl   --enable-libx264   --enable-libx265   --enable-shared   --enable-libass   --enable-libfdk-aac   --enable-libfreetype   --enable-libmp3lame   --enable-libopus   --enable-libtheora   --enable-libvorbis   --enable-librtmp
  make
  make install
  ffmpeg
  ffmpeg -hwaccels

4.验证rtsp流

bash 复制代码
  ffmpeg -hwaccel cuvid -c:v h264_cuvid -i rtsp://admin:1qazXSW@@192.168.20.154/h264/ch1/main/av_stream -f null -

验证本地视频

bash 复制代码
  ffmpeg -hwaccel cuda -c:v h264_cuvid -i MyVideo_1.mp4 -f null -
  ffmpeg -hwaccel cuda -c:v h264_cuvid -i MyVideo_1.mp4 -f mp4 output.MP4 #保存视频 

能成功用cuda硬解码视频流:top显示cpu占用率明显下降,nvidia-smi显示有算力占用。

相关推荐
likfishdn8 分钟前
Linux的文件与目录管理
linux·运维·服务器
chian-ocean28 分钟前
Linux 文件缓冲区:高效数据访问的幕后推手
linux·运维·服务器
加油=^_^=30 分钟前
【Linux】进程优先级 | 进程调度(三)
linux·运维·服务器
吃汤圆的抹香鲸1 小时前
GoLand 安装包 绿色版 Win,Mac,Linux 包含IntelliJ全家桶 专为Go语言设计的集成开发环境(IDE)
linux·windows·macos·go·intellij-idea·go1.19
追寻光1 小时前
Cannot find a valid baseurl for repo: base/7/x86_64
linux
元气满满的热码式1 小时前
Docker数据卷操作实战
linux·运维·docker·云原生·容器
陆沙1 小时前
deepseek-r1-centos-本地服务器配置方法
linux·服务器·centos
吃汤圆的抹香鲸2 小时前
Rider 安装包 绿色版 Win/Mac/Linux 适合.NET和游戏开发者使用 2025全栈开发终极指南:从零配置到企业级实战
linux·运维·windows·sql·游戏·macos·.net
sz66cm2 小时前
Linux基础 -- ARM 32 位架构动态注入代码技术文档
linux·arm开发·架构
Mr.pyZhang4 小时前
Android构建系统 - 04 编译产物
android·linux