Identification generation method and device, storage medium and electronic device

By determining the partition number and file identification when the target device uploads the multimedia file and generating storage identification, the unique identification problem caused by overlapping multi-partition clocks is solved, ensuring the uniqueness of the file and the normal operation of the query function.

CN119136019APending Publication Date: 2024-12-13ZHEJIANG DAHUA TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411266705.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-10
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

In the prior art, the overlap of multi-partition clocks makes it impossible to generate a unique file identifier, affecting the query and playback functions of video recording and capture files.

Method used

When the multimedia file is uploaded by the target device, the target partition number identification and file identification in the storage device are determined, and the storage identification is generated based on these identifications to ensure the uniqueness of the file, and a unique identification can be generated even in the case of time rollback.

Benefits of technology

It realizes that even when file clock overlaps due to time fallback, a unique storage identity can be generated, solving the problem of not being able to obtain a unique identification file, ensuring the uniqueness of the file and the normal operation of the query function.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119136019A_ABST
    Figure CN119136019A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an identifier generation method and device, a storage medium and an electronic device.The method comprises the steps that under the condition that target equipment is triggered to upload a multimedia file, a partition number identifier of a target partition used for storing the multimedia file is determined, the target partition is a partition in a plurality of partitions included in a storage device for storing the multimedia file; determining a file identifier of the multimedia file stored in a storage device, the file identifier being used for indicating a sequence of the multimedia file stored in the storage device; and generating a storage identifier for identifying the multimedia file based on the partition number identifier and the file identifier. According to the method and the device, the problem that a unique identification file cannot be obtained is solved, and the effect of carrying out unique identification on the file is further achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of communications, and in particular, to a method, device, storage medium and electronic device for generating an identifier. Background Art

[0002] In the related art, for devices that need to record and capture frequently and rely on file identifiers to identify files, when active or passive correction occurs, the time setback of the device will cause the recording and capture file clocks to overlap.

[0003] In the related art, when the clocks in multiple partitions overlap, the traditional SnowFlake algorithm will not be able to generate a unique file identifier for identifying the file, and the file query and playback functions will be affected.

[0004] It can be seen from this that there is a problem in the related technology that a unique identification file cannot be obtained.

[0005] With respect to the above-mentioned problems existing in the related technologies, no effective solution has been proposed yet. Summary of the invention

[0006] The embodiments of the present invention provide a method, device, storage medium and electronic device for generating an identification, so as to at least solve the problem that a unique identification file cannot be obtained in the related art.

[0007] According to one embodiment of the present invention, a method for generating an identifier is provided, comprising: when a target device is triggered to upload a multimedia file, determining a partition number identifier of a target partition for storing the multimedia file, wherein the target partition is a partition among multiple partitions included in a storage device for storing the multimedia file; determining a file identifier for storing the multimedia file in the storage device, wherein the file identifier is used to indicate the order in which the multimedia files are stored in the storage device; and generating a storage identifier for identifying the multimedia file based on the partition number identifier and the file identifier.

[0008] According to another embodiment of the present invention, there is provided an identifier generating device, comprising: a first determination module, for determining a partition number identifier of a target partition for storing a multimedia file when a target device is triggered to upload the multimedia file, wherein the target partition is a partition among a plurality of partitions included in a storage device for storing the multimedia file; a second determination module, for determining a file identifier for storing the multimedia file in the storage device, wherein the file identifier is used to indicate the order in which the multimedia files are stored in the storage device; and a generation module, for generating a storage identifier for identifying the multimedia file based on the partition number identifier and the file identifier.

[0009] According to yet another embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any one of the above method embodiments when run.

[0010] According to yet another embodiment of the present invention, there is provided an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0011] According to yet another embodiment of the present invention, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps of the method described in each embodiment of the present application are implemented.

[0012] Through the present invention, when the target device is triggered to upload a multimedia file, the partition number identifier of the target partition storing the multimedia file and the file identifier of the multimedia file stored in the storage device are determined, wherein the target partition is a partition in the storage device for storing multimedia files, and the file identifier indicates the order in which the multimedia files are stored in the storage device, and a storage identifier for identifying the multimedia file is generated through the partition number identifier of the target partition and the file identifier. Since the storage identifier can be generated according to the partition number identifier of the target partition storing the multimedia file and the file identifier for indicating the order in which the multimedia files are stored in the storage device, it is achieved that even if the time rollback causes the file clock to overlap, the storage identifier that identifies the file can be made unique, so the problem of being unable to obtain a unique identification file can be solved, and the effect of uniquely identifying the file can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] Figure 1 is a hardware structure block diagram of a server device according to a method for generating an identifier according to an embodiment of the present invention;

[0014] Figure 2 is a flow chart of a method for generating an identifier according to an embodiment of the present invention;

[0015] Figure 3 is a schematic diagram of storage identification according to an embodiment of the present invention;

[0016] Figure 4 is a process diagram of generating a video recording service process according to an embodiment of the present invention;

[0017] Figure 5 is a schematic diagram of another identification module according to an embodiment of the present invention;

[0018] Figure 6is a schematic diagram of the distribution of the number of bits of each identification included in the storage identification according to an embodiment of the present invention;

[0019] Figure 7 is a schematic diagram of the structure of a unique ID generation module according to an embodiment of the present invention;

[0020] Figure 8 It is a structural block diagram of a device for generating an identifier according to an embodiment of the present invention. DETAILED DESCRIPTION

[0021] Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings and in combination with the embodiments.

[0022] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0023] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 FIG. 1 is a hardware structure block diagram of a mobile terminal of a method for generating an identification according to an embodiment of the present invention. Figure 1 As shown, the mobile terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the mobile terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the mobile terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.

[0024] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as a computer program corresponding to a method for generating an identifier in an embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the mobile terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0025] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0026] In this embodiment, a method for generating an identifier is provided. Figure 2 is a flow chart of a method for generating an identifier according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:

[0027] Step S202, when the target device is triggered to upload a multimedia file, determining a partition number identifier of a target partition for storing the multimedia file, wherein the target partition is a partition among a plurality of partitions included in a storage device for storing the multimedia file;

[0028] Step S204, determining a file identifier of the multimedia file stored in the storage device, wherein the file identifier is used to indicate the order in which the multimedia files are stored in the storage device;

[0029] Step S206: Generate a storage identifier for identifying the multimedia file based on the partition number identifier and the file identifier.

[0030] In the above embodiment, the target device may be a monitoring device, a camera device, a recording device, etc. The multimedia file may be a picture, a video, a recording, etc., but is not limited thereto. The target device may pre-set a trigger event, and when the trigger event is detected, the target device starts uploading the collected multimedia file. The trigger event may include the detection of a pedestrian, a vehicle, an object, etc., and may also include the appearance of a person, a vehicle, an object, an animal, etc. in the target area. After the trigger event is detected, the target device may collect multimedia files and upload the collected multimedia files to a storage device in real time for storage. The storage device may be a disk of a client connected to the target device, and the client may be connected to multiple target devices at the same time to store multimedia files collected by the target device. The storage device may be divided into multiple partitions, each partition being used to store different multimedia files. Each partition may have a unique partition number identifier. For example, if the storage device is divided into five partitions, the partition number of each partition may be 01, 02, 03, 04, 05. The partition number identifier may be an identifier determined according to the partition number. Determining the partition number identifier according to the partition number may include: determining the partition number as the partition number identifier. It may also include encoding the partition number and determining the encoded value as the partition number identifier. For example, encoding the partition number may include performing a mathematical operation on the partition number and determining the operation result as the encoded value. The mathematical operation may include performing addition, subtraction, multiplication, division, convolution, etc. on the partition number and the partition number and a preset constant.

[0031] In the above embodiment, the file identification of the multimedia file stored in the storage device can also be determined, wherein the file identification can represent the order in which the multimedia file is stored in the storage device. For example, when there are already 10 files in the storage device, and the current multimedia file is the 11th file stored in the storage device, the file identification of the multimedia file can be an identification determined according to 11. That is, the file identification can be determined according to the sequence value of the multimedia file stored in the storage device, and the file identification according to the sequence value of the multimedia file stored in the storage device can include determining the sequence value of the multimedia file as the file identification, and can also include encoding the sequence value, and determining the encoded value as the file identification. Encoding the sequence value can include: performing mathematical operations on the sequence value, and determining the operation result as a number value. The mathematical operation can include adding, subtracting, multiplying, dividing, and convolving the sequence value with the sequence value and a preset constant.

[0032] In the above embodiment, a storage identifier for identifying a multimedia file can be generated based on a partition number identifier and a file identifier. This includes: connecting the partition number identifier and the file identifier to obtain a storage identifier. For example, if the partition number identifier is 01 and the file identifier is 10, the storage identifier can be 0110. Generating a storage identifier for identifying a multimedia file based on a partition number identifier and a file identifier can also include: determining the sum of the partition number identifier and the file identifier as the storage identifier, for example, if the partition number identifier is 01 and the file identifier is 10, the storage identifier is 11. Other mathematical operations can also be performed on the partition number identifier and the file identifier, and the result obtained is determined as the storage identifier. Among them, the mathematical operation can include addition, subtraction, multiplication, division, convolution, etc., and the present invention is not limited to this.

[0033] In the above embodiment, the schematic diagram of storage identification can be found in the attached Figure 3 ,like Figure 3 As shown, the target partition can be represented as the total number of storage partitions in the device. For example, the number of storage partitions in the storage device can be 2 or 3, but is not limited thereto. The file identifier can be a number converted after counting and identifying the file. The file identifiers are independent of each other, and the latter file identifier will not refer to the previous file identifier information. The storage identifier can be an integer composed of 64 bits. While not needing to establish a mapping relationship, it can also reduce the overhead of the device and ensure the uniqueness of the identification file in the multi-partition device.

[0034] In the above embodiment, after the storage identifier is generated, the storage identifier can be superimposed on the multimedia file to obtain the final target multimedia file, and the target multimedia file is stored in the target partition. Figure 4 It is a schematic diagram of the process of storing target multimedia files, such as Figure 4 As shown, the target device can be a camera. When the camera detects a pedestrian event, the code stream module of the camera is triggered to code stream the collected video information, and the multimedia file is transmitted to the storage center. The storage center has a unique ID generation module for generating a storage identifier for the collected multimedia file, and the storage identifier and the multimedia file are stored together in the storage medium. Among them, the storage device can be a storage medium, and the unique ID generation module can generate a result as an integer composed of 64 bits of binary, which is used to identify the uniqueness of the file. That is, the storage identifier can be an integer composed of 64 bits of binary, and can also be an integer of other digits, such as 32 bits, 128 bits, etc., and the present invention is not limited to this.

[0035] Through the present application, when the target device is triggered to upload a multimedia file, the partition number identifier of the target partition storing the multimedia file and the file identifier of the multimedia file stored in the storage device are determined, wherein the target partition is a partition in the storage device for storing multimedia files, and the file identifier indicates the order in which the multimedia files are stored in the storage device, and a storage identifier for identifying the multimedia file is generated by the partition number identifier of the target partition and the file identifier. Since the storage identifier can be generated according to the partition number identifier of the target partition storing the multimedia file and the file identifier for indicating the order in which the multimedia files are stored in the storage device, it is achieved that even if the time rollback causes the file clock to overlap, the storage identifier that identifies the file can be unique, so the problem of being unable to obtain a unique identification file can be solved, and the effect of uniquely identifying the file can be achieved.

[0036] Optionally, the execution subject of the above steps may be a background processor, an NVR (network video recorder) device, etc., but is not limited thereto.

[0037] In an exemplary embodiment, generating a storage identifier for identifying the multimedia file based on the partition number identifier and the file identifier includes: determining other identifiers for identifying the multimedia file, wherein the other identifiers include at least one of the following: a mark bit identifier, a device identifier of the target device, a file start time identifier of the multimedia file, a file execution time identifier of the multimedia file, and a reserved bit identifier, wherein the mark bit identifier is used to indicate an attribute of the storage identifier, the device identifier is used to identify the target device, the file start time identifier is used to identify the creation time of the multimedia file in the storage device, the file execution time identifier is used to identify the duration of the multimedia file, and the reserved bit identifier is used to adjust the number of bits of identifiers included in the storage identifier except the reserved bit identifier; determining a target number of bits for the other identifiers, the partition number identifier, and the file identifier; and writing the other identifiers, the partition number identifier, and the file identifier into the initial identifier according to the target number of bits to obtain the storage identifier.

[0038] In the above embodiment, other identifiers may be identifiers generated by other identifier modules. For schematic diagrams of other identifier generation modules, please refer to the attached Figure 5 ,like Figure 5As shown, other identification modules may include at least one of the following: a mark bit module, a device ID module, a file start timestamp module, a file execution timestamp module, and a reserved bit module. The mark bit module is used to generate a mark bit identifier, the device ID module is used to generate a device identifier, the file start timestamp module is used to generate a file start timestamp of a multimedia file, the file execution timestamp module is used to generate a file execution timestamp of a multimedia file, and the reserved bit module is used to generate a reserved bit identifier. That is, other identifiers may include at least one of the following: a mark bit identifier, a device identifier of a target device, a file start timestamp of a multimedia file, a file execution timestamp of a multimedia file, and a reserved bit identifier.

[0039] In the above embodiment, the mark bit identifier can be used to occupy a digit, fixed to 0, indicating that the storage identification information is a positive number, that is, used to indicate the attribute information of the storage identification. The device identification can be a device ID identifier. When the client connects to the device, the device ID is sent to the client to identify the current device, and the device ID sent by the client is converted into a corresponding digit. For example, if the device ID of the current device identified by the current client is 1, 1 is converted into binary and stored in the device ID module.

[0040] In the above embodiment, the file start time identifier can be used to obtain the difference in seconds between the timestamp of the current file creation and the timestamp of the first device startup, which is used to identify the creation time of the multimedia file in the storage device. For example, if the difference between the timestamp when the file is created and the timestamp when the device is first started is 100 seconds, 100 is converted into binary and stored in the file start time module. The file start time module uses the difference between the file creation timestamp and the timestamp when the device is first started for storage, and the file start time module can identify a range that is nearly twice that of the timestamp module in the traditional SnowFlake algorithm.

[0041] In the above embodiment, the file execution time mark can be used to identify the duration of the multimedia file by calculating the number of seconds of the file execution when the device starts to create it. For example, the timing starts when the video file is created, and ends when the video file ends, and the number of seconds of executing the video file is obtained. By using the file start time module and the file execution time module, the start time and end time of the file can be calculated, which can reduce the need to manually fill in the file start time and end time, and can support clock rollback.

[0042] In the above embodiment, the reserved bit identifier can be used to transfer the remaining bits in the reserved bit module to the required module when other modules need to expand the bit number, which is equivalent to the reserved bit identifier being used to adjust the bit number of identifiers other than the reserved bit identifier. In this embodiment, the storage identification information can be composed of 64 bits, and the reserved bit identifier can store the remaining bits after subtracting the mark bit identifier, device identifier, file start time identifier, file execution time identifier, partition number identifier and file identifier from the 64 bits.

[0043] In the above embodiment, the storage identifier may include only one other identifier or multiple other identifiers in addition to the partition number identifier and the file identifier, but is not limited thereto.

[0044] In the above embodiment, the target number of digits of other identifiers, partition number identifiers and file identifiers can be determined; the other identifiers, partition number identifiers and file identifiers are written into the initial identifier according to the target number of digits to obtain a storage identifier. The initial identifier of a preset length can be pre-set, for example, the initial identifier is 64 bits, and the value in each bit can be empty or 0. After the other identifiers, partition number identifiers and file identifiers and the target number of digits are determined, the other identifiers, partition number identifiers and file identifiers can be written into the initial identifier according to the target number of digits and in a front-to-back order to obtain a storage identifier. For example, the initial identifier is a 64-bit null value, the mark bit identifier in other identifiers is 1, the target number of bits is 1, the device identifier is 10, the target number of bits is 2, the file start time module identifier is 1, the target number of bits is 1, the file execution time module identifier is 10, the target number of bits is 2, the partition number identifier is 1110, the target number of bits is 4, the file identifier is 1010, the target number of bits is 4, then 1 can be written to the first position of the initial identifier, 10 can be written to the second and third positions, 1110 can be written to the fourth, fifth, sixth, and seventh positions, and 1010 can be written to the eighth, ninth, tenth, and eleventh positions. By writing specific characters such as 0 to other positions, a storage identifier can be obtained. When other identifiers also include a reserved bit identifier, it can be determined that the target number of bits for the reserved bit identifier is 64-1-2-1-2-4-4=50 bits.

[0045] In an exemplary embodiment, determining other identifiers for identifying the multimedia file includes: when the other identifier includes the mark bit identifier, converting the attribute value of the storage identifier into a target base to obtain a first value, and determining the first value as the other identifier; when the other identifier includes the device identifier, converting the device number of the target device into a target base to obtain a second value, and determining the second value as the other identifier; when the other identifier includes a file start time identifier, determining a first difference between a creation timestamp of creating the multimedia file in the storage device and a startup timestamp when the target device is first started, converting the first difference into the target base to obtain a third value, and determining the third value as the other identifier; when the other identifier includes a file execution time identifier, determining a second difference between a creation timestamp of creating the multimedia file in the storage device and an end timestamp when the multimedia file acquisition ends, converting the second difference into the target base to obtain a fourth value, and determining the fourth value as the other identifier; when the other identifier includes a reserved bit identifier, determining a target constant as the other identifier.

[0046] In the above embodiment, the target system can be binary, octal, or hexadecimal, but is not limited thereto. The first value can be a binary position representing the storage identification attribute, and the second value can be a binary number converted from the device ID identifier (equivalent to the device identifier). For example, if the device ID of the current device identified by the current client is 1, then 1 is converted into binary and stored in the device ID module, where the second value is 1. The third value can be a binary number converted from the difference between the timestamp of creating the file and the timestamp of the first startup of the target device (equivalent to the first difference). For example, if the difference between the timestamp when the file is created and the timestamp when the device is first started is 100 seconds, then 100 is converted into a binary number and stored in the file start time module.

[0047] In the above embodiment, the fourth value may be a value obtained by binary conversion of the execution seconds of the file, which is equivalent to a binary value obtained by binary conversion of the second difference between the multimedia creation time and the file end time.

[0048] In the above embodiment, when other identifiers include a reserved bit identifier, the target constant may be determined as a reserved bit identifier, and the target constant may be 0, etc., which is not limited in the present invention.

[0049] In an exemplary embodiment, determining the target number of bits of the other identifiers, the partition number identifier, and the file identifier includes: when the other identifier is the mark bit identifier, determining the target number of bits of the mark bit identifier to be the number of values ​​included in the mark bit identifier; when the other identifier is the device identifier, determining the target number of bits of the device identifier to be the number of values ​​included in the device identifier; when the other identifier is the file start time identifier, determining the target number of bits of the file start time identifier to be the number of values ​​included in the file start time identifier; when the other identifier is the file In the case of a file execution time identifier, the target number of bits of the file execution time identifier is determined to be the first number of the numerical value included in the file execution time identifier; the second number of the numerical value included in the partition number identifier is determined, and the target number of bits of the partition number identifier is determined to be the second number; the third number of the numerical value included in the file identifier is determined, and the target number of bits of the file identifier is determined to be the third number; in the case where the other identifier is the reserved bit identifier, the target number of bits of the reserved bit identifier is determined based on the number of bits of the identifiers other than the reserved bit identifier included in the other identifiers, the second number, and the third number.

[0050] In the above embodiment, the target number of bits can be the number of bits stored in each identifier, which respectively determines the number of bits of the mark bit identifier, the device identifier, the file start time identifier, and the file execution time identifier. The first number can be understood as the number of bits occupied by the file execution time identifier, the second number represents the number of bits occupied by the partition number identifier, the third number represents the number of bits occupied by the file identifier, and the number of reserved bits is the number of bits of the stored identifier minus the second number, the third number, and the number of bits of the identifiers other than the reserved bits in other identifiers.

[0051] In an exemplary embodiment, determining the target number of bits of the reserved bit identifier based on the number of bits of identifiers other than the reserved bit identifier included in the other identifiers, the second number, and the third number includes: determining a first sum of the number of bits of identifiers other than the reserved bit identifier included in the other identifiers; determining a second sum of the second number, the third number, and the first sum; obtaining a preset number of identifier bits of the stored identifier; and determining the difference between the number of identifier bits and the second sum as the target number of bits of the reserved bit identifier.

[0052] In the above embodiment, the first sum is expressed as the sum of the number of the mark bit identification digit, the number of the device identification digit, the number of the file start time identification digit and the number of the file execution time identification digit. The second sum is expressed as the sum of the number of the partition number identification digit (i.e., the second number), the number of the file identification digit (i.e., the third number) and the first sum. The number of the reserved digits can be the difference between the number of the identification digits and the second sum. By using the reserved digit identification, the dynamic adjustment of the number of digits of each target identification system can be achieved, and then the digit resources of the target system can be reasonably allocated to generate a unique identification code for identifying files.

[0053] In an exemplary embodiment, determining the target number of bits of the other identifier, the partition number identifier, and the file identifier includes: when the other identifier is the device identifier, determining a first logarithmic function based on the device number of the target device, and determining the target number of bits of the device identifier based on the first logarithmic function; when the other identifier is the file start time identifier, determining a creation timestamp of creating the multimedia file in the storage device and a startup timestamp when the target device is first started, determining a second logarithmic function based on the creation timestamp and the startup timestamp, and determining the target number of bits of the file start time identifier based on the second logarithmic function; when the other identifier is the file execution time identifier, determining a creation timestamp of creating the multimedia file in the storage device and a startup timestamp when the target device is first started, determining a second logarithmic function based on the creation timestamp and the startup timestamp, and determining the target number of bits of the file start time identifier based on the second logarithmic function; In the case of a row time identifier, determine the creation timestamp of the multimedia file created in the storage device and the end timestamp of the multimedia file acquisition end, determine a third logarithmic function based on the creation timestamp and the end timestamp, and determine the target number of bits of the file execution time identifier based on the third logarithmic function; determine the target partition number of the target partition, determine a fourth logarithmic function based on the target partition number, and determine the target number of bits of the partition number identifier based on the fourth logarithmic function; determine the storage sequence number of the multimedia file stored in the storage device, determine a fifth logarithmic function based on the storage sequence number, and determine the target number of bits of the file identifier based on the fifth logarithmic function.

[0054] In the above embodiment, the schematic diagram of the distribution of the number of bits of each identification included in the storage identification can be found in the attached Figure 6 ,like Figure 6 As shown, the mark bit identifier can be 1 bit, the number of bits of the device identifier can be expressed as a, the number of bits of the file start time identifier can be expressed as b, the number of bits of the file execution time identifier can be expressed as c, the number of bits of the partition number identifier can be expressed as d, the number of bits of the file identifier can be expressed as e, and the number of bits of the reserved bit identifier can be expressed as f. That is, the mark bit module stores 1 bit; the device ID module stores a bit; the file start timestamp module stores b bits; the file execution timestamp module stores c bits; the partition number module stores d bits; and the file identifier module stores e bits.

[0055] In the above embodiment, when the other identifier is a device identifier, when determining the target number of bits of the device identifier, the first logarithmic function can be determined according to the device number of the target device, and the target number of bits of the device identifier can be determined according to the first logarithmic function. When the client connects to the device, the device end is notified to connect up to N devices, for example, an NVR device can link up to 256 devices, and N is a maximum of 256. Each device can be numbered, and the number can be expressed as n, then Stn=1,2,3...N. Determining the first logarithmic function according to the device number can include determining the third sum of the device number of the target device and the second constant, and determining the function with the third constant as the base and the logarithm of the third sum rounded up as the first logarithmic function. A device can have M partitions. For example, if there are 2 partitions on the device end, then M is 2.

[0056] In the above embodiment, when the other identifiers are file start time identifiers, the second logarithmic function can be determined based on the creation timestamp of the multimedia file and the startup timestamp when the target device is first started, wherein determining the second logarithmic function may include: determining the first difference between the creation timestamp of the multimedia file and the startup timestamp when the target device is first started and the fourth sum of the fourth constant, and determining the function after rounding up the logarithm of the fourth sum with the fifth constant as the base as the second logarithmic function. The system time when the device is first started can be recorded as ST, for example, 0:0:00 on January 1, 2000, which is converted into a timestamp of 946684800, then ST is 946684800. The timestamp of the file created by the device can be expressed as BT, and the value of b can be 1, 2...32, and the range of the file start time identifier can reach 135 years after the device is first started.

[0057] In the above embodiment, the file execution time can be expressed as rt, and the device capability indicates that a file can be executed for a maximum of RT seconds. For example, a video file can store a maximum of 7200 seconds, then RT is 7200, that is, the maximum value of rt can be 7200 seconds. The difference between the creation timestamp of the multimedia file and the end timestamp of the multimedia file acquisition can be expressed as rt. In other cases where the identifier is the file execution time identifier, the creation timestamp of the multimedia file and the end timestamp of the multimedia file acquisition can be determined, and the third logarithmic function is determined according to the creation timestamp of the multimedia file and the end timestamp of the multimedia file acquisition. Among them, determining the third logarithmic function according to the creation timestamp of the multimedia file and the end timestamp of the multimedia file acquisition can include: determining the second difference between the creation timestamp of the multimedia file and the end timestamp of the multimedia file acquisition, determining the fifth sum of the second difference and the sixth constant, and determining the function after the logarithm of the fifth sum with the seventh constant as the base rounded up as the third logarithmic function.

[0058] In the above embodiment, the device may have multiple M partitions, for example, there are 2 partitions on the device side, and the maximum value of M is 2. The target number of digits d for storing the partition number identifier may be determined according to a fourth logarithmic function determined according to the target partition number, wherein determining the fourth logarithmic function according to the target partition number may include: determining a sixth sum value of the target partition number and an eighth constant, and determining a function after rounding up the logarithm of the sixth sum value with a ninth constant as the base as the fourth logarithmic function, wherein the partition number may be 1, 2…M.

[0059] In the above embodiment, the storage target base digit e of the file identifier can be determined according to the fifth logarithmic function determined based on the storage sequence number of the file, wherein determining the fifth logarithmic function based on the storage sequence number of the file may include: determining the seventh sum of the storage sequence number and the tenth constant, and determining the function after rounding up the logarithm of the seventh sum with the eleventh constant as the base as the fifth logarithmic function.

[0060] In an exemplary embodiment, determining the target number of bits of the file identifier based on the fifth logarithmic function includes: determining the total storage capacity, used storage capacity, and minimum storage capacity of the storage device; determining the ratio of the difference between the total storage capacity and the used storage capacity to the minimum storage capacity; and determining the target number of bits of the file identifier based on the storage sequence number when the storage sequence number is less than or equal to the ratio.

[0061] In the above embodiment, the total storage capacity of the device can be expressed as Q (kB), and the used storage capacity of the device is Qpre (kB). For example, if the total capacity of the device hard disk is 100M, then Q is 102400. The minimum storage capacity of each file can be marked as p (kB). For example, if the minimum storage capacity of the device is 1kB, then p is 1. The storage sequence number can be expressed as the ratio between the difference between the device storage capacity Q and the used storage capacity Qpre and the minimum storage capacity P, where the storage sequence number can be When the storage sequence number is in When the storage sequence number is outside the interval, the target number of digits can be calculated. When the storage sequence number is outside the interval, an alarm operation can be performed.

[0062] In an exemplary embodiment, determining the partition number identifier of the target partition for storing the multimedia file includes: determining the partition number of the target partition; converting the partition number into a target base to obtain a fifth value; and determining the fifth value as the partition number identifier.

[0063] In the above embodiment, the partition number identification of the target partition can be realized by converting the partition number into the target base, and the obtained partition number identification is the fifth value. For example, the partition number of the target partition is 2, and the target base is set to binary, then the partition number identification after conversion is 10 (i.e. the above fifth value).

[0064] In an exemplary embodiment, determining the file identifier of the multimedia file stored in the storage device includes: determining a storage sequence number of the multimedia file stored in the storage device; converting the storage sequence number into a target base to obtain a sixth value; and determining the sixth value as the file identifier.

[0065] In the above embodiment, the file identification of the multimedia file storage can be realized by converting the storage sequence number of the storage device into the target system, and the obtained file identification is the sixth value. For example, the storage sequence number of the multimedia file is 3, and the target system is set to binary, then the converted file identification is 11 (i.e. the above sixth value).

[0066] In the above-mentioned embodiment, the identification generation method can be executed in the unique ID generation module. The structural diagram of the unique ID generation module can be found in the attached Figure 7 ,include:

[0067] The mark bit module 702 is used to generate a mark bit identifier: the generated mark bit identifier occupies one binary bit and is fixed to 0, indicating that the result of the unique ID generation module is a positive number.

[0068] Device ID module 704: used to generate a device ID. When a client connects to a device, the device ID is sent to the client to identify the current device, and the device ID sent by the client is converted into the corresponding binary.

[0069] The file start time module 706 is used to generate a file start time identifier, obtain the difference in seconds between the timestamp of the current file creation and the timestamp of the first startup of the device, and convert it into binary.

[0070] The file execution time module 708 is used to generate a file execution time identifier. When the device starts to create, it starts to calculate the execution seconds of the file and converts it into the corresponding binary.

[0071] Partition number module 710: used to generate a partition number identifier and convert the partition where the file is located into the corresponding binary.

[0072] File identification module 712: used to generate file identification, count and identify files, and convert them into binary.

[0073] The reserved bit module 714 is used to generate a reserved bit identifier. After subtracting the identifiers generated by the mark bit module, the device ID module, the file start time module, the file execution time module, the partition number module and the file identifier module from the 64-bit storage identifier, the remaining binary digits are stored in the reserved bit module, which are all 0 by default. When the remaining modules need to expand the number of digits, the remaining digits in the reserved bit module are transferred to the required modules.

[0074] When a device has multiple partitions, the target number of bits stored in each module can be dynamically adjusted by using the mark bit identifier, device ID identifier, file start time identifier, file execution time identifier, partition number identifier, file identifier, and reserved bit identifier. Even if the device is actively or passively corrected and causes time to roll back, a unique ID can still be obtained to identify the file.

[0075] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.

[0076] In the present embodiment, a device for generating a logo is also provided, and the device is used to implement the above-mentioned embodiment and preferred implementation mode, and the description has been made no further. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware is also possible and conceived.

[0077] Figure 8 is a structural block diagram of a device for generating a mark according to an embodiment of the present invention, such as Figure 8 As shown, the device comprises:

[0078] A first determining module 82 is used to determine a partition number identifier of a target partition for storing the multimedia file when the target device is triggered to upload the multimedia file, wherein the target partition is a partition among multiple partitions included in the storage device for storing the multimedia file;

[0079] A second determining module 84 is used to determine a file identifier of the multimedia file stored in the storage device, wherein the file identifier is used to indicate the order in which the multimedia file is stored in the storage device;

[0080] The generating module 86 is used to generate a storage identifier for identifying the multimedia file based on the partition number identifier and the file identifier.

[0081] In an exemplary embodiment, the generation module 86 can generate a storage identifier for identifying the multimedia file based on the partition number identifier and the file identifier in the following manner: determine other identifiers for identifying the multimedia file, wherein the other identifiers include at least one of the following: a mark bit identifier, a device identifier of the target device, a file start time identifier of the multimedia file, a file execution time identifier of the multimedia file, and a reserved bit identifier, wherein the mark bit identifier is used to indicate the attribute of the storage identifier, the device identifier is used to identify the target device, the file start time identifier is used to identify the creation time of the multimedia file in the storage device, the file execution time identifier is used to identify the duration of the multimedia file, and the reserved bit identifier is used to adjust the number of bits of identifiers included in the storage identifier except the reserved bit identifier; determine the target number of bits for the other identifiers, the partition number identifier, and the file identifier; write the other identifiers, the partition number identifier, and the file identifier into the initial identifier according to the target number of bits to obtain the storage identifier.

[0082] In an exemplary embodiment, the generation module 86 can also determine other identifiers for identifying the multimedia file in the following manner: when the other identifier includes the mark bit identifier, convert the attribute value indicating the storage identifier into the target base to obtain a first value, and determine the first value as the other identifier; when the other identifier includes the device identifier, convert the device number of the target device into the target base to obtain a second value, and determine the second value as the other identifier; when the other identifier includes the file start time identifier, determine a first difference between a creation timestamp of creating the multimedia file in the storage device and a startup timestamp when the target device is first started, convert the first difference into the target base to obtain a third value, and determine the third value as the other identifier; when the other identifier includes the file execution time identifier, determine a second difference between a creation timestamp of creating the multimedia file in the storage device and an end timestamp when the multimedia file acquisition ends, convert the second difference into the target base to obtain a fourth value, and determine the fourth value as the other identifier; when the other identifier includes a reserved bit identifier, determine a target constant as the other identifier.

[0083] In an exemplary embodiment, the generation module 86 can also determine the target number of bits of the other identifiers, the partition number identifier, and the file identifier in the following manner: when the other identifier is the mark bit identifier, the target number of bits of the mark bit identifier is determined to be the number of numerical values ​​included in the mark bit identifier; when the other identifier is the device identifier, the target number of bits of the device identifier is determined to be the number of numerical values ​​included in the device identifier; when the other identifier is the file start time identifier, the target number of bits of the file start time identifier is determined to be the number of numerical values ​​included in the file start time identifier; When the other identifier is the file execution time identifier, the target number of bits of the file execution time identifier is determined to be the first number of the numerical value included in the file execution time identifier; the second number of the numerical value included in the partition number identifier is determined, and the target number of bits of the partition number identifier is determined to be the second number; the third number of the numerical value included in the file identifier is determined, and the target number of bits of the file identifier is determined to be the third number; when the other identifier is the reserved bit identifier, the target number of bits of the reserved bit identifier is determined based on the number of bits of the identifiers other than the reserved bit identifier included in the other identifiers, the second number and the third number.

[0084] In an exemplary embodiment, the generation module 86 can also determine the target number of bits of the reserved bit identifier based on the number of bits of the identifiers other than the reserved bit identifier included in the other identifiers, the second number and the third number in the following manner: determine a first sum of the number of bits of the identifiers other than the reserved bit identifier included in the other identifiers; determine a second sum of the second number, the third number and the first sum; obtain a preset number of identifier bits of the stored identifier; and determine the difference between the number of identifier bits and the second sum as the target number of bits of the reserved bit identifier.

[0085] In an exemplary embodiment, the generation module 86 can also determine the target number of bits of the other identifiers, the partition number identifier, and the file identifier in the following manner: when the other identifier is the device identifier, determine a first logarithmic function based on the device number of the target device, and determine the target number of bits of the device identifier based on the first logarithmic function; when the other identifier is the file start time identifier, determine a creation timestamp of creating the multimedia file in the storage device and a startup timestamp when the target device is started for the first time, determine a second logarithmic function based on the creation timestamp and the startup timestamp, and determine the target number of bits of the file start time identifier based on the second logarithmic function; When the other identifier is a file execution time identifier, determine the creation timestamp of the multimedia file created in the storage device and the end timestamp of the multimedia file acquisition end, determine a third logarithmic function based on the creation timestamp and the end timestamp, and determine the target number of bits of the file execution time identifier based on the third logarithmic function; determine the target partition number of the target partition, determine a fourth logarithmic function based on the target partition number, and determine the target number of bits of the partition number identifier based on the fourth logarithmic function; determine the storage sequence number of the multimedia file stored in the storage device, determine a fifth logarithmic function based on the storage sequence number, and determine the target number of bits of the file identifier based on the fifth logarithmic function.

[0086] In an exemplary embodiment, the generation module 86 can also implement the determination of the target number of bits of the file identifier based on the fifth logarithmic function in the following manner: determine the total storage capacity, used storage capacity and minimum storage capacity of the storage device; determine the ratio of the difference between the total storage capacity and the used storage capacity to the minimum storage capacity; and determine the target number of bits of the file identifier based on the storage sequence number when the storage sequence number is less than or equal to the ratio.

[0087] In an exemplary embodiment, the first determination module 82 can also determine the partition number identifier of the target partition used to store the multimedia file in the following manner: determine the partition number of the target partition; convert the partition number into a target base to obtain a fifth value; and determine the fifth value as the partition number identifier.

[0088] In an exemplary embodiment, the second determination module 84 can also determine the file identifier of the multimedia file stored in the storage device in the following manner: determine the storage sequence number of the multimedia file stored in the storage device; convert the storage sequence number into the target base to obtain a sixth value; and determine the sixth value as the file identifier.

[0089] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.

[0090] An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.

[0091] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0092] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0093] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0094] An embodiment of the present invention further provides a computer program product, including a computer program, which implements the steps of the method in each embodiment of the present application when the computer program is executed by a processor.

[0095] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.

[0096] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.

[0097] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for generating an identification, characterized in that: include: In the case where the target device is triggered to upload a multimedia file, determining a partition number identifier of a target partition for storing the multimedia file, wherein the target partition is a partition among a plurality of partitions included in a storage device for storing the multimedia file; Determining a file identifier of the multimedia file stored in the storage device, wherein the file identifier is used to indicate the order in which the multimedia files are stored in the storage device; A storage identifier for identifying the multimedia file is generated based on the partition number identifier and the file identifier.

2. The method according to claim 1, characterized in that: Generating a storage identifier for identifying the multimedia file based on the partition number identifier and the file identifier includes: Determine other identifiers for identifying the multimedia file, wherein the other identifiers include at least one of the following: a mark bit identifier, a device identifier of the target device, a file start time identifier of the multimedia file, a file execution time identifier of the multimedia file, and a reserved bit identifier, wherein the mark bit identifier is used to indicate an attribute of the storage identifier, the device identifier is used to identify the target device, the file start time identifier is used to identify a creation time of the multimedia file in the storage device, the file execution time identifier is used to identify a duration of the multimedia file, and the reserved bit identifier is used to adjust the number of bits of identifiers other than the reserved bit identifier included in the storage identifier; Determine the target number of bits for the other identifiers, the partition number identifier, and the file identifier; The other identifiers, the partition number identifier and the file identifier are written into the initial identifier according to the target number of bits to obtain the storage identifier.

3. The method according to claim 2, characterized in that The other identifiers determined to be used to identify the multimedia file include: In the case where the other identifier includes the flag bit identifier, converting the attribute value of the storage identifier into a target base to obtain a first value, and determining the first value as the other identifier; In the case where the other identifier includes the device identifier, converting the device number of the target device into a target base to obtain a second value, and determining the second value as the other identifier; In a case where the other identifier includes a file start time identifier, determining a first difference between a creation timestamp of the multimedia file created in the storage device and a startup timestamp when the target device is first started, converting the first difference into a target base to obtain a third value, and determining the third value as the other identifier; In a case where the other identifier includes a file execution time identifier, determining a second difference between a creation timestamp of the multimedia file in the storage device and an end timestamp of when acquisition of the multimedia file ends, converting the second difference into a target base to obtain a fourth value, and determining the fourth value as the other identifier; In the case that the other identifier includes a reserved bit identifier, the target constant is determined as the other identifier.

4. The method according to claim 2, characterized in that: Determining the target number of bits of the other identifiers, the partition number identifier, and the file identifier includes: In the case where the other identifier is the mark bit identifier, determining the target number of bits of the mark bit identifier to be the number of values ​​included in the mark bit identifier; In the case where the other identifier is the device identifier, determining the target number of digits of the device identifier to be the number of numerical values ​​included in the device identifier; In the case where the other identifier is the file start time identifier, determining the target number of digits of the file start time identifier as the number of values ​​included in the file start time identifier; In a case where the other identifier is the file execution time identifier, determining the target number of digits of the file execution time identifier to be the first number of the numerical value included in the file execution time identifier; Determine a second number of the numerical value included in the partition number identifier, and determine the target number of digits of the partition number identifier to be the second number; Determine a third number of the numerical value included in the file identifier, and determine the target number of digits of the file identifier to be the third number; In the case where the other identifier is the reserved bit identifier, the target number of bits of the reserved bit identifier is determined based on the number of bits of the identifiers other than the reserved bit identifier included in the other identifiers, the second number, and the third number.

5. The method according to claim 4, characterized in that Determining the target number of bits of the reserved bit identifier based on the number of bits of identifiers other than the reserved bit identifier included in the other identifiers, the second number, and the third number comprises: Determine a first sum value of the number of digits of the identifiers included in the other identifiers except the reserved bit identifier; determining a second sum of the second number, the third number, and the first sum; Obtaining a preset number of identification digits of the storage identification; The difference between the number of identification bits and the second sum value is determined as the target number of bits for the reserved bit identification.

6. The method according to claim 2, characterized in that Determining the target number of bits of the other identifiers, the partition number identifier, and the file identifier includes: In a case where the other identifier is the device identifier, determining a first logarithmic function based on a device number of the target device, and determining the target number of bits of the device identifier based on the first logarithmic function; In a case where the other identifier is the file start time identifier, determining a creation timestamp of creating the multimedia file in the storage device and a startup timestamp when the target device is first started, determining a second logarithmic function based on the creation timestamp and the startup timestamp, and determining the target number of bits of the file start time identifier based on the second logarithmic function; In a case where the other identifier is a file execution time identifier, determining a creation timestamp of the multimedia file created in the storage device and an end timestamp of the multimedia file acquisition end, determining a third logarithmic function based on the creation timestamp and the end timestamp, and determining the target number of bits of the file execution time identifier based on the third logarithmic function; Determine a target partition number of the target partition, determine a fourth logarithmic function based on the target partition number, and determine the target number of bits identified by the partition number based on the fourth logarithmic function; Determine a storage sequence number for storing the multimedia file in the storage device, determine a fifth logarithmic function based on the storage sequence number, and determine the target number of bits of the file identifier based on the fifth logarithmic function.

7. The method according to claim 6, characterized in that Determining the target number of digits of the file identifier based on the fifth logarithmic function includes: Determining the total storage capacity, used storage capacity, and minimum storage capacity of the storage device; Determining a ratio of a difference between the total storage capacity and the used storage capacity to the minimum storage capacity; In a case where the storage sequence number is less than or equal to the ratio, the target number of bits of the file identifier is determined based on the fifth logarithmic function.

8. The method according to claim 1, characterized in that Determining the partition number identifier of the target partition for storing the multimedia file includes: Determine the partition number of the target partition; Convert the partition number into a target base to obtain a fifth value; The fifth value is determined as the partition number identifier.

9. The method according to claim 1, characterized in that: Determining the file identifier of the multimedia file stored in the storage device includes: Determine a storage sequence number of the multimedia file stored in the storage device; Convert the storage sequence number into a target base to obtain a sixth value; The sixth value is determined as the file identifier.

10. A device for generating a mark, characterized in that: include: a first determining module, configured to determine a partition number identifier of a target partition for storing the multimedia file when the target device is triggered to upload the multimedia file, wherein the target partition is a partition among a plurality of partitions included in the storage device for storing the multimedia file; A second determining module, configured to determine a file identifier of the multimedia file stored in the storage device, wherein the file identifier is used to indicate an order in which the multimedia files are stored in the storage device; A generating module is used to generate a storage identifier for identifying the multimedia file based on the partition number identifier and the file identifier.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program is configured to execute the method according to any one of claims 1 to 9 when executed.

12. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 9.

13. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method described in any one of claims 1 to 9 are implemented.

Citation Information

Patent Citations

  • Global file identification generation method, generation device and corresponding distributed file system

    CN103778120A

  • File encryption method, file decryption method and related devices

    CN115203711A

  • V2X data storage method, V2X data reading method, electronic equipment and storage medium

    CN116225304A

  • Document store export / import

    US20190340278A1