Patent ID: 8209328

Claim:
A method for seeking a file position of a file, the method comprising: (s1) obtaining a file size “L,” a time length “D” of the file, a packet size “P,” and a specified time point “S” in the file; (s2) determining an identifier (ID) of a main bit stream of the file; (s3) calculating an estimated file position “A” corresponding to the specified time point according to a formula of A=L*(S/D), and rounding A up to a multiple of P; (s4) seeking a packetized elementary stream (PES) of the main bit stream from the estimated file position “A” according to an inverse order, and obtaining a presentation time stamp (PTS) “T” of the found PES, the found PES of the main bit stream being the first stream nearest to the estimated file position “A”; (s5) determining if an absolute value |S−T| is greater than a preset value, and executing steps (s6)-(s7) if the absolute value |S−T| is greater than the preset value, or executing step (s8) if the absolute value |S−T| is less than or equal to the preset value; (s6) re-calculating the estimated file position “A” according to a preset estimation formula, and rounding A up to the next multiple of P; (s7) returning to step (s4) if S is greater than or equal to T, or seeks again a PES of the main bit stream from the estimated file position “A” according to a sequential order if S is less than T, obtains a PTS “T” of the found PES, and returning to step (s5); and (s8) seeking a first I-frame from the estimated file position “A” according to the inverse order if the main bit stream is a video stream, and determining the PES of the first I-frame is an accurate file position of the specified time point “S,” or determining the PES last found in step (s4) or (s7) is the accurate file position of the specified time point “S” if the main bit stream is not the video stream.