views:

230

answers:

4

I have a video decrypter library that can decode an obsolete video format, and returns video frames in BMP and audio in WAV through callback functions. Now I need to encode a new video in any standard format under windows.

What might be the standard way to do this? I am using Win32/C. I guess Windows has its own encoding library and drivers and I don’t need to use FFMPEG. Any pointer to an example code or at least to a library to look at will be greatly helpful.

Edit: I accept. FFMPEG is the easiest way to do it.

+1  A: 

I would suggest looking at the VirtualDub source code. It's a well known encoder that uses VFW. You may be able to get some ideas from that software.

Chris Thompson
+5  A: 

On Windows, you have two native choices.

  1. The old Windows Multimedia library which is too ancient to seriously consider, but does have the Video Compression Manager.
  2. And then there's DirectShow.

It's certainly doable through DirectShow, but you better enjoy COM programming and the concepts of Filters, Graphs, and Monikers (oh my). See this tutorial for a crash course:

Recompressing an AVI File

And the MSDN documentation.

A simpler approach is indeed to use an library like FFMPEG or VLC.

Frank Krueger
+4  A: 

To save yourself heartache, I echo Frank's suggestion of just using FFMPEG. Executing a separate FFMPEG process with the correct arguments will 100% be the easiest way to achieve your goals of encoding.

Your other options include:

libavcodec - The central library used in FFMPEG. I warn there don't appear to be many Windows binaries of libavcodec available, so you'd probably have to compile your own, which, at minimum, would require a Cygwin or MingW set up.

ffdshow-tryouts - A video codec library implemented as a DirectShow filter based on libavcodec. They do seem to have an API for manipulating it, but it's a .NET library.

Falaina
+1  A: 

There is a little bit about compression using vfw in Bitmaps to video

mikej
That was really excellent!
CDR