×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Read AVI file while being written

Read AVI file while being written

Read AVI file while being written

(OP)
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

RE: Read AVI file while being written

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.

RE: Read AVI file while being written

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close