#include "firstqt.h"
#include <QtWidgets/QApplication>
extern "C"{
#include <libavcodec\avcodec.h>
#include <libavformat\avformat.h>
}
static double r2d(AVRational r)
{
return r.num == 0 || r.den == 0 ? 0. : (double)r.num / (double)r.den;
}
int main(int argc, char *argv[])
{
av_register_all();
char *path = "Debug/test.mp4";
AVFormatContext *ic = NULL;
int re = avformat_open_input(&ic,path,0,0);
if (re!=0)
{
char buf[1024] = { 0 };
av_strerror(re,buf,sizeof(buf));
printf("open %s failed:%s\n",path,buf);
getchar();
return -1;
}
int totalSec = ic->duration / AV_TIME_BASE;
printf("file totalSec is %d -%d\n",totalSec/60,to
ffmpeg读取视频帧并显示相关信息
最新推荐文章于 2024-03-16 16:57:45 发布