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)