Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read AVI file while being written

Status
Not open for further replies.

patelo

Programmer
Oct 20, 2003
1
0
0
US
Hi

We are developing an application where a capture card captures video from camera and store them on the hard drive as AVI file. The encoding is done on the capture card itself (hardware encoding).

For better managability the files are kept 5 minutes in size. When client requests streaming an archived file with some timestamp, the application starts streaming the AVI from the frame which matches the requested timestamp.

My problem is that when a client requests a timestamp which falls into an current AVI file which is still being written by the application. The application does not release the file for streaming until it reaches 5 min size.

Is there anyway I can read the file while the application is still adding data to it?

Thanks
Jignesh
 
As far as I know you can't do this because Windows buffers it's file output, so you can't be sure the data is actually on the disk until the file is closed.

What I think you could do is change the way you write your AVI to disk. Instead of leaving the file open until the write is complete, you could buffer the data in small chunks, then open the file write a chunk and close it again.

This way the client can wait until the file becomes available then open it nonexclusively, which will allow the file to be re-opened for write access by your application to write the next data chunk.
 
Hi,

I have a similar problem in which the module need to read from the file as it is being generated by the encoder machine. Since it is not possible to interfere with the encoder machine, is it possible to have hooks in the file system so that ones get to read the bytes before they are written to the file?

Thanks and regards,
Deepali
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top