源码下载
地址: https://github.com/FFmpeg/FFmpeg
git clone https://github.com/FFmpeg/FFmpeg.git
编译和安装
- 因为使用在板端编译,因此没有使用交叉编译链的部分。
- 将如下内容复制到
build.sh, 执行sh build.sh
./configure \
--prefix="$PWD/install" \
--enable-shared \
--target-os=linux \
--arch=aarch64 \
--enable-gpl \
--extra-libs=-ldl \
--extra-cflags="-fPIC" \
--extra-ldflags=-Wl,-Bsymbolic \
--extra-libs="-lpthread -lm"
- 如果没有报错,执行make -j4;make install
- 以上版本工具有
ffmpeg和ffprobe - 接口在install目录下的include和lib
- 以上版本工具有
API简单使用
源代码
xxxxxxxxxxxxxxxxxxxx.hpp
#ifndef FILE_2_FRAME_H__
#define FILE_2_FRAME_H__
#include <thread>
#include <string>
extern "C" {
#include <libavformat/avformat.h>
}
class CFile2Frame {
public:
static constexpr char *RED_START = (char*)"\033[1;31m";
static constexpr char *GREEN_START = (char*)"\033[1;32m";
static constexpr char *COLOR_END = (char*)"\033[0m";
typedef void (*func_data)(char*, int, void*pUser);
public:
CFile2Frame(const std::string &filePath);
~CFile2Frame();
int start();
int videoFormatConversion();
void file2FrameExecLoop(void);
void loop();
static unsigned frameNo_;
private:
bool isExit_;
std::thread *pff_;
func_data frameCb_;
std::string strfileNamePath_;
//ffmpeg
AVFormatContext *ic_{nullptr};
AVDictionary *opts_{nullptr};
AVPacket *pkt;
bool initSucc ; /*初始化成功完成标志, 读帧准备前的初始化*/
int VideoStreamIndex_;
};
#endif

本文介绍了如何下载并编译FFmpeg源码,配置选项,API的简单使用,如视频流处理和帧转换,以及工具的参数说明和解封装操作,最后提到了相关学习资源。
最低0.47元/天 解锁文章
461

被折叠的 条评论
为什么被折叠?



