English 中文(简体)
How to use FFmpeg
原标题:

I m trying to extract frames from a video and I ve picked ffmpeg ( tell me if you know something better ) for this task.

I ve downloaded its source and don t know how to use it ?? how can I compile it?

What is the recommended language for it ? I know Python and C++. Please note that my operating system is Windows Vista 64 bit .

最佳回答

If you just want to extract the frames from a video and save them to file, you can just use ffmpeg at the command line:

ffmpeg -i video.avi image%d.jpg

For this method, you do not need to build ffmpeg as there should be a windows binary available for download.

If you are wanting to display the frames or perform some other processing on them, you may want to use libavformat and libavcodec (main parts of the ffmpeg project) to extract the video frames in code. Here is a pretty good tutorial on how to get frames from a video using libavcodec and libavformat. libavformat and libavcodec are C libraries so I would use C or C++ if you want to interface directly to them. There is this python wrapper for ffmpeg that looks promising, but I haven t tried it.

You can download the compiled ffmpeg libraries as well so you shouldn t have to build them yourself. ffmpeg will not build on MSVC++ as per the documentation so you would have to set up a mingw environment.

问题回答

If you know C++, you can modify sample from article using ffmpeg.

If you only want use ffmpeg you should just get a build and not the source itself.

To extract a frame from a video use the following command line:

ffmpeg -i input.avi -r 1 -f image2 -s 120x96 images%05d.png

Where input.avi is your video, 120x96 the dimension of the output image. There are a lot of options you can use to specify the exact frame in the movie, but that would definetely be too much to show here. Take a look at this page to get a more detailed description.

Best wishes,
Fabian





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签