libfdk-aac和x264安装编译

ffmpeg是音视频必备,但即使从业数年,它似乎依然有无穷的秘密,感兴趣添加笔者微信:YQW1163720468,加入ffmpeg微信群讨论。但记得备注:ffmpeg爱好者

使用libfdk-aac库编码(s16)
libfdk-aac输入的音频格式为s16编码后输出的音频格式为AV_SAMPLE_FMT_FLTP。
在ubuntu16下系统有包:

sudo apt-get install libfdk-aac-dev

在centos7下:
首选要卸载系统原有的fdk-aac,不然使用AV_SAMPLE_FMT_S16格式时会报错:

Specified sample format -1 is invalid or not supported

卸载:

sudo yum remove fdk-aac
git clone https://github.com/mstorsjo/fdk-aac.git

或:

https://sourceforge.net/projects/opencore-amr/files/fdk-aac/

然后编译:

./autogen.sh
./configure CFLAGS=-fPIC
make -j20
sudo make install

在编译ffmpeg时需要增加编译选项:

--enable-nonfree  --enable-libfdk-aac

编译x264,获取网站

http://www.videolan.org/developers/x264.html

打开下载的x264源码,执行

./configure --enable-shared --enable-static --disable-asm 
make
make install

可以看一下x264都支持哪些参数配置

x264 -h
x264 --fullhelp
ffmpeg -h encoder=libx264

这些配置,ffmpeg都有对应的接口来配置。
编译ffmpeg命令:这里增加了h264编码和解码

cd ffmpeg-4.3
make uninstall
./configure --disable-x86asm --enable-shared --enable-libx264 --enable-swscale --enable-avresample --enable-gpl --enable-nonfree  --enable-libfdk-aac --enable-decoder=h264 --prefix=/usr/local
make clean
make -j20
make install

编码后可以查看ffmpeg对x264支持的参数配置,包括支持的像素格式:

ffmpeg -h encoder=libx264

Encoder libx264 [libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10]:
General capabilities: delay threads
Threading capabilities: auto
Supported pixel formats: yuv420p yuvj420p yuv422p yuvj422p yuv444p yuvj444p nv12 nv16 nv21 yuv420p10le yuv422p10le yuv444p10le nv20le
libx264 AVOptions:
-preset E…V… Set the encoding preset (cf. x264 --fullhelp) (default “medium”)
-tune E…V… Tune the encoding params (cf. x264 --fullhelp)
-profile E…V… Set profile restrictions (cf. x264 --fullhelp)
-fastfirstpass E…V… Use fast settings when encoding first pass (default true)
-level E…V… Specify level (as defined by Annex A)
-passlogfile E…V… Filename for 2 pass stats
-wpredp E…V… Weighted prediction for P-frames
-a53cc E…V… Use A53 Closed Captions (if available) (default true)
-x264opts E…V… x264 options
-crf E…V… Select the quality for constant quality mode (from -1 to FLT_MAX) (default -1)
-crf_max E…V… In CRF mode, prevents VBV from lowering quality beyond this point. (from -1 to FLT_MAX) (default -1)
-qp E…V… Constant quantization parameter rate control method (from -1 to INT_MAX) (default -1)
-aq-mode E…V… AQ method (from -1 to INT_MAX) (default -1)
none E…V…
variance E…V… Variance AQ (complexity mask)
autovariance E…V… Auto-variance AQ
autovariance-biased E…V… Auto-variance AQ with bias to dark scenes
-aq-strength E…V… AQ strength. Reduces blocking and blurring in flat and textured areas. (from -1 to FLT_MAX) (default -1)
-psy E…V… Use psychovisual optimizations. (default auto)
-psy-rd E…V… Strength of psychovisual optimization, in : format.
-rc-lookahead E…V… Number of frames to look ahead for frametype and ratecontrol (from -1 to INT_MAX) (default -1)
-weightb E…V… Weighted prediction for B-frames. (default auto)
-weightp E…V… Weighted prediction analysis method. (from -1 to INT_MAX) (default -1)
none E…V…
simple E…V…
smart E…V…
-ssim E…V… Calculate and print SSIM stats. (default auto)
-intra-refresh E…V… Use Periodic Intra Refresh instead of IDR frames. (default auto)
-bluray-compat E…V… Bluray compatibility workarounds. (default auto)
-b-bias E…V… Influences how often B-frames are used (from INT_MIN to INT_MAX) (default INT_MIN)
-b-pyramid E…V… Keep some B-frames as references. (from -1 to INT_MAX) (default -1)
none E…V…
strict E…V… Strictly hierarchical pyramid
normal E…V… Non-strict (not Blu-ray compatible)
-mixed-refs E…V… One reference per partition, as opposed to one reference per macroblock (default auto)
-8x8dct E…V… High profile 8x8 transform. (default auto)
-fast-pskip E…V… (default auto)
-aud E…V… Use access unit delimiters. (default auto)
-mbtree E…V… Use macroblock tree ratecontrol. (default auto)
-deblock E…V… Loop filter parameters, in alpha:beta form.
-cplxblur E…V… Reduce fluctuations in QP (before curve compression) (from -1 to FLT_MAX) (default -1)
-partitions E…V… A comma-separated list of partitions to consider. Possible values: p8x8, p4x4, b8x8, i8x8, i4x4, none, all
-direct-pred E…V… Direct MV prediction mode (from -1 to INT_MAX) (default -1)
none E…V…
spatial E…V…
temporal E…V…
auto E…V…
-slice-max-size E…V… Limit the size of each slice in bytes (from -1 to INT_MAX) (default -1)
-stats E…V… Filename for 2 pass stats
-nal-hrd E…V… Signal HRD information (requires vbv-bufsize; cbr not allowed in .mp4) (from -1 to INT_MAX) (default -1)
none E…V…
vbr E…V…
cbr E…V…
-avcintra-class E…V… AVC-Intra class 50/100/200 (from -1 to 200) (default -1)
-me_method E…V… Set motion estimation method (from -1 to 4) (default -1)
dia E…V…
hex E…V…
umh E…V…
esa E…V…
tesa E…V…
-motion-est E…V… Set motion estimation method (from -1 to 4) (default -1)
dia E…V…
hex E…V…
umh E…V…
esa E…V…
tesa E…V…
-forced-idr E…V… If forcing keyframes, force them as IDR frames. (default false)
-coder E…V… Coder type (from -1 to 1) (default default)
default E…V…
cavlc E…V…
cabac E…V…
vlc E…V…
ac E…V…
-b_strategy E…V… Strategy to choose between I/P/B-frames (from -1 to 2) (default -1)
-chromaoffset E…V… QP difference between chroma and luma (from INT_MIN to INT_MAX) (default -1)
-sc_threshold E…V… Scene change threshold (from INT_MIN to INT_MAX) (default -1)
-noise_reduction E…V… Noise reduction (from INT_MIN to INT_MAX) (default -1)
-x264-params E…V… Override the x264 configuration using a :-separated list of key=value parameters

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 3
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

、、、、燕庆伟、、、、

分享对你有帮助,打赏一下吧!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值