ffmpeg初步开发

ffmpeg脚本命令

格式转换

编译并运行的粗暴脚本

g++ -o test.o qwe.cpp `pkg-config --libs libavcodec     libavdevice    libavfilter    libavformat    libavresample  libavutil      libpostproc    libswresample  libswscale`&& ./test.o

编译连接测试代码

extern "C"//函数名不能变
{
#include<stdint.h>
#include<libavutil/log.h>
#include<libavformat/avformat.h> 
}
int main()
{
    av_log_set_level(AV_LOG_DEBUG);
    av_log(NULL,AV_LOG_INFO,"whoami:%s\n","crabxmz");
    return 0;
}

dump mp4的视频信息

extern "C"
{
#include<stdint.h>
#include<libavutil/log.h>
#include<libavformat/avformat.h> 
}
int main()
{
    AVFormatContext *fmt_ctx=NULL;
    av_log_set_level(AV_LOG_INFO);
    av_register_all();
    int ret=avformat_open_input(&fmt_ctx,"./1.mp4",NULL,NULL);
    if(ret<0)
    {
        av_log(NULL,AV_LOG_ERROR,"whoami:%s\n","crabxmz");
    }
    av_dump_format(fmt_ctx,0,"./1.mp4",0);
    avformat_close_input(&fmt_ctx);
    return 0;
}

一般成对出现的函数

int 	avio_open (AVIOContext **s, const char *url, int flags)
int 	avio_closep (AVIOContext **s)    


全部评论

相关推荐

点赞 评论 收藏
分享
09-13 17:25
亲切的00后在笔试:我也遇到了,所以我早他一步查看图片
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务