ffmpeg编译硬转码

ffmpeg4.2.2编译+ubuntu18.02


--prefix=/home/firefly/work/soft/install_ffmpeg4.2.2 --pkg-config-flags=--static --extra-cflags=-I/home/firefly/work/lib_build/include --extra-ldflags=-L/home/firefly/work/lib_build/lib --extra-libs='-lpthread -lm' --bindir=/home/server/bin --disable-shared --disable-ffplay --enable-ffmpeg --enable-pthreads --enable-static --enable-swscale --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --disable-libopus --disable-libvorbis --enable-libvpx --enable-libx264 --enable-pic --enable-nonfree 

1、ERROR: libfdk_aac not found
wget https://downloads.sourceforge.net/opencore-amr/fdk-aac-2.0.1.tar.gz
./configure --prefix=/home/firefly/work/lib_build/
make && make install
2、报错:ERROR: libmp3lame >= 3.98.3 not found
wget https://nchc.dl.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
./configure --prefix=/home/firefly/work/lib_build/
make && make install
3、libvpx enabled but no supported decoders found
https://codeload.github.com/webmproject/libvpx/tar.gz/v1.8.2 网页下载
./configure --prefix=/home/firefly/work/lib_build/
make && make install
4、ERROR: libx264 not found
git clone https://code.videolan.org/videolan/x264.git
./configure --prefix=/home/firefly/work/lib_build/
4.1 Minimum version is nasm-2.13
https://www.nasm.us/pub/nasm/releasebuilds/2.13/
./configure --prefix=/home/firefly/work/lib_build/
make && make install
export PATH=/home/firefly/work/lib_build/bin:$PATH
make && make install

 

(2)瑞星微3299+ubuntu18编译

在以上基础上添加

5、log中显示没有libass

 git clone https://github.com/libass/libass.git

./autogen.sh

./configure 

make && make install

5.1 configure: error: Package requirements (fribidi >= 0.19.0) were not met:

     git clone https://github.com/libass/libass.git    

     ./autogen.sh

     ./configure 

     make && make install
二、编译显卡
1、lspci | grep VGA
sudo vim /etc/modprobe.d/blacklist.conf
blacklist vga16fb
blacklist nouveau
blacklist rivafb
blacklist rivatv
blacklist nvidiafb
sudo update-initramfs -u
sudo apt-get install make //目前使用4.1版本
sudo reboot

sudo ./NVIDIA-Linux-x86_64-440.82.run 
sudo ./cuda_10.2.89_440.33.01_linux.run
2、--prefix=/home/firefly/work/soft/install_ffmpeg4.2.2 --pkg-config-flags=--static --extra-cflags=‘-I/home/firefly/work/lib_build/include -I/usr/local/cuda/include’ --extra-ldflags=‘-L/home/firefly/work/lib_build/lib -L/usr/local/cuda/lib64’ --extra-libs='-lpthread -lm' --disable-shared --enable-ffplay --enable-ffmpeg --enable-pthreads --enable-static --enable-swscale --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --disable-libopus --disable-libvorbis --enable-libvpx --enable-libx264 --enable-pic --enable-nonfree --enable-cuda --enable-cuvid --enable-nvenc --enable-libnpp
make
3、ERROR: cuvid requested, but not all dependencies are satisfied: ffnvcodec 
git clone https://git.videolan.org/git/ffmpeg/nv-codec-headers.git

// 查看硬解码器
ffmpeg -codecs | grep cuvid

// 查看硬编码器
ffmpeg -codecs | grep nvenc

三、硬件转码
./bin/ffmpeg -hwaccel cuvid -c:v mpeg4_cuvid -i ribuluo.mp4 -c:v h264_nvenc -b:v 2048k -vf scale_npp=1280:-1 -r 29.97 -ab 128000 -ar 44100 -y out.mp4 //视频mpeg4编码
-hwaccel cuvid:指定使用cuvid硬件加速
-c:v mpeg4_cuvid:使用mpeg4进行视频解码
-c:v h264_cuvid:使用h264_cuvid进行视频解码
-c:v h264_nvenc:使用h264_nvenc进行视频编码
-vf scale_npp=1280:-1:指定输出视频的宽高,高-1代表按照比例自动适应
-b:v:指定输出视频的码率,即输出视频每秒的bit数
-ab bitrate 设置音频码率 (128000)
-ar freq 设置音频采样率(16000)

四、视频文件的编码格式 
H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 ——》h264
MPEG-4 part 2 ——》mpeg4

五、ffmpeg使用需要安装指令
sudo apt-get install libsdl2-2.0
sudo apt-get install libsdl2-dev
 

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值