如何读取.avi文件C ++ [英] How to read .avi files C++

查看:188
本文介绍了如何读取.avi文件C ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经做了非常少与c ++这么裸的我。

I have done very little with c++ so bare with me.

我想在我正在制作的节目的.avi视频文件中读取。我有文件位置保存为字符串。有没有任何好的教程使用.avi文件在c ++或任何人知道谁读一个?是否与正常文件相同?

I want to read in an .avi video file for a program that I am making. I have the file location saved as a string. Is there any good tutorials on using .avi files in c++ or does anyone know who to read one in? Is it the same as normal files?

感谢您的帮助。我在网上看,但我发现的每一个帖子是一个未回答的问题。

Thanks for the help. I am looking online but every post I find is an unanswered question.

编辑按照要求,这里有一点解释。我有先前询问的问题进入更好的细节,但这里是我想做的:

Edit As requested here is a little explanation. I have a previously asked SO question that goes into better detail but here is what I want to do:

我正在做一个程序,将检测面孔(虽然OpenCV)视频处理器程序,其将检测帧上的每个面部,并将该帧作为图像和面部的 CvRec 返回。

I am making a program that will detect faces (though OpenCV) As of now I have been given a video processor program that will detect each face on a frame, and return the frame as a image and the CvRec of the faces. I want to take these faces and test them to validate that they are all actually faces.

在我拥有所有的面部(测试)之后,我想要拍摄的图像和一起测试。我测试每个框架的面孔的大小和距离的变化。如果脸部经过这个帧长度为两秒,那么我想裁剪脸部并使其成为每个帧的主题。

After I have all the faces (tested) I want to then take the images and test them together. I test the faces on each frame for size and distance changes. If the faces pass this for a frame length of two seconds, then I want to crop the face and make it the subject of each frame.

每个帧裁剪后然后要为用户保存新的视频文件。

After each frame is cropped I then want to save the new video file for the user.

希望有帮助。如果有人需要更好的解释,请告诉我。

Hopefully that helps. If anyone needs a better explanation please let me know.

推荐答案

看来你住在OpenCV内,如果OpenCV被正确编译,它能够将io /编码/解码委派给其他库。 Quicktime和其他例如,但最好是使用ffmpeg。

It seems you are staying within OpenCV so things are easy. If OpenCV is compiled properly it is capable of delegating io/coding/decoding to other libraries. Quicktime and others for example, but best is to use ffmpeg. You open, read and decode everything using the OpenCV API which gives you the video frame by frame.

确保您的OpenCV是使用ffmpeg支持编译的,然后阅读OpenCV教程,您可以使用OpenCV API打开,读取和解码所有内容。关于如何读/写AVI文件。这很容易。

Make sure your OpenCV is compiled with ffmpeg support and then read the OpenCV tutorial on how to read/write AVI files. It's really easy.

使用ffmpeg支持创建OpenCV可能很难。你可能想切换到旧版本的OpenCV如果你不能得到ffmpeg运行与当前的。

Getting OpenCV to be built with ffmpeg support might be hard though. You might want to switch to an older version of OpenCV if you can't get ffmpeg running with the current one.

我个人不会花费时间试图阅读视频由自己和委派任务到OpenCV。这是它应该如何使用。

Personally i would not spent time trying to read the video by yourself and delegate the task to OpenCV. That's how it is supposed to be used.

这篇关于如何读取.avi文件C ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆