问题
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:
How can I create standard AVI or MPEG file with header and etc?
回答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.
回答2:
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.
来源:https://stackoverflow.com/questions/15446975/programmatically-add-avi-file-header-to-video-stream