1. FFmpeg 的安装

  1. ./configure
  2. make
  3. make install

默认会将 FFmpeg 安装至 /usr/local 目录下(可通过 configure 使用 “-prefix=目录” 修改安装目录),

安装完成后分别会在 /usr/local 下的 bin、include、lib、share 四个目录下生成 FFmpeg 的二进制可执行文件、头文件、编译链接库、文档。

后面开发我们会用到 include、lib 里的头文件和编译链接库。

2. FFmpeg 版 Hello world

  1. //testFFmpeg.c
  2. #include <stdio.h>
  3. #include <libavcodec/avcodec.h>
  4. #include <libavformat/avformat.h>
  5. int main(int argc, char *argv[])
  6. {
  7. printf("hello FFmpeg\n");
  8. AVFormatContext *pFormatCtx = avformat_alloc_context();
  9. if (avformat_open_input(&pFormatCtx, argv[1], NULL, NULL)) {
  10. fprintf(stderr, "open input failed\n");
  11. return -1;
  12. }
  13. if (avformat_find_stream_info(pFormatCtx, NULL) < 0) {
  14. fprintf(stderr, "find stream info failed\n");
  15. return -1;
  16. }
  17. int videoStream = av_find_best_stream(pFormatCtx, AVMEDIA_TYPE_VIDEO, -1, -1, NULL, 0);
  18. printf("nb:%d, url:%s, time:%ld, duration:%ld, bitRate:%ld, videoStream:%d\n",
  19. pFormatCtx->nb_streams, pFormatCtx->url, pFormatCtx->start_time, pFormatCtx->duration,
  20. pFormatCtx->bit_rate, videoStream);
  21. return 0;
  22. }

3. Makefile 编写

  1. all:helloFF
  2. CC=gcc
  3. CLIBSFLAGS=-lavformat -lavcodec -lavutil -lswresample -lz -llzma -lpthread -lm
  4. FFMPEG=/usr/local
  5. CFLAGS=-I$(FFMPEG)/include/
  6. LDFLAGS = -L$(FFMPEG)/lib/
  7. helloFF:helloFF.o
  8. $(CC) -o helloFF helloFF.o $(CLIBSFLAGS) $(CFLAGS) $(LDFLAGS)
  9. helloFF.o:test.c
  10. $(CC) -o helloFF.o -c test.c $(CLIBSFLAGS) $(CFLAGS) $(LDFLAGS)
  11. clean:
  12. rm helloFF helloFF.o

FFmpeg 版本

  1. [ubuntu@ubuntu-virtual-machine testFFmpeg]$ ffmpeg -version
  2. ffmpeg version 4.1.3 Copyright (c) 2000-2019 the FFmpeg developers
  3. built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
  4. configuration:
  5. libavutil 56. 22.100 / 56. 22.100
  6. libavcodec 58. 35.100 / 58. 35.100
  7. libavformat 58. 20.100 / 58. 20.100
  8. libavdevice 58. 5.100 / 58. 5.100
  9. libavfilter 7. 40.101 / 7. 40.101
  10. libswscale 5. 3.100 / 5. 3.100
  11. libswresample 3. 3.100 / 3. 3.100

FFmpeg 开发环境搭建及第一个程序 Hello FFmpeg 编写的更多相关文章

  1. ArcGIS API for JavaScript开发环境搭建及第一个实例demo

    原文:ArcGIS API for JavaScript开发环境搭建及第一个实例demo ESRI公司截止到目前已经发布了最新的ArcGIS Server for JavaScript API v3. ...

  2. 使用IDEA写Python之pytest环境搭建及第一个程序编写

    一.准备篇 Python环境:3.8.3 开发工具:IDEA,对你没有看错 二.IDEA下安装开发环境 1. python的下载 https://www.python.org/downloads/ P ...

  3. Java(1)开发环境配置及第一个程序Hello World

    作者:季沐测试笔记 原文地址:https://www.cnblogs.com/testero/p/15201468.html 博客主页:https://www.cnblogs.com/testero ...

  4. SpringBoot环境搭建及第一个程序运行(详细!)

    spring boot简介 spring boot框架抛弃了繁琐的xml配置过程,采用大量的默认配置简化我们的开发过程. 所以采用Spring boot可以非常容易和快速地创建基于Spring 框架的 ...

  5. Cesium入门2 - Cesium环境搭建及第一个示例程序

    Cesium入门2 - Cesium环境搭建及第一个示例程序 Cesium中文网:http://cesiumcn.org/ | 国内快速访问:http://cesium.coinidea.com/ 验 ...

  6. scala 入门Eclipse环境搭建及第一个入门经典程序HelloWorld

    scala 入门Eclipse环境搭建及第一个入门经典程序HelloWorld 学习了: http://blog.csdn.net/wangmuming/article/details/3407911 ...

  7. VS2013+ffmpeg开发环境搭建

    VS2013+ffmpeg开发环境搭建 转 https://blog.csdn.net/u014253332/article/details/86657868 一.准备ffmpeg相对应开发dll.i ...

  8. VS2013+ffmpeg开发环境搭建-->【转】

    本文转载自:http://blog.csdn.net/qq_28425595/article/details/51488869 版权声明:本文为博主原创文章,未经博主允许不得转载. 今天整理资料时,发 ...

  9. Vue环境搭建及第一个helloWorld

    Vue环境搭建及第一个helloWorld 一.环境搭建 1.node.js环境安装配置  https://www.cnblogs.com/liuqiyun/p/8133904.html 或者 htt ...

随机推荐

  1. Git 分布式版本管理器 windows环境下使用

    首先需要下载Git来安装  没有安装文件的小伙伴可以网盘下载——>   https://pan.baidu.com/s/1owwUItDri9skqYzOjzXLsw 之后安装Git  一路很顺 ...

  2. C# 创建Datatable 并插入数据

    DataTable dt_temp = new DataTable(); dt_temp.Columns.Add("id"); dt_temp.Columns.Add(" ...

  3. hdfs知识点《转》

    HDFS知识点总结   学习完Hadoop权威指南有一段时间了,现在再回顾和总结一下HDFS的知识点. 1.HDFS的设计 HDFS是什么:HDFS即Hadoop分布式文件系统(Hadoop Dist ...

  4. CSS animation-delay:规定动画何时开始

    在CSS中animation-delay的属性为规定动画何时开始.主机吧本文详细介绍下animation-delay的定义和用法.animation-delay的语法.animation-delay的 ...

  5. 河北省重大技术需求征集系统原型(MVC框架业务流程简介)

    这段时间了解了一些MVC框架. 一.MVC简介 MVC 是一种使用 MVC(Model View Controller 模型-视图-控制器)设计创建 Web 应用程序的模式.它的模式是JSP + se ...

  6. supersocket 遇到的Failed to initialize 和 log4net用法

    使用Bootstrap来通过配置启动SuperSocket的时候总是显示Failed to initialize!  , 官网配置中 <superSocket> <servers&g ...

  7. JAVA 数组遍历

    一.遍历List 1.增强for循环 String[] arr = new String[] {"xx","yy","zz"}; for(S ...

  8. JEECG 上传插件升级-标签

    前言: 现有的uploadify上传是基于swf的,随着H5的普及,flash即将退出历史舞台,JEECG团队本着与时俱进的原则,将全面升级JEECG系统中的上传功能,采用新式上传插件plupload ...

  9. Java学习--数组--判断数组中是否包含某个元素的方法

    package zaLearnpackage; import org.apache.commons.lang3.ArrayUtils; import java.util.Arrays; import ...

  10. 使用百度ocr接口识别验证码

    #!/usr/bin/env python #created by Baird from aip import AipOcr def GetCaptchaV(filename): APP_ID = ' ...