首页源码程序 正文

EasyAVFilter SDK(EasyFFMPEG)

功能概要:
  • 功能概述:简化ffmpeg调用流程,让ffmpeg命令开发与ffmpeg库开发结合

  • 操作系统:Windows、Linux、各种操作系统可定向编译

  • 适用场景:开发者(免费)


EasyAVFilter本质上就是将ffmpeg.exe改造成了动态库方便应用程序集成ffmpeg的各项功能;

函数名称

说明

EasyAVFilter_Create

创建句柄

EasyAVFilter_Release

释放句柄

EasyAVFilter_SetCallback

设置回调函数和自定义指针

EasyAVFilter_AddInput

添加输入参数()

EasyAVFilter_AddFilter

添加中间参数,:转码

EasyAVFilter_SetOutput

设置输出参数(目标)

EasyAVFilter_GetFilters

获取所有参数

EasyAVFilter_Start

开始工作

EasyAVFilter_Stop

停止工作

 

 

所有APIint类型返回值,  0则表示成功,否则为失败;

 

EasyAVFilter_Create

输入:    

输出:    句柄

返回值: 0:成功other:失败

说明:      创建句柄

 

EasyAVFilter_SetCallback

输入:     handle: 句柄

callback: 回调函数

userPtr: 用户自定义指针

输出:      

说明:      设置回调函数和用户自定义指针

 

 

EasyAVFilter_AddInput

输入:  handle: 句柄

     inputUrl:源地址

     connectType: 连接类型  1:tcp other:udp

输出:  

返回值: 0:成功  other: 失败

说明:  添加输入源

 

EasyAVFilter_AddFilter

输入:  handle: 句柄

filterCommand: 中间参数,如转码

     用法1: 在调用EasyAVFilter_AddInput添加了参数后,再调用EasyAVFilter_AddFilter添加的便为中间参数,本质上就是将EasyAVFilter_AddInputEasyAVFilter_AddFilterEasyAVFilter_SetOutput的参数组合成一条完整的命令

用法2:直接调用EasyAVFilter_AddFilter命令将ffmpeg完整命令输入,随后直接调用EasyAVFilter_Start;      

输出:  

返回值: 0:成功  other: 失败

说明:  添加中间处理参数

 

EasyAVFilter_SetOutput

输入:  handle: 句柄

    outputUrl: 输出地址,即目标地址.rtmp://xxx  d:/12.mp4

    transCodeType: 0:自动 1:强制转码为H264

输出

返回值: 0:成功  other: 失败

说明:  设置输出地址

 

 

EasyAVFilter_GetFilters

输入:  handle: 句柄

输出:  outFilterCommand: 完整命令

返回值: 0:成功  other: 失败

说明:  获取所有参数

 

EasyAVFilter_Start

输入:  handle: 句柄

    loop: 1: 循环执行  0:执行过程中如有异常或执行完成则终止

    connectTimeoutSecs: 连接超时时长()

    readTimeoutSecs:读取数据超时时长()

输出

返回值: 0:成功  other: 失败

说明:  开始工作

 

EasyAVFilter_Stop

输入:  handle: 句柄

输出

返回值: 0:成功  other: 失败

说明停止工作

 

EasyAVFilter_Release

输入:  handle: 句柄

输出

返回值: 0:成功  other: 失败

说明释放句柄


 

Linux链接库



-lpthread -ldl -lva -lva-drm -lm


因产品中主要用到了拉转推,调用如下:

int main(intargc, char** argv) {     Easy_HandleavFilterHandle = NULL;     EasyAVFilter_Create(&avFilterHandle); #if 0     // 用法1     EasyAVFilter_AddInput(avFilterHandle[i], "rtsp://admin:12345@192.168.1.100", 1);     EasyAVFilter_AddFilter(avFilterHandle[i], "-vcodec copy -acodec aac");     EasyAVFilter_SetOutput(avFilterHandle[i], "rtmp://192.168.1.200:1935/live/ch1", 0); #else     // 用法2     //const char* pCommand = "-rtsp_transporttcp -i rtsp://admin:12345@192.168.1.100 -vcodec copy -acodec copy -f flv rtmp://192.168.1.200:1935/live/ch1";     char command[512] = { 0 };     char* pCommand = (char*)command;     for (inti = 1; i<argc; i++)     {         pCommand += sprintf(pCommand, " %s", argv[i]);     }     EasyAVFilter_AddFilter(avFilterHandle, command); #endif     charfilterCommand[256] = { 0 };     EasyAVFilter_GetFilters(avFilterHandle, filterCommand);     printf("command: %s\n", filterCommand);     EasyAVFilter_Start(avFilterHandle, 1, 8, 10);     getchar();     EasyAVFilter_Stop(avFilterHandle);     EasyAVFilter_Release(&avFilterHandle);     return 0;



文章版权及转载声明

本文作者:符文浩 网址:http://blog.fuwenhao.com/post/3768.html 发布于 06-14
文章转载或复制请以超链接形式并注明出处。

发表评论

快捷回复:

评论列表 (暂无评论,24人围观)参与讨论

还没有评论,来说两句吧...

取消
微信二维码
微信二维码
支付宝二维码