ASF file during power failure

73 Views Asked by At

I'm using WMWriterAdvanced and WriteStreamSample function for writing video data to ASF file and if there is a power failure during writing samples it cause that I lost about last 20 seconds that has been already written to this file. After inspecting file with ASFView I noticed that last 500 packets are just filled with zero bytes. I understand that during power failure its possible to lose some data, but it seems that 20 sec of video is too much.

Why does already written samples are corrupted and is it possible to decrease its amount?

1

There are 1 best solutions below

3
Roman Ryltsov On

The likely reason is that with the file still being open and being written to, internal file buffers were not yet flushed to disk and power failure caused data loss of this data as well as a portion of structure/index data. Damaged file structure might be a reason for not being able to see even some of the data present on the file, but improperly linked to the rest of the content - hence unexpectedly too many seconds of data lost.

It is typical for a file backed by NTFS file system to have zeros on the fragment where power failure prevented the data from reaching the persistent media.