问题描述
我写一个Android应用程序中,我将不得不创建逐帧使用来自手机的图片视频帧。环顾了一段时间,我还没有遇到任何合适的图书馆我需要什么。我的要求是,它应该写在Java或C和,这将是开源的,因为我是pretty的肯定,关于内存脚印的修改是必要的。谢谢大家提前,乔治。
I am writing an Android application in which I'll have to create a video frame by frame using pictures from the phone. Looking around for some time, I haven't come across any suitable library for what I need. My requirements are that it should be written in Java or in C and that it will be open source because I am pretty sure that modifications regarding the memory foot print will be required. I thank you all in advance, George.
推荐答案
您应该尝试OpenCV库,阅读和写作图像和视频。
You should try OpenCV library, Reading and Writing Images and Video.
CreateVideoWriter
CreateVideoWriter(文件名,FOURCC,FPS,frame_size,is_color)→CvVideoWriter创建视频文件作家。
CreateVideoWriter(filename, fourcc, fps, frame_size, is_color) → CvVideoWriterCreates the video file writer.
参数:文件名(STR) - 输出的视频文件的名称。FOURCC(INT) - 4字符$ C $的codeC用c COM preSS帧。例如,CV_FOURCC(P,我,M1)是一个MPEG-1 $ C $立方厘米,CV_FOURCC(M,J,P,G)是一个运动JPEG codeC等在Win32下,可以传递-1以选择COM pression方式,并从对话框中附加的COM pression参数。在Win32下,如果为0,同时使用一个AVI文件名传递,将创建一个用于创建一个uncom pressed AVI文件的视频作家。FPS(浮) - 创建视频流的帧率。frame_size(CvSize) - 视频帧的大小。is_color(INT) - 如果不是零,则EN codeR将期待和连接code颜色框,否则会与灰度帧工作(该标志目前仅在Windows上支持)。该功能cvCreateVideoWriter创建视频作家的结构。
Parameters:filename (str) – Name of the output video file.fourcc (int) – 4-character code of codec used to compress the frames. For example, CV_FOURCC('P','I','M,'1') is a MPEG-1 codec, CV_FOURCC('M','J','P','G') is a motion-jpeg codec etc. Under Win32 it is possible to pass -1 in order to choose compression method and additional compression parameters from dialog. Under Win32 if 0 is passed while using an avi filename it will create a video writer that creates an uncompressed avi file.fps (float) – Framerate of the created video stream.frame_size (CvSize) – Size of the video frames.is_color (int) – If it is not zero, the encoder will expect and encode color frames, otherwise it will work with grayscale frames (the flag is currently supported on Windows only).The function cvCreateVideoWriter creates the video writer structure.
WriteFrame
WriteFrame(作家,图像)→INT写一个帧的视频文件。
WriteFrame(writer, image) → intWrites a frame to a video file.
参数:作家(CvVideoWriter) - 视频作家结构图像(IplImage结构) - 写入帧功能cvWriteFrame写入/追加一帧到视频文件
Parameters:writer (CvVideoWriter) – Video writer structureimage (IplImage) – The written frameThe function cvWriteFrame writes/appends one frame to a video file.
下面是另一个链接。
这篇关于一帧一帧的视频库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!