#include <stdio.h>
#include "libavformat/avformat.h"
#include "libavutil/log.h"
int main(int argc, char const *argv[])
{
av_log_set_level(AV_LOG_INFO);
int result;
//文件重命名
result = avpriv_io_move("./1.txt","./2.txt");
if(result < 0){
av_log(NULL,AV_LOG_ERROR,"rename file is failed. \n");
return -1;
}
av_log(NULL,AV_LOG_INFO,"rename file is success. \n");
//文件删除操作
result = avpriv_io_delete("./a.txt");
if(result < 0){
av_log(NULL,AV_LOG_ERROR,"delete file is failed. \n");
return -1;
}
return 0;
}
编译命令gcc -g -o file testfile.c pkg-config --libs libavutil libavformat
如果没有配置好pkg-config 可以使用类库的地址进行编译
gcc -g -o file testfile.c -I …/ffmpeg -L …/ffmpeg/libavutil -lavutil -L …/ffmpeg/libavformat -lavformat。