ffmpeg开发环境搭建

ffmpeg开发环境搭建

源码下载

http://www.ffmpeg.org/download.html
点进去下载源码即可。

编译和安装

解压文件夹后可以看到一个INSTALL.md,里面写了详细的安装过程。
这里编译静态库并安装到指定目录,方便后续开发。但是文档里好像没写怎么这样做,help一下。

./configure --help

正好可以使用–prefix指定安装目录。
在这里插入图片描述

# 配置
./configure --prefix=./_install --disable-x86asm
# 编译
make
# 安装
make install

在这里插入图片描述

测试

使用cmake写一个测试。

目录:

.
├── build
├── CMakeLists.txt
├── ffmpeg_test.c
├── include
│   ├── libavcodec
│   ├── libavdevice
│   ├── libavfilter
│   ├── libavformat
│   ├── libavutil
│   ├── libswresample
│   └── libswscale
└── lib
    ├── libavcodec.a
    ├── libavdevice.a
    ├── libavfilter.a
    ├── libavformat.a
    ├── libavutil.a
    ├── libswresample.a
    ├── libswscale.a
    └── pkgconfig

ffmpeg_test.c:


#include "libavcodec/avcodec.h"

int main()
{
    printf("avcodec_version %d\n",avcodec_version());
    return 0;
}

CMakeLists.txt:

cmake_minimum_required(VERSION 3.0)
project(ffmpeg_test)

include_directories(./include)
link_directories(./lib)

set(SRC_LIST
    ./ffmpeg_test.c
)

add_executable(ffmpeg_test ${SRC_LIST})

target_link_libraries(ffmpeg_test avcodec avdevice avfilter avformat avutil swresample swscale)

结果:
在这里插入图片描述

交叉编译

海思3516交叉编译

./configure \
--prefix=./_install_35116 \
--cross-prefix=arm-himix200-linux- \
--arch=arm \
--target-os=linux \
--disable-asm \
--enable-ffmpeg \
--disable-ffplay \
--enable-pthreads \
--enable-cross-compile \
--host-os=linux \
--enable-gpl \

CMakeLists.txt样例:

cmake_minimum_required(VERSION 3.0)
project(ffmpeg_test)

set(CMAKE_C_COMPILER "arm-himix200-linux-gcc")

include_directories(./include)
link_directories(./lib)

set(SRC_LIST
    ./ffmpeg_test.c
)

add_executable(ffmpeg_test ${SRC_LIST})

target_link_libraries(
    ffmpeg_test 
    
    pthread 
    avfilter
    avformat
    avcodec
    avutil
    swresample
    swscale
    m  
    z
)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值