1. Technical Field
The present disclosure is related to a video recorder and a method for adjusting a timestamp of the video recorder.
2. Description of Related Art
A video recorder device records a timestamp of a video frame captured by the video recorder, but a system clock of the video recorder device may be adjusted frequently causing problems. For example, a system time of the video recorder device may be synchronized by a network time protocol (NTP). When the system time is adjusted, a backtracking event occurs when recording the timestamp of the frame because the system time is backtracked. The backtracking event further causes problems for playing and searching. An overflowing record for recording frames of iterative timestamps, or multiple tracks for recording situations before adjustment and after adjustment can be adopted to solve the above problem. However, the above mentioned solutions are complicated and cannot perfectly solve the problems of obfuscating data loading caused by mistaking the timestamp, such as playing and searching, for example.
Therefore, there is room for improvement within the prior art.
Many aspects of the present disclosure can be better understood with reference to the following drawings. The components in the drawings are not necessarily drawn to scale, the emphasis instead being placed upon clearly illustrating the principles of the present embodiments.
In general, the word “module,” as used herein, refers to logic embodied in hardware or firmware, or to a collection of software instructions, written in a programming language. In one embodiment, the program language may be Java, C, or assembly. One or more software instructions in the modules may be embedded in firmware, such as in an EPROM. The modules described herein may be implemented as either software and/or hardware modules and may be stored in any type of non-transitory computer-readable medium or other storage device. Some non-limiting examples of non-transitory computer-readable media include CDs, DVDs, flash memory, and hard disk drives.
The loading module 121 loads the system time of the video recorder 1 and a timestamp of a previous frame recorded by the video recorder 1 when a new frame is recorded by the video recorder 1. For example, an initial value of the timestamp of the previous frame is “zero” which means that the timestamp of the previous frame is a virtual 0th frame to ensure that a previous frame of a first frame can be obtained when the new frame is the first frame.
The determining module 122 determines whether the system time is after the timestamp of the previous frame.
The adjusting module 123 adjusts the system time for the timestamp of the new frame and saves the timestamp of the new frame into the storage device 13 when the system time is after the timestamp of the previous frame.
The adjusting module 123 also adjusts a time which is the timestamp of the previous frame with an addition of a preset time shift for the timestamp of the new frame and saves the timestamp of the new frame into the storage device 13 when the system time is not after the timestamp of the previous frame. The preset time shift may be set according to frames per second (FPS), and the preset time shift is smaller than a time interval of two continuous frames. For example, if the FPS is ten, the preset time shift may be set as zero point zero-one second.
In step S11, when a new frame is recorded by the video recorder 1, the loading module 121 loads the system time of the video recorder 1 and loads the timestamp of the previous frame, and then step S12 is implemented. An initial value of the timestamp of the previous frame is “zero”, which means that the timestamp of the previous frame is a virtual 0th frame to ensure that a previous frame of a first frame can be obtained.
In step S12, the determining module 122 determines whether the system time is after the timestamp of the previous frame. If the system time is after the timestamp of the previous frame, then step S13 is implemented. If the system time is not after the timestamp of the previous frame, then step S14 is implemented.
In step S13, the adjusting module 123 adjusts the system time for the timestamp of the new frame, and saves the timestamp of the new frame into the storage device 13.
In step S14, the adjusting module 123 adjusts a time which is the timestamp of the previous frame with an addition of a preset time shift for the timestamp of the new frame, and saves the timestamp of the new frame into the storage device 13. The preset time shift is set according to FPS of the video recorder 1. The preset time shift is smaller than a time interval of two continuous frames. For example, when the FPS is ten, the preset time shift may be set as zero point zero-one second.
Depending on the embodiment, certain of the steps described may be removed, others may be added, and the sequence of the steps may be altered. It is also to be understood that the description and the claims drawn to a method may include some indication in reference to certain steps. However, the indication used is only to be viewed for identifier purposes and not necessarily as a suggestion as to an order for the steps.
The present disclosure is submitted in conformity with patent law. The above disclosure is the preferred embodiment. Any one of ordinary skill in this field can modify and change the embodiment within the spirit of the present disclosure, and all such changes or modifications are deemed included in the scope of the following claims.
Number | Date | Country | Kind |
---|---|---|---|
101117014 | May 2012 | TW | national |