ffmpeg 编译打印信息报错,说找不到库文件

来源:5-8 FFmpeg打印音视频Meta信息

平沙落雁式

2019-06-04

mediainfo.c

#include <libavutil/log.h>
#include <libavformat/avformat.h>

int main(int argc, char* argv[]){
	int ret;
	AVFormatContext * fmt_cxt = NULL;

	av_log_set_level(AV_LOG_INFO);

	av_regitster_all();

        ret = avformat_open_input(&fmt_cxt,".test.mp4",NULL,NULL);

	if(ret < 0){
	   av_log(NULL,AV_LOG_ERROR,"Can't open file: %s \n",av_err2str(ret));
	   return -1;
	}
	av_dump_format(fmt_cxt,0,".test.mp4",0);
	avformat_close_input(&fmt_cxt);
	return 0;
}

执行命令 后报错:

clang -g -o mediainfo mediainfo.c pkg-config -libs libavutil libavformat
报错信息:


Unknown option -libs
mediainfo.c:1:10: fatal error: 'libavutil/log.h' file not found
#include <libavutil/log.h>
         ^~~~~~~~~~~~~~~~~
1 error generated.

我本地编译ffmpeg 都有:

 xxxx@bogon  /usr/local/ffmpeg/include  ls -alt
total 0
drwxr-xr-x  82 root  wheel  2624  5 30 10:55 libavutil
drwxr-xr-x  10 root  wheel   320  5 30 10:55 .
drwxr-xr-x   4 root  wheel   128  5 30 10:55 libswscale
drwxr-xr-x   4 root  wheel   128  5 30 10:55 libswresample
drwxr-xr-x   4 root  wheel   128  5 30 10:55 libpostproc
drwxr-xr-x  20 root  wheel   640  5 30 10:55 libavcodec
drwxr-xr-x   5 root  wheel   160  5 30 10:55 libavformat
drwxr-xr-x   6 root  wheel   192  5 30 10:55 libavfilter
drwxr-xr-x   4 root  wheel   128  5 30 10:55 libavdevice
drwxr-xr-x   6 root  wheel   192  5 30 10:55 ..
写回答

1回答

李超

2019-06-04

你的编译命令有问题,仔细看下视频,在pkg-config 前面还有一个特殊的点,是键盘左上角的那个键,另外 后面的参数 —libs 是两个横杠。你最好加入到QQ 群里讨论这个问题。

1
3
李超
没看到我?我就在里边,你直接提问就可以,群号是1025416684
2019-06-06
共3条回复

经典再升级-FFmpeg5.0核心技术精讲,打造音视频播放器

学好FFmpeg核心技术,做高效,高薪,有竞争力的音视频工程师

2726 学习 · 814 问题

查看课程