面中引用video-jscs样式文件和videojs
<link href="video-jscss" rel="stylesheet" type="text/css">
<script src="videojs"></script>
面中引用video-jscs样式文件和videojs
<link href="video-jscss" rel="stylesheet" type="text/css">
<script src="videojs"></script>
// 该程序实现视频和的相互转换
// Image_to_video()函数将一组合成AVI视频文件
// Video_to_image()函数将AVI视频文件读入,将每一帧存储为jpg文件
//
////////////////////////////////////////////////////////////////////////
#include <stdlibh>
#include <stdioh>
#include <mathh>
#include <cvh>
#include <highguih>
#define NUM_FRAME 300 //只处理前300帧,根据视频帧数可修改
void Video_to_image(char filename)
{
printf("------------- video to image ----------------\n");
//初始化一个视频文件捕捉器
CvCapture capture = cvCaptureFromAVI(filename);
//获取视频信息
cvQueryFrame(capture);
int frameH = (int) cvGetCaptureProperty(capture, CV_CAP_PROP_FRAME_HEIGHT);
int frameW = (int) cvGetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH);
int fps = (int) cvGetCaptureProperty(capture, CV_CAP_PROP_FPS);
int numFrames = (int) cvGetCaptureProperty(capture, CV_CAP_PROP_FRAME_COUNT);
printf("\tvideo height : %d\n\tvideo width : %d\n\tfps : %d\n\tframe numbers : %d\n", frameH, frameW, fps, numFrames);
//定义和初始化变量
int i = 0;
IplImage img = 0;
char image_name[13];
cvNamedWindow( "mainWin", CV_WINDOW_AUTOSIZE );
//读取和显示
while(1)
{
img = cvQueryFrame(capture); //获取一帧
cvShowImage( "mainWin", img ); //将其显示
char key = cvWaitKey(20);
sprintf(image_name, "%s%d%s", "image", ++i, "jpg");//保存的名
cvSaveImage( image_name, img); //保存一帧
if(i == NUM_FRAME) break;
}
cvReleaseCapture(&capture);
cvDestroyWindow("mainWin");
}
void Image_to_video()
{
int i = 0;
IplImage img = 0;
char image_name[13];
printf("------------- image to video ----------------\n");
//初始化视频编写器,参数根据实际视频文件修改
CvVideoWriter writer = 0;
int isColor = 1;
int fps = 30; // or 25
int frameW = 400; // 744 for firewire cameras
int frameH = 240; // 480 for firewire cameras
writer=cvCreateVideoWriter("outavi",CV_FOURCC('X','V','I','D'),fps,cvSize(frameW,frameH),isColor);
printf("\tvideo height : %d\n\tvideo width : %d\n\tfps : %d\n", frameH, frameW, fps);
//创建窗口
cvNamedWindow( "mainWin", CV_WINDOW_AUTOSIZE );
while(i<NUM_FRAME)
{
sprintf(image_name, "%s%d%s", "image", ++i, "jpg");
img = cvLoadImage(image_name);
if(!img)
{
printf("Could not load image file\n");
exit(0);
}
cvShowImage("mainWin", img);
char key = cvWaitKey(20);
cvWriteFrame(writer, img);
}
cvReleaseVideoWriter(&writer);
cvDestroyWindow("mainWin");
}
int main(int argc, char argv[])
{
char filename[13] = "infileavi";
Video_to_image(filename); //视频转
Image_to_video(); //转视频
return 0;
}
//---------------------------------------------------
您好,Html5 Video缓冲属性(mediabuffered)返回的是一个对象的缓存范围:
mediabufferedstart(i)mediabufferedend(i)
根据这个缓冲范围,可以实现一些定制的个性效果,如缓冲进度条等。。
以上就是关于videojs怎么获取帧数和时间全部的内容,包括:videojs怎么获取帧数和时间、如何利用opencv 从一段AVI视频中获取每一帧的图像、js怎么获取页面flash或video标签中mp4 缓冲到多少帧或时间等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)