1. FFmpeg 的安装

./configure
make
make install

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

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

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

2. FFmpeg 版 Hello world

//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;
}

3. Makefile 编写

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

FFmpeg 版本

[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

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. Python 之 __new__() 方法与实例化

    原文链接:https://www.cnblogs.com/ifantastic/p/3175735.html __new__() 是在新式类中新出现的方法,它作用在构造方法建造实例之前,可以这么理解, ...

  2. 填坑:Java 中的日期转换

    我们之前讨论过时间,在Java 中有一些方法会出现横线?比如Date 过期方法. 参考文章:知识点:java一些方法会有横线?以Date 过期方法为例 Java中的日期和时间处理方法 Date类(官方 ...

  3. oracle、grid 用户ID

    oracle.grid 用户ID [root@db-rac02 rules.d]# id oracle uid=54321(oracle) gid=54321(oinstall) groups=543 ...

  4. JS获取option的value和text

    window.onload = function(){ //首先获得下拉框的节点对象: var select = document.getElementById("s1"); // ...

  5. windows 杀死进程

    查看所有进程: tasklist 查看某一个进程: tasklist | findstr python 杀死进程:taskkill /F /PID python.exe 查看端口占用情况:netsta ...

  6. 三、Python-列表

    一.序列:是一块用于存放多个值的连续内存空间,并且按一定顺序排列,可以通过索引取值 索引:从左到右的索引从0开始依次增加的正整数:从右到左的索引为-1开始的复数 切片(分片):一中获取序列中的元素的方 ...

  7. iOS下 UILabel 如何自动换行

    背景: 相信很多朋友都遇到过,文本的内容长度不一,需要根据内容的多少来自动换行处理. 场景: 很多APP中评论,有的评论长,有的评论短,有的一行,有的多行.   下面以评论的实现为例来说说具体如何实现 ...

  8. C机器级移位,编码表示 无符号编码表示,有符号编码表示一般最常见的方式是补码

    C机器级移位,编码表示 无符号编码表示,有符号编码表示一般最常见的方式是补码  w位补码所能表示的值范围是 首先我们得心知 补码的最高有效位是符号位,当符号位位1是表示的是负值,当符号位是0是,表示的 ...

  9. Tomcat 控制台出现乱码

    本地在启动tomcat时,控制台启动显示乱码 这是因为windows默认编码集为GBK,用startup.bat启动tomcat时,它会读取catalina.bat的代码并打开一个新窗口运行,打开的c ...

  10. VS 编译通过后 链接提示 无法使用的外部符号

    1. 检查是否已经链接了需要的.lib静态库,如果是自己定义的头文件,检查cpp文件是否添加到了VS工程里 2. 头文件尽量不要包含其他头文件,容易造成包含混乱,如头文件里使用了自定义的类名,最好只用 ...