使用 Clang 编译链接 FFmpeg 库的方法

clang -g -o ffmpeg_log ffmpeg_log.c -I /usr/local/ffmpeg/include -L /usr/local/ffmpeg/lib  -lavutil

参数说明:

-I /usr/local/ffmpeg/include 表示将/usr/local/ffmpeg/include 目录作为第一个寻找头文件的目录

-L /usr/local/ffmpeg/lib 表示将 /usr/local/ffmpeg/lib 目录作为第一个寻找库文件的目录

-lavutil 表示在上面的 lib 的路径中寻找 libavutil.dylib 动态库文件

ffmpeg_log.c

#include <stdio.h>
#include <libavutil/log.h>

int main(int argc, char *argv[])
{
    av_log_set_level(AV_LOG_DEBUG);

    av_log(NULL, AV_LOG_DEBUG, "hello world!\n");

    return 0;
}

Last updated

Was this helpful?