Reading from an open AVI file
I am designing a program that will capture video from a DirectShow compatible card to an AVI file. It is quite possible that the AVI file will be written to for hours at a time. Is there a way to playback video from the file while it is still being written to? If so, can I define a s开发者_如何学Ctarting point and ending point within the file which will comprise my clip? Once I have played the clip I will have no further use for it so I will not need to save it as a new AVI file. Would saving individual frame captures be a better way to accomplish this?
There are two problems. One is that the index table is only written to the file when the graph stops (this is true for AVI and MP4). The other is that the file reader opens files with FILE_SHARE_READ.
If you replace the file reader with one that is compatible with the file being opened for writing, you would then need to access the chunks in the file in sequential order, without the index. This is possible for AVI but not recommended and would require a replacement demux.
Alternatives: you could capture the file in sections, using something like GMFBridge to switch to a new output file without stopping the graph. Then you could access previous output files, but not the current one. Or you could use a non-indexed format such as mpeg-2 PS.
G
精彩评论