0

I have a capturing device (analogue to digital converter: AverMedia USB Capture Card). When I want to record video using DirectShowLib in C#, I only receive frames. I am able to record frames and play the file using RawVideo Player. How can I create a standard video file header like AVI? Second problem occurs when I want to compress the data. When I use compression, I can't read it at all.

Here is my working GraphEdit schema:

enter image description here

How can I create standard AVI or MPEG file with header and etc?

Bo Persson
  • 86,087
  • 31
  • 138
  • 198
Oyle Iste
  • 1
  • 2

2 Answers2

1

The playable files have certain structure and captured data is typically written into such file through so called multiplexer filter. For AVI format, the standard filter is AVI Mux Filter. It takes video/audio on input and converts into file-compatible stream on the output. If/when this output is connected to File Writer Filter, the latter produces the file with proper headers.

Roman R.
  • 64,446
  • 5
  • 83
  • 139
0

Take a look at this you should be able to use this to set up an Avi object, then AddFrame() with your frames to create an avi.

Dutts
  • 5,097
  • 3
  • 34
  • 53
  • Unfortunately I can't do that. Because the code just saves incoming frames to a single file. Can I just add video file header to saved frames? I know frames' width, height and fps. Is it possible? – Oyle Iste Mar 16 '13 at 09:08
  • I downloded DirectShow.NET samples and opened Samples\Capture\DxTuner project. In the project, you can choose a video compressor and create a standard AVI file using DirectShow functions. It records capture device to AVI file. – Oyle Iste Mar 16 '13 at 11:39