FFmpeg简介,下载

代码: 

FFmpeg制作解码器_asiwxy的博客-CSDN博客

1. 概述

FFmpeg 全名是Fast Forward MPEG(Moving Picture Experts Group),是一个集成了各种编解码器的库,也就是一堆程序文件,可以实现图像信息的编码、解码,也就是从视频采集、视频编码到视频传输,都可以调用FFmpeg这个库中的代码来完成。并且这个库还有一个牛逼的地方是,他的代码无视平台,Windows和LinuxAndroid、IOS都可以使用。

2. FFmpeg三种版本 

static 版本
静态库版本 里面有3个exe: ffmpeg.exe, ffplay.exe, ffprobe.exe,每个exe体积很大,因为相关的dll已经被编译到exe 里面去了。作为工具而言此版本就可以满足我们的需求。

shared 版本
动态库版本,里面有3个exe:ffmpeg.exe,ffplay.exe , ffprobe.exe ,还有一些dll, 比如说avcodec-54.dll之类的。shared 里面的exe体积很小,因为他们在运行的时候,到相应的dll中调用功能。程序运行过程必须依赖于提供的dll文件。

dev 版本
开发者版本,是用于开发的,里面包含了库文件 xxx.lib 以及头文件 xxx.h,这个版本不包含exe文件。dev版本中include文件夹内文件用途:

libavcodec: 用于各种类型声音、图像编解码
libavdevice: 用于音视频数据采集和渲染等功能的设备相关;
libavfileter:包含多媒体处理常用的滤镜功能;
libavformat:包含多种多媒体容器格式的封装、解封装工具;
libavutil:包含一些公共的工具函数
libpostproc: 用于后期效果处理
libswresample: 用于音频充采用和格式转换等功能;
libswscale: 用于食品场景比例缩放、色彩映射转换;
 

(摘自:FFmpeg三种版本(static、shared、dev)和实际操作举例_ustc_sse_shenzhang的博客-CSDN博客_ffmpeg shared)

3,新版FFmpeg Dev下载

FFmpegDev新版-编解码文档类资源-CSDN下载

只要一个C币,不要的话貌似需要下载码,挺麻烦的。

也可以:https://www.gyan.dev/ffmpeg/builds/ffmpeg-git-github(有点慢,需要自己编好)

如何配置请见雷大佬的PPT。

附加依赖项复制在这儿了:

avcodec.lib
avdevice.lib
avfilter.lib
avformat.lib
avutil.lib
postproc.lib
swresample.lib
swscale.lib

4,被声明为已否决

(1)PIX_FMT_YUV420P -> AV_PIX_FMT_YUV420P

(2)'AVStream::codec': 被声明为已否决:
if(pFormatCtx->streams[i]->codec->codec_type==AVMEDIA_TYPE_VIDEO){
=>
if(pFormatCtx->streams[i]->codecpar->codec_type==AVMEDIA_TYPE_VIDEO){

(3)'AVStream::codec': 被声明为已否决:
pCodecCtx = pFormatCtx->streams[videoindex]->codec;
=>
pCodecCtx = avcodec_alloc_context3(NULL);
avcodec_parameters_to_context(pCodecCtx, pFormatCtx->streams[videoindex]->codecpar);

(4)'avpicture_get_size': 被声明为已否决:
avpicture_get_size(AV_PIX_FMT_YUV420P, pCodecCtx->width, pCodecCtx->height)
=>
#include "libavutil/imgutils.h"
av_image_get_buffer_size(AV_PIX_FMT_YUV420P, pCodecCtx->width, pCodecCtx->height, 1)

(5)'avpicture_fill': 被声明为已否决:
avpicture_fill((AVPicture *)pFrameYUV, out_buffer, AV_PIX_FMT_YUV420P, pCodecCtx->width, pCodecCtx->height);
=>
av_image_fill_arrays(pFrameYUV->data, pFrameYUV->linesize, out_buffer, AV_PIX_FMT_YUV420P, pCodecCtx->width, pCodecCtx->height, 1);

(6)'avcodec_decode_video2': 被声明为已否决:
ret = avcodec_decode_video2(pCodecCtx, pFrame, &got_picture, packet); //got_picture_ptr Zero if no frame could be decompressed
=>
ret = avcodec_send_packet(pCodecCtx, packet);
got_picture = avcodec_receive_frame(pCodecCtx, pFrame); //got_picture = 0 success, a frame was returned
//注意:got_picture含义相反
或者:

int ret = avcodec_send_packet(aCodecCtx, &pkt);
if (ret != 0)
{
prinitf("%s/n","error");
return;
}
while( avcodec_receive_frame(aCodecCtx, &frame) == 0){
//读取到一帧音频或者视频
//处理解码后音视频 frame
}

(7)'av_free_packet': 被声明为已否决:
av_free_packet(packet);
=>
av_packet_unref(packet);

avcodec_decode_audio4:被声明为已否决:

int ret = avcodec_send_packet(aCodecCtx, &pkt);
if (ret != 0){prinitf("%s/n","error");}
while( avcodec_receive_frame(aCodecCtx, &frame) == 0){
//读取到一帧音频或者视频
//处理解码后音视频 frame
}

(8)新的ffmpeg库不需要集中初始化的组建
旧的接口:av_register_all();
新版的API,此处不需要注册组建

(9)编译的时候:遇到main已经定义了,处理方法

#undef main

5,SDL下载

下载路径:

SDL 库安装、环境配置与使用 - 简书

这个说的很明白,下面是如何配置

PPT有点问题:

附加依赖库应该是:

SDL2main.lib
SDL2.lib

测试程序:

extern "C"
{
#include "SDL2/SDL.h"
}

#undef main

int main()
{
	if (SDL_Init(SDL_INIT_VIDEO))
	{
		printf("ERROR");
	}
	else
	{
		printf("Success init SDL!");
	}
}

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值