首先在google的网站下载ffmpeg-0.6.1_libvpx-v0.9.5-135-gc28b10a.diff.gz和libvpx-v0.9.5.tar.bz2
在下载ffmpeg-0.6.1
把补丁文件mv到ffmpeg-0.6.1目录下
打补丁
patch -p1 < ffmpeg-0.6.1_libvpx-v0.9.5-135-gc28b10a.diff
首先编译安装libvpx
配置文件为 ./configure --prefix=/usr/local/libvpx --enable-shared --enable-vp8
交叉编译配置
./configure --target=armv6-linux-gcc --prefix=/usr/local/libvpx-arm --enable-shared --enable-vp8
提示错误yasm
解决方法:sudo apt-get install yasm
make
sudo make install
然后编译安装ffmpeg
配置文件为
./configure --prefix=/usr/local/ffmpeg-vp8-x86 --enable-libvpx --enable-shared --cc=gcc --extra-cflags=-I/usr/local/libvpx/include --extra-ldflags=-L/usr/local/libvpx/lib
提示错误
libavcodec/libvpxenc.c:111: error: ‘VP8E_SET_CQ_LEVEL’ undeclared here (not in a function)
libavcodec/libvpxenc.c:111: error: array index in initializer not of integer type
libavcodec/libvpxenc.c:111: error: (near initialization for ‘ctlidstr’)
libavcodec/libvpxenc.c: In function ‘vp8_init’:
libavcodec/libvpxenc.c:284: error: ‘VPX_CQ’ undeclared (first use in this function)
libavcodec/libvpxenc.c:284: error: (Each undeclared identifier is reported only once
libavcodec/libvpxenc.c:284: error: for each function it appears in.)
libavcodec/libvpxenc.c: At top level:
libavcodec/libvpxenc.c:567: warning: initialization discards qualifiers from pointer target type
解决方法 打开/usr/local/libvpx/include/vp8cx.h
enum vp8e_enc_control_id
{
VP8E_UPD_ENTROPY = 5, /**< control function to set mode of entropy update in encoder */
VP8E_UPD_REFERENCE, /**< control function to set reference update mode in encoder */
VP8E_USE_REFERENCE, /**< control function to set which reference frame encoder can use */
VP8E_SET_ROI_MAP, /**< control function to pass an ROI map to encoder */
VP8E_SET_ACTIVEMAP, /**< control function to pass an Active map to encoder */
VP8E_SET_SCALEMODE = 11, /**< control function to set encoder scaling mode */
VP8E_SET_CPUUSED = 13, /**< control function to set vp8 encoder cpuused */
VP8E_SET_ENABLEAUTOALTREF, /**< control function to enable vp8 to automatic set and use altref frame */
VP8E_SET_NOISE_SENSITIVITY, /**< control function to set noise sensitivity */
VP8E_SET_SHARPNESS, /**< control function to set sharpness */
VP8E_SET_STATIC_THRESHOLD, /**< control function to set the threshold for macroblocks treated static */
VP8E_SET_TOKEN_PARTITIONS, /**< control function to set the number of token partitions */
VP8E_GET_LAST_QUANTIZER, /**< return the quantizer chosen by the
encoder for the last frame using the internal
scale */
VP8E_GET_LAST_QUANTIZER_64, /**< return the quantizer chosen by the
encoder for the last frame, using the 0..63
scale as used by the rc_*_quantizer config
parameters */
VP8E_SET_ARNR_MAXFRAMES, /**< control function to set the max number of frames blurred creating arf*/
VP8E_SET_ARNR_STRENGTH , /**< control function to set the filter strength for the arf */
VP8E_SET_ARNR_TYPE , /**< control function to set the type of filter to use for the arf*/
VP8E_SET_CQ_LEVEL ,
} ;
VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_UPD_ENTROPY, int)
VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_UPD_REFERENCE, int)
VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_USE_REFERENCE, int)
VPX_CTRL_USE_TYPE(VP8E_SET_ROI_MAP, vpx_roi_map_t *)
VPX_CTRL_USE_TYPE(VP8E_SET_ACTIVEMAP, vpx_active_map_t *)
VPX_CTRL_USE_TYPE(VP8E_SET_SCALEMODE, vpx_scaling_mode_t *)
VPX_CTRL_USE_TYPE(VP8E_SET_CPUUSED, int)
VPX_CTRL_USE_TYPE(VP8E_SET_ENABLEAUTOALTREF, unsigned int)
VPX_CTRL_USE_TYPE(VP8E_SET_NOISE_SENSITIVITY, unsigned int)
VPX_CTRL_USE_TYPE(VP8E_SET_SHARPNESS, unsigned int)
VPX_CTRL_USE_TYPE(VP8E_SET_STATIC_THRESHOLD, unsigned int)
VPX_CTRL_USE_TYPE(VP8E_SET_TOKEN_PARTITIONS, vp8e_token_partitions)
VPX_CTRL_USE_TYPE(VP8E_SET_ARNR_MAXFRAMES, unsigned int)
VPX_CTRL_USE_TYPE(VP8E_SET_ARNR_STRENGTH , unsigned int)
VPX_CTRL_USE_TYPE(VP8E_SET_ARNR_TYPE , unsigned int)
VPX_CTRL_USE_TYPE(VP8E_SET_CQ_LEVEL , unsigned int)
VPX_CTRL_USE_TYPE(VP8E_GET_LAST_QUANTIZER, int *)
VPX_CTRL_USE_TYPE(VP8E_GET_LAST_QUANTIZER_64, int *)
的代码加两条红色部分
编辑 libavcodec/libvpxenc.c:284
将 VPX_CQ 改成VPX_VBR