Patent ID: 7584206

Claim:
A file generating method for generating a file that contains encoded data and management information that manages the encoded data, comprising: a first calculating step of calculating, based on a function of a frame rate and a length of image pickup time of the encoded data being recorded in a predetermined format, a variable data size portion of a capacity thought to be required for recording the management information; a second calculating step of calculating a management information capacity thought to be required for recording the management information based on a fixed data size portion of the capacity and the variable data size portion of the capacity calculated in the first calculating step; a file generating step of generating a new file that reserves a space that is equivalent to the management information capacity calculated in the second calculating step at the head of the file; an encoded data recording step of recording encoded data after the space that is equivalent to the management information capacity in the new file in the predetermined format; a management information generating step of generating management information based on the encoded data that is recorded in the encoded data recording step; a comparing step of comparing the management information capacity and an actual capacity of the management information that is generated in the management information generating step; a control step of executing the encoded data recording step, the management information generating step and the comparing step on encoded data targeted for recording, wherein if it is detected in the comparing step that the management information capacity is smaller than the actual capacity, said control step resets the management information capacity to a greater value by re-executing the first and second calculating steps and generates a new file in the file generating step based on the revised management information capacity, and generates the file by writing the management information generated in the management information generating step in the space that is equivalent to the management information capacity; and a copying step of copying the encoded data that is already written in a previously generated file to the new file after a new file is generated in the file generating step if it is detected in the comparing step that the management capacity is smaller than the actual capacity.