测试环境 ffmpeg 安装成功与否的例子:
-
-
-
-
-
-
-
//#define dbmsg(fmt, args ...) printf("cong:%s:%s[%d]: "fmt"\n",__FILE__, __FUNCTION__, __LINE__,##args)
-
int main( int argc, char **argv)
-
{
-
int i= 0;
-
AVFormatContext *pFormatCtx = NULL;
-
avcodec_register_all();
-
-
avdevice_register_all();
-
-
avfilter_register_all();
-
av_register_all();
-
-
if(avformat_open_input(&pFormatCtx, argv[ 1], NULL, NULL)!= 0)
-
return - 1; // Couldn't open file
-
-
if(avformat_find_stream_info(pFormatCtx, NULL)< 0)
-
return - 1; // Couldn't find stream inform
-
av_dump_format(pFormatCtx, 0, 0, 0);
-
-
return 0;
-
}
-
FFMPEG =/usr/ local/ffmpeg
-
CC =gcc
-
CFLAGS =-g -I$(FFMPEG)/include
-
LDFLAGS = -L$(FFMPEG)/lib / -lswscale -lswresample -lavformat -lavdevice -lavcodec -lavutil -lavfilter -lm
-
TARGETS = test
-
all: $(TARGETS)
-
test:test .c
-
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) -std=c++11 #注意这里的-std=c++11
-
-
clean:
-
rm -rf $(TARGETS)
7.make
8../test