新婚快乐概不退货_搞笑__hao1,童安格,超牛网
./configure make make install
默认会将 ffmpeg 安装至 /usr/local 目录下(可通过 configure 使用 “-prefix=目录” 修改安装目录),
安装完成后分别会在 /usr/local 下的 bin、include、lib、share 四个目录下生成 ffmpeg 的二进制可执行文件、头文件、编译链接库、文档。
后面开发我们会用到 include、lib 里的头文件和编译链接库。
//testffmpeg.c #include <stdio.h> #include <libavcodec/avcodec.h> #include <libavformat/avformat.h> int main(int argc, char *argv[]) { printf("hello ffmpeg\n"); avformatcontext *pformatctx = avformat_alloc_context(); if (avformat_open_input(&pformatctx, argv[1], null, null)) { fprintf(stderr, "open input failed\n"); return -1; } if (avformat_find_stream_info(pformatctx, null) < 0) { fprintf(stderr, "find stream info failed\n"); return -1; } int videostream = av_find_best_stream(pformatctx, avmedia_type_video, -1, -1, null, 0); printf("nb:%d, url:%s, time:%ld, duration:%ld, bitrate:%ld, videostream:%d\n", pformatctx->nb_streams, pformatctx->url, pformatctx->start_time, pformatctx->duration, pformatctx->bit_rate, videostream); return 0; }
all:helloff cc=gcc clibsflags=-lavformat -lavcodec -lavutil -lswresample -lz -llzma -lpthread -lm ffmpeg=/usr/local cflags=-i$(ffmpeg)/include/ ldflags = -l$(ffmpeg)/lib/ helloff:helloff.o $(cc) -o helloff helloff.o $(clibsflags) $(cflags) $(ldflags) helloff.o:test.c $(cc) -o helloff.o -c test.c $(clibsflags) $(cflags) $(ldflags) clean: rm helloff helloff.o
[ubuntu@ubuntu-virtual-machine testffmpeg]$ ffmpeg -version ffmpeg version 4.1.3 copyright (c) 2000-2019 the ffmpeg developers built with gcc 4.8 (ubuntu 4.8.4-2ubuntu1~14.04.3) configuration: libavutil 56. 22.100 / 56. 22.100 libavcodec 58. 35.100 / 58. 35.100 libavformat 58. 20.100 / 58. 20.100 libavdevice 58. 5.100 / 58. 5.100 libavfilter 7. 40.101 / 7. 40.101 libswscale 5. 3.100 / 5. 3.100 libswresample 3. 3.100 / 3. 3.100
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
如何在没有core文件的情况下用dmesg+addr2line定位段错误
用QT制作3D点云显示器——QtDataVisualization
网友评论