zoukankan      html  css  js  c++  java
  • 编译ffmpeg + x264 + cuda + opencv

    1 下载x264并编译

    git clone git://git.videolan.org/x264.git
    ./configure --enable-shared --enable-static
    make -j8
    make install

    2 安装Libav

    3 安装nv-codec-headers

    git clone https://git.videolan.org/git/ffmpeg/nv-codec-headers.git
    make
    sudo make install

    注意SDK版本对于gpu驱动版本

    4 编译 ffmpeg

    ./configure --enable-gpl --enable-libx264 --enable-pic --enable-cuda --enable-cuvid --enable-nonfree --enable-libnpp --enable-shared --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64 --enable-cuda-sdk --enable-nven
    
    
    make -j8
    sudo make install

    5 编译 opencv

    勾选OPENCV_ENABLE_NONFREE

    勾选WITH_TIFF

    勾选WITH_GTK

    勾选WITH_CUDA

    勾选CUDA_USE_STATIC_CUDA_RUNTIME

    编译sudo make -j8


    Other

    ffmpeg+x264一键安装脚本(Linux)

    ffmpeg支持x264插件
    1 ffmpeg安装x264插件

    2 要安装x264模块首先要先装nasm

    3 安装脚本如下【复制即可使用】

    #!/bin/bash
    
    
    
    yum -y install epel-release  && yum -y install git wget                                            #下载git,wget
    
    echo $?                                                                                            
    
    if [ $? == 0 ];then                                                                                #判断工具安装情况
    
    wget  http://www.nasm.us/pub/nasm/releasebuilds/2.13/nasm-2.13.tar.gz                                #下载安装包nasm
    
    git clone git://git.videolan.org/x264.git                                                            #下载x264模块
    
    wget http://219.238.7.67/files/208800000B606D7E/ffmpeg.org/releases/ffmpeg-3.4.2.tar.bz2            #下载ffmpeg
    
    else
    
    	exit                                                                                        #如果工具下载失败,直接退出
    
    fi
    
    
    
    tar xvf nasm-2.13.tar.gz                                                                            #安装nasm
    
    cd nasm-2.13/ && mkdir /product/{ffmpeg,x264,nasm2-13} -p
    
    ./configure --prefix=/product/nasm2-13
    
    echo $?
    
    if [ $? == 0 ];then
    
    make && make install
    
    echo $?
    
    if [ $? == 0 ];then
    
    echo "nasm   success"  >/media/1.txt
    
    else
    
    	exit
    
    fi
    
    fi
    
    cd ../x264/                                                                                               #安装x264 
    
    ln -s /product/nasm2-13/bin/nasm /usr/bin/nasm
    
    ./configure --enable-shared --enable-static --prefix=/product/x264
    
    echo $?
    
    if [ $? == 0 ];then
    
    make && make install
    
    echo $?
    
    if [ $? == 0 ];then
    
    echo "x264   success"  >> /media/1.txt
    
    else
    
            exit
    
    fi
    
    fi
    
    
    
    cd ..
    
    tar xvf ffmpeg-3.4.2.tar.bz2                                                                                #安装ffmpeg
    
    cd ffmpeg-3.4.2/
    
    ./configure --prefix=/product/ffmpeg/ --enable-shared --disable-ffserver --disable-ffplay --enable-postproc --enable-gpl  --enable-libx264 --disable-asm --extra-cflags=-I/product/x264/include --extra-ldflags=-L/product/x264/lib
    
    echo $?
    
    if [ $? == 0 ];then
    
    make && make install
    
    echo $?
    
    if [ $? == 0 ];then
    
    echo "ffmpeg   success"  >/media/1.txt
    
    else
    
            exit
    
    fi
    
    fi
    
    
    
    
    
    ln -s /product/ffmpeg/bin/ffmpeg /usr/bin/ffmpeg                                                #做链接,写入/etc/ld.so.conf
    
    sed -i '$a/product/x264/bin/'  /etc/ld.so.conf
    
    sed -i '$a/product/x264/lib'  /etc/ld.so.conf
    
    sed -i '$a/product/x264/include/'  /etc/ld.so.conf
    
    ln -s /product/x264/bin/x264  /usr/bin/x264
    
    
    
    sed -i '$a/product/ffmpeg/lib/'  /etc/ld.so.conf
    
    sed -i '$a/product/ffmpeg/include/' /etc/ld.so.conf
    
    ldconfig
  • 相关阅读:
    神奇的Batch Normalization 仅训练BN层会发生什么
    解决过拟合:如何在PyTorch中使用标签平滑正则化
    精度是远远不够的:如何最好地评估一个分类器?
    文本挖掘实战:看看国外人们在病毒隔离期间都在家里做什么?
    翻车现场:我用pytorch和GAN做了一个生成神奇宝贝的失败模型
    mysql安装步骤
    zabbix 02 监控项自定义
    zabbix 01 介绍安装
    Git 、Jenkins (三)Jenkins 安装部署
    Git 、Jenkins (二)Gitlub安装部署
  • 原文地址:https://www.cnblogs.com/Archger/p/12774655.html
Copyright © 2011-2022 走看看