Method for accurately calculating whether user finishes playing audio and video in database by using Bitmap
By quantizing the audio and video playback time and using Bitmap technology to store and process user playback records, the problem of difficulty in accurately counting user playback situations in the prior art is solved, and efficient and accurate playback judgments and real-time data processing are achieved.
Patent Information
- Application Number
- CN202411958653.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-05-30
AI Technical Summary
It is difficult for the prior art to accurately count whether the user has finished broadcasting videos in a database, especially the user's playback behavior is discontinuous, and there are repeated playback or skipping.
By quantizing the playback time of audio and video to seconds, and using Bitmap technology to map the user's playback records into the bitmap, each position represents the playback status of one second. The multi-level Bitmap index is used to store the playback records in the database, and the Bitmap union operation OR operation is used to aggregate multiple playback records into a complete playback situation, and finally determine whether the user completes the playback by calculating the number of bits with a value of 1 in Bitmap.
It realizes accurate calculation of whether users have finished playing videos in the database, adapt to diversified playback behaviors, reduces waste of storage space, improves processing efficiency, and supports real-time data processing and high concurrency environments.
Smart Images

Figure CN120067389A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data, and more specifically, to a method for accurately calculating whether a user has completed playing an audio - video in a database by using Bitmap; Background Art
[0002] Bitmap (bitmap) technology is used to process large - scale data quickly and efficiently, and is one of the classic means for database query optimization, especially having important applications in the fields of data analysis and statistics; Historically, the wide application of Bitmap technology began in large data warehouses and online analytical processing (OLAP) systems for efficient multi - dimensional queries and aggregation operations; Its working principle is to store data as 0 and 1 using a bit array to represent different states and existences; For example, in the statistics of video playback completion, 0 represents that the user has not completed playback, and 1 represents completion, which is convenient for directly performing logical operations on the data bitmap to quickly obtain the result; Bitmap is particularly efficient in the application scenario of calculating the audio - video completion rate. It can store a large amount of user data in a compact bitmap, use bit operations to accelerate statistical operations, and is suitable for real - time queries of massive user data; Compared with other methods, Bitmap has high storage efficiency, occupies less storage space, and has fast data retrieval and operation speeds; Using this method, the system can quickly identify whether an audio - video has been completely watched by the user, thereby supporting functions such as user behavior analysis, content recommendation, and advertising placement;
[0003] However, there are deficiencies: An audio - video playback record only stores the start and end time points of the user's playback, plus the total duration of the audio - video. It is very difficult to accurately count in the database whether a user has completed playing a certain audio - video using these three fields; The user's playback behavior is not necessarily continuous. There are situations where a certain segment is played repeatedly or skipped, so it is difficult to accurately identify the completion rate. Summary of the Invention
[0004] The purpose of the present invention is to provide a method for accurately calculating whether a user has completed playing an audio - video in a database by using Bitmap, so as to solve the problems raised in the above - mentioned background art: An audio - video playback record only stores the start and end time points of the user's playback, plus the total duration of the audio - video. It is very difficult to accurately count in the database whether a user has completed playing a certain audio - video using these three fields; The user's playback behavior is not necessarily continuous. There are situations where a certain segment is played repeatedly or skipped, so it is difficult to accurately identify the completion rate.
[0005] Technical Solution: The method for accurately calculating whether a user has completed playing an audio - video in a database by using Bitmap includes the following steps:
[0006] S1. Quantize the playing duration of the audio - video into second - grains; if the video duration is 300 seconds, define a Bitmap with a length of 300, where each position represents the playing state of one second; when the user plays the video, record each second of the play, including the skipped and repeatedly played parts;
[0007] S2. The playing records of each user will be mapped into a Bitmap, where each position of the bitmap corresponds to a playing second of the video; if the user watches the video within a certain second, the position of the bitmap corresponding to that second is 1; if the user skips or does not watch that second, the position is 0;
[0008] S3. For the playing records of each user, use a multi - level Bitmap index to store the playing records in the database; when querying, obtain the playing state of the user at each moment from the Bitmap database;
[0009] S4. If there are multiple playing records, including the user repeatedly playing a certain part, use the OR operation of the union of Bitmaps to aggregate the multiple playing records into a complete playing situation; each time the user plays, the new playing period will update the Bitmap through the union operation;
[0010] The first and second records of user A watching the video will be merged using the Bitmap OR operation, so that each playing moment can be accurately marked;
[0011] S5. Determine whether a certain user has completed playing an audio - video by calculating the number of bits with a value of 1 in the Bitmap; if the number of bits with a value of 1 in the calculated Bitmap is greater than or equal to the duration of the total length of the video in second - grains, it is considered that the user has completed playing the video.
[0012] Preferably, use segmented quantization and dynamic compression storage to dynamically divide the video playing duration into multiple time periods; for sparse playing parts, the system automatically divides the time periods into blocks of every 30 seconds or every minute according to the user's playing behavior, while for parts that the user watches frequently, it is refined to every second;
[0013] The system dynamically adjusts the segmentation granularity according to the density during video playing; if the user only watches certain segments of the video, the system divides the unplayed parts into larger blocks.
[0014] Preferably, for sparse playing areas, use the Run - Length Encoding compression technique to reduce the storage of unplayed parts; if a video has a large number of consecutive unplayed seconds, compress the large number of consecutive unplayed seconds into a start time and a duration, rather than storing the data of each unplayed second separately;
[0015] For consecutive time periods watched by users, the Boolean compression technique is adopted to merge consecutive 1s played within a period of time into a flag representing the playing period;
[0016] The multi-level Bitmap index is used to store the data in chunks of every 30 seconds at the lower level, while storing the data per second at the higher level; when the data is relatively sparse, the low-granularity Bitmap can meet the requirements; when fine-grained statistics are needed, the high-level Bitmap data is then searched according to the requirements;
[0017] In addition to the multi-level itmap index, the timestamp and range index are also combined.
[0018] Preferably, step S4 uses the OR operation of the union of Bitmaps to aggregate the multiple playing records into a complete playing situation, including the following steps:
[0019] S4-1. Each time a user plays a video, a corresponding Bitmap is created to record the viewing situation during that period; if the user watches the video from the 10th second to the 20th second, the bits from the 10th second to the 20th second in the corresponding Bitmap will be marked as 1, and the other positions will be 0;
[0020] S4-2. If any one of the corresponding positions at a certain time point in two Bitmaps is 1, the corresponding position in the merged Bitmap will be 1; when the corresponding positions in both Bitmaps are 0, the merged result will be 0;
[0021] S4-3. If the first playing record of the user is from the 10th second to the 20th second, and the second playing record is from the 30th second to the 40th second, then after merging the Bitmap corresponding to the 10th second to the 20th second and the Bitmap corresponding to the 30th second to the 40th second through the OR operation, the merged result will mark the 10th to the 20th second and the 30th to the 40th second as 1, and the other positions as 0;
[0022] S4-4. For multiple playing records, the OR operation is sequentially performed on the Bitmap of each play; if the user plays the video multiple times, a Bitmap is generated for each playing record; the Bitmaps generated each time are merged one by one through the OR operation, and finally a complete Bitmap is obtained, representing the user's viewing situation in the entire video, covering all playing periods;
[0023] S4-5. The final Bitmap determines whether the user has watched the video completely; if the number of bits with a value of 1 in the final Bitmap is equal to or exceeds the total duration of the video in seconds, it is considered that the user has watched the video completely.
[0024] Preferably, the Bitmap merging formula generated each time is as follows:
[0025] T: The total duration of the video, in seconds. For example, T = 300 seconds indicates that the video duration is 300 seconds;
[0026] U: The set of user playback records, including the playback records of user A;
[0027] n: The length of the Bitmap generated each time, which is the total duration T of the video, i.e., n = T;
[0028] B i : Represents the Bitmap of the i-th playback record, with a size of n. B i [k]=1 indicates that the user watched the video at the k-th second, and [k]=0 indicates that the user did not watch;
[0029] B m : The final Bitmap, representing the user's playback situation throughout the video, obtained by performing the OR operation on the Bitmaps generated each time;
[0030] P: The total number of seconds of the video played by the user; obtained by calculating the number of 1s in the Bitmap;
[0031] When the user has multiple playback records, the Bitmaps generated each time are merged through the OR operation; assuming the user has m playback records, the final merged Bitmap B m is calculated through the following formula (the final merged Bitmap B m is synonymous with the final Bitmap, and the final merged Bitmap B m is used for explanation in the formula):
[0032] B m =B 1 ORB 2 OR...ORB m
[0033] wherein, the OR represents the "OR" operation in bitwise operations; the "OR" operation is performed on each bit of the Bitmaps generated each time at each time point: if the corresponding position of any one Bitmap is 1, then the corresponding position of the final Bitmap is 1, indicating that the user watched the video at this time point.
[0034] Preferably, the formula for calculating the total number of seconds played by the user is as follows:
[0035] By calculating the final merged Bitmap B mThe number of bits with a value of 1 is used to calculate how many seconds of the video the user actually watched, that is:
[0036]
[0037] Wherein, the B m [k] represents the k-th bit of the final Bitmap. If it is 1, it means there is viewing within that second.
[0038] Preferably, the formula for judging complete playback is as follows:
[0039] A conclusion is drawn by comparing the total number of seconds P watched by the user with the total duration T of the video; the condition for complete playback is:
[0040]
[0041] Wherein, if the total number of seconds P watched by the user is greater than or equal to the total duration T of the video, it is considered that the user has completed watching the video.
[0042] Preferably, the system identifies the segments where the user repeatedly plays, especially the segments that are played back multiple times within a short period; determines the video segments skipped by the user by judging the time points of fast skipping and jumping; judges the positions where the user pauses and stops playing, as well as the distribution of the pause duration, and dynamically and real - time changes the indexing granularity;
[0043] Use high - precision recording in the high - frequency playback area, and adopt low - precision recording in the skipped and low - activity areas.
[0044] Preferably, the specific steps of dynamic adjustment are as follows:
[0045] When the user starts playing the video, the system selects a preliminary precision according to the video duration and a preset default strategy; for shorter videos, use second - level precision; for longer videos, select a larger time granularity;
[0046] Dynamically evaluate the playback density and activity of the video through the playback duration, pauses, replays, and skips;
[0047] If the user continuously watches within a certain time period and does not skip any content, increase the precision of the time period of continuous watching without skipping any content and record it at a higher - precision Bitmap level; if the user skips the video and has a short viewing time within a certain time period, dynamically reduce the precision of the time period of skipping the video and having a short viewing time, and use a coarser - grained Bitmap;
[0048] Feed the user's behavior back to the precision adjustment module and update the precision in real - time during playback; if the user frequently switches the playback progress within a certain period of time, the system automatically adjusts the granularity of the part with frequent playback progress switching;
[0049] Each precision adjustment triggers a feedback mechanism that updates the playback record granularity at the per-second, per-10-second, and per-minute levels;
[0050] Use a caching mechanism to temporarily store the user's playback behavior data; whenever there is 30 seconds to 1 minute of playback data, the system batch-updates the precision for that time period based on the analysis results; if the behavior pattern of a certain video changes significantly, from high-frequency playback to low-frequency playback, the system adjusts the precision record for the significantly changed part of the behavior pattern.
[0051] Compared with the prior art, the advantages of the present invention are as follows:
[0052] (1) Adjust the recording precision according to the actual playback behavior of the user, reducing waste of storage space and improving processing efficiency.
[0053] (2) The system can dynamically adjust the precision during playback, adapting to diverse playback behaviors and meeting real-time feedback requirements.
[0054] (3) The playback data with different precisions are stored in layers, improving the query speed and system response efficiency.
[0055] (4) Utilize data stream processing to achieve real-time data processing in a high-concurrency environment, ensuring the system's response speed in a scenario with a large number of users.
[0056] (5) Introduce a caching and batch-update mechanism to reduce frequent storage operations and lower the system performance overhead. Description of the Drawings
[0057] Figure 1 It is a schematic diagram of the overall system of a method for accurately calculating whether a user has completed playing an audio-visual video in a database using Bitmap in the present invention; Detailed Embodiment
[0058] For the embodiment, please refer to Figure 1 , a method for accurately calculating whether a user has completed playing an audio-visual video in a database using Bitmap, the method for accurately calculating whether a user has completed playing an audio-visual video in a database using Bitmap includes the following steps:
[0059] S1. Quantize the playback duration of the audio-visual video to the second level; if the video duration is 300 seconds, define a Bitmap with a length of 300, where each position represents the playback state of one second; when the user plays the video, record each second of the playback, including the skipped and repeatedly played parts;
[0060] S2. The playback records of each user will be mapped into a Bitmap. Each position in the bitmap corresponds to a playback second of the video. If the user watches the video in a certain second, the corresponding position in the bitmap is 1. If the user skips or does not watch that second, the position is 0.
[0061] S3. For the playback records of each user, use a multi-level Bitmap index to store the playback records in the database. When querying, obtain the playback status of the user at each moment from the Bitmap database.
[0062] S4. If there are multiple playback records, including the user repeatedly playing a certain part, use the OR operation of the union of Bitmaps to aggregate the multiple playback records into a complete playback situation. Each time the user plays, the new playback period will update the Bitmap through the union operation.
[0063] The first and second records of user A watching the video will be merged using the Bitmap OR operation, so that each playback moment can be accurately marked.
[0064] S5. Determine whether a certain user has completed playing a certain video by calculating the number of bits with a value of 1 in the Bitmap. If the number of bits with a value of 1 in the calculated Bitmap is greater than or equal to the duration of the video in seconds granularity, it is considered that the user has completed playing the video.
[0065] Adopt segmented quantization and dynamic compression storage to dynamically divide the video playback duration into multiple time periods. For sparse playback parts, the system automatically divides the time periods into blocks of every 30 seconds or every minute according to the user's playback behavior, while for parts that the user watches frequently, it is refined to every second.
[0066] The system dynamically adjusts the segmentation granularity according to the density during video playback. If the user only watches certain segments of the video, the system divides the unplayed parts into larger blocks.
[0067] For sparse playback areas, use the compression technique Run-Length Encoding to reduce the storage of unplayed parts. If a video has a large number of consecutive unplayed seconds, compress the large number of consecutive unplayed seconds into a start time and a duration, instead of storing the data of each unplayed second separately.
[0068] For consecutive time periods watched by the user, use boolean compression technology to merge consecutive 1s (played) within a period of time into a flag representing the playback period.
[0069] Store the data in chunks of every 30 seconds at the lower level using the multi-level Bitmap index, and store the data per second at the higher level; when the data is sparse, a low-granularity Bitmap can meet the requirements; when fine-grained statistics are needed, then look up the high-level Bitmap data according to the requirements.
[0070] In addition to the multi-level itmap index, a timestamp and a range index are also combined.
[0071] The step in which S4 aggregates the multiple play records into a complete play situation using the OR operation of the union of Bitmaps includes the following steps:
[0072] S4-1. Each time a user plays a video, create a corresponding Bitmap to record the viewing situation during that period; if the user watches the video from the 10th second to the 20th second, the bits from the 10th second to the 20th second in the corresponding Bitmap will be marked as 1, and the other positions will be 0.
[0073] S4-2. If any of the positions corresponding to a certain time point in two Bitmaps is 1, the corresponding position in the merged Bitmap will be 1; when the corresponding positions in both Bitmaps are 0, the merged result will be 0.
[0074] S4-3. If the first play record of the user is from the 10th second to the 20th second and the second play record is from the 30th second to the 40th second, then after merging the Bitmap corresponding to the 10th second to the 20th second and the Bitmap corresponding to the 30th second to the 40th second through the OR operation, the merged result will mark the 10th to the 20th second and the 30th to the 40th second as 1, and the other positions as 0.
[0075] S4-4. For multiple play records, perform the OR operation on the Bitmap of each play in turn; if the user plays the video multiple times, a Bitmap is generated for each play record; merge each generated Bitmap one by one through the OR operation, and finally obtain a complete Bitmap, representing the user's viewing situation in the entire video, covering all play periods.
[0076] S4-5. The final Bitmap determines whether the user has watched the video completely; if the number of bits with a value of 1 in the final Bitmap is equal to and exceeds the total duration of the video in seconds, it is considered that the user has watched the video completely.
[0077] The merging formula for the Bitmap generated each time a video is played is as follows:
[0078] T: The total duration of the video, in seconds, including, where T = 300 seconds, indicating that the video duration is 300 seconds.
[0079] U: The set of user playback records, including the playback records of User A;
[0080] n: The length of each generated Bitmap, which is the total video duration T, i.e., n = T;
[0081] B i : Represents the Bitmap of the i-th playback record, with a size of n, B i [k]=1 indicates that the user watched the video at the k-th second, and [k]=0 indicates not watched;
[0082] B m : The final Bitmap, representing the user's playback situation throughout the video, obtained by performing the OR operation on the Bitmaps generated by each playback;
[0083] P: The total number of seconds of the video played by the user; obtained by calculating the number of 1s in the Bitmap;
[0084] When the user has multiple playback records, the Bitmaps generated by each playback are merged through the OR operation; assuming the user has m playback records, the final merged Bitmap B m is calculated through the following formula:
[0085] B m =B 1 ORB 2 OR...ORB m
[0086] where the OR represents the "sum" operation in bitwise operations; the "sum" operation is performed on each bit of the Bitmap generated by each playback at each time point: if the corresponding position of any Bitmap is 1, then the corresponding position of the final Bitmap is 1, indicating that the user watched the video at this time point.
[0087] The formula for calculating the total number of seconds played by the user is as follows:
[0088] By calculating the number of bits with a value of 1 in the final merged Bitmap B m the number of seconds the user actually watched the video is obtained, i.e.:
[0089]
[0090] where the B m [k] represents the k-th bit of the final Bitmap, and if it is 1, it indicates that there was a viewing within that second.
[0091] The formula for the complete playback judgment is as follows:
[0092] The conclusion is drawn by comparing the total number of seconds P watched by the user with the total duration T of the video; the condition for complete playback is:
[0093]
[0094] Among them, if the total number of seconds P watched by the user is greater than or equal to the total duration T of the video, it is considered that the user has completed playing the video.
[0095] The system identifies the segments where the user replays repeatedly, especially the segments that are replayed multiple times within a short period; determines the video segments skipped by the user by judging the time points of fast jumping and skipping; judges the positions where the user pauses and stops playing, as well as the distribution of the pause duration, and dynamically and real - time changes the indexing granularity;
[0096] Use high - precision recording in the high - frequency playback area, and use low - precision recording in the skipped and low - activity areas.
[0097] The specific steps of dynamic adjustment are as follows:
[0098] When the user starts playing the video, the system selects a preliminary precision according to the video duration and a preset default strategy; for shorter videos, use second - level precision; for longer videos, select a larger time granularity;
[0099] Dynamically evaluate the playback density and activity of the video through the playback duration, pauses, replays, and skips;
[0100] If the user continuously watches within a certain time period and does not skip any content, improve the precision of the time period of continuous watching without skipping any content and record it at a higher - precision Bitmap level; if the video is skipped and the viewing time is short within a certain time period, dynamically reduce the precision of the time period of skipped video and short viewing time and use a coarser - grained Bitmap;
[0101] Feed the user's behavior back to the precision adjustment module and update the precision in real - time during playback; if the user frequently switches the playback progress within a certain period of time, the system automatically adjusts the granularity of the part with frequent playback progress switching;
[0102] Each precision adjustment triggers a feedback mechanism to update the granularity of the playback record every second, every 10 seconds, and every minute;
[0103] Use a caching mechanism to temporarily store the user's playback behavior data; whenever there is 30 seconds to 1 minute of playback data, the system batch - updates the precision of this time period according to the analysis results; if the behavior pattern of a certain video segment changes greatly, from high - frequency playback to low - frequency playback, then the system adjusts the precision record of the part with large behavior pattern change.
[0104] Specifically, the playback behavior analysis is as follows:
[0105] Frequent playback: The user plays the same time period or video clip multiple times. Such behavior indicates that this part of the video content is important to the user, so more detailed recording is required.
[0106] Skipping behavior: The user skips certain parts of the video, indicating that these parts are not important to the user. Such parts can be recorded with a lower-precision Bitmap or even stored by compression.
[0107] Intermittent playback: The user pauses, replays, or jumps to a specific time period during playback. This usually requires marking the specific playback time, but for some unimportant parts, the storage details can be reduced.
[0108] Playback density: By analyzing the density of the playback records (such as the fluctuations in the playback duration per minute), the system can detect which parts of the playback are dense and which are relatively sparse.
[0109] Specifically, the dynamic adjustment of the precision granularity:
[0110] High-precision (fine-grained) storage: Applicable conditions: For parts that the user frequently plays, repeatedly played segments, or segments with a long user playback time, the system will use a smaller time granularity (for example, per second) to store the playback records of these parts.
[0111] Operation: During these time periods, each second is marked with a bit to indicate whether the user played the video content of that second. For example, if the user plays or pauses multiple times between 10 seconds and 20 seconds, then this period will be accurately recorded as 10 one-bit Bitmaps (one per second).
[0112] Low-precision (coarse-grained) storage: Applicable conditions: For skipped parts or parts with a very short playback time, the system will select a larger time granularity (for example, every 10 seconds or every 30 seconds as a unit) to record the playback of these areas.
[0113] Operation: This means that if the user skips 30 seconds of video content in a certain video segment, then the playback record of this part will only be marked with 1 bit for the entire 30-second time period, instead of recording it second by second.
[0114] Adaptive time granularity: Dynamic adjustment: The system will adjust the granularity according to the real-time data of the user's behavior. If the user's playback behavior is sparse in a certain time period, then the system can automatically adjust the granularity of these areas to be larger (such as one mark per 30 seconds). Conversely, for the periods when the user is concentrating on watching, the granularity will be reduced to the second level to ensure more accurate recording.
[0115] Operation: For example, if the user frequently pauses and plays within the first 5 minutes of a video, the system will record these 5 minutes in units of seconds. In the last 10 minutes of the video, if the user skips most of the content, the system may record this period in units of 30 seconds.
[0116] Specifically, the rules for calculating weights and determining precision adjustment are as follows:
[0117] Viewing duration weight: The longer the user watches a video within a certain period, the higher the weight of this period.
[0118] For example, if the user watches 60 seconds of content within a certain period, the weight of this period is 60 (seconds).
[0119] Skipping behavior weight: If the user skips a video within a certain period, the weight of this period is relatively low and may be only 0.
[0120] For example, if the user quickly skips 30 seconds of content, the weight of this period may be 0.
[0121] Repeated play weight: If a certain period is repeatedly played, the weight of this part will increase, indicating that this part is more important to the user.
[0122] For example, if the user replays a certain part 5 times, the weight of this part can be 5.
[0123] Precision adjustment rule: Based on the calculated weight value, the system can formulate precision adjustment rules.
[0124] For example:
[0125] If the weight of a certain period is higher than a certain threshold (such as 20 seconds), then this period is stored using second-level granularity.
[0126] If the weight of a certain period is lower than a certain threshold (such as 10 seconds), then this period is stored using a larger granularity (such as storing one bit every 30 seconds).
[0127] Example rule: Weight, >, 30 seconds: Use second-level granularity (one bit per second).
[0128] 10 seconds, <, Weight, ≤, 30 seconds: Use 10-second granularity (one bit per 10 seconds).
[0129] Weight, ≤, 10 seconds: Use 30-second granularity (one bit per 30 seconds).
[0130] Specifically, for dynamic adjustment implementation, two methods are used to achieve dynamic adjustment:
[0131] Real-time adjustment: Every time a user plays a video, the system monitors the playing behavior in real time and immediately adjusts the granularity of the current time segment. For example, if the user continuously pauses and quickly skips a certain part, the system will immediately reduce the precision of that segment.
[0132] Batch adjustment: The system can also dynamically adjust the precision by periodically analyzing the user's playing records (such as every hour or every day). This method is suitable for the centralized processing of large-scale user data and avoids overly frequent real-time calculations.
[0133] The above shows and describes the basic principles, main features and advantages of the present invention; those skilled in the art should understand that the present invention is not limited by the above embodiments, and the above embodiments and descriptions in the specification are only preferred examples of the present invention and are not used to limit the present invention. Without departing from the spirit and scope of the present invention, the present invention will have various changes and improvements, and these changes and improvements all fall within the scope of the present invention claimed; the scope of protection claimed by the present invention is defined by the appended claims and their equivalents.
Claims
1. A method for accurately calculating whether a user has finished playing audio or video in a database using Bitmap, characterized in that: The method for accurately calculating whether the user has finished playing audio and video in a database by using Bitmap comprises the following steps: S1. Quantify the playing time of audio and video to seconds. If the video is 300 seconds long, define a Bitmap with a length of 300, and each position represents one second of playing state. When the user plays the video, record every second of the playing, including the skipped and repeatedly played parts. S2. Each user's playback record will be mapped to a Bitmap, and each position of the bitmap corresponds to a playback second of the video; if the user watches the video within a certain second, the bitmap position corresponding to that second is 1; if the user skips and does not watch that second, the position is 0; S3. For each user's playback record, the playback record is stored in the database using a multi-level Bitmap index; when querying, the playback status of the user at each moment is obtained from the Bitmap database; S4. If there are multiple playback records, including users repeatedly playing a certain part, the multiple playback records are aggregated into a complete playback situation using the Bitmap's union operation OR operation; each time the user plays, the new playback period will be updated by the union operation Bitmap; The first and second records of user A watching the video are merged using the BitmapOR operation so that each playback moment can be accurately marked; S5. Determine whether a user has finished playing a certain audio or video by calculating the number of bits with a value of 1 in the Bitmap; if the number of bits 1 with a value of 1 in the Bitmap is greater than or equal to the total duration of the video in seconds, it is considered that the user has finished playing the video.
2. According to claim 1, a method for accurately calculating whether a user has finished playing audio and video in a database using Bitmap, characterized in that: The video playback time is dynamically divided into multiple time periods by using segmented quantization and dynamic compression storage. For the sparsely played parts, the system automatically divides the time period into 30-second or minute blocks based on the user's playback behavior, and for the parts that users watch frequently, the time period is divided into seconds. The system dynamically adjusts the segmentation granularity according to the intensity of video playback; if the user only watches certain segments of the video, the system divides the unplayed part into larger blocks.
3. According to claim 2, a method for accurately calculating whether a user has finished playing audio and video by using Bitmap in a database, characterized in that: For areas with sparse playback, Run-Length Encoding compression technology is used to reduce the storage of unplayed video. If a video has a large number of consecutive unplayed seconds, the large number of consecutive unplayed seconds are compressed into a start time and duration, instead of storing the data of each unplayed second separately. For the continuous time period that the user watches, Boolean compression technology is used to merge the continuous 1 played in a period of time into a flag indicating the playback period; The multi-level Bitmap index is used to store the data of one block every 30 seconds at a low level, and the data of one second at a high level; When the data is sparse, low-granularity Bitmap can meet the needs; when fine-grained statistics are required, high-level Bitmap data is searched according to the needs; In addition to the multi-level itmap index, timestamp and range indexes are also combined.
4. According to claim 1, a method for accurately calculating whether a user has finished playing audio and video by using Bitmap in a database, characterized in that: The step S4 uses the bitmap union operation OR operation to aggregate the multiple playback records into a complete playback situation, including the following steps: S4-1. Every time a user plays a video, a corresponding Bitmap is created to record the viewing status of that period; if a user watches a video from the 10th second to the 20th second, the corresponding Bitmap from the 10th second to the 20th second will be marked as 1, and the other positions will be 0; S4-2. If any of the corresponding positions at a certain time point in the two Bitmaps is 1, the corresponding position of the merged Bitmap is 1; when the corresponding positions in the two Bitmaps are both 0, the merged result is 0; S4-3. If the user's first playback record is from the 10th second to the 20th second, and the second playback record is from the 30th second to the 40th second, then the Bitmap corresponding to the 10th second to the 20th second and the Bitmap from the 30th second to the 40th second are merged by the OR operation, and the merged result will mark the 10th to the 20th second and the 30th to the 40th second as 1, and the other positions as 0; S4-4. For multiple playback records, perform an OR operation on each playback Bitmap in turn; if the user plays the video multiple times, a Bitmap is generated for each playback record; the Bitmaps generated each time are merged one by one through the OR operation, and finally a complete Bitmap is obtained, which represents the user's viewing status in the entire video, covering all playback periods; S4-5. The final Bitmap determines whether the user has finished watching the video; if the number of bits with a value of 1 in the final Bitmap is equal to or greater than the total duration of the video in seconds, it is considered that the user has watched the entire video.
5. According to claim 4, a method for accurately calculating whether a user has finished playing audio and video by using Bitmap in a database, characterized in that: The Bitmap merging formula generated for each playback is as follows: T: the total duration of the video, in seconds, including T=300 seconds, indicating that the video duration is 300 seconds; U: a collection of user play records, including the play records of user A; n: the length of the Bitmap generated each time, which is the total duration of the video T, that is, n = T; B i : represents the Bitmap of the i-th playback record, with a size of n, B i [k] = 1 means the user watched the video at the kth second, [k] = 0 means the user did not watch it; B m : The final Bitmap represents the playback status of the user in the entire video, which is obtained by performing the OR operation on the Bitmap generated by each playback; P: total number of seconds of video played by the user; obtained by counting the number of 1s in the Bitmap; When the user has multiple play records, the Bitmap generated by each play is merged through the OR operation; Assuming that the user has m playback records, the final merged BitmapB m Calculated by the following formula: B m =B1ORB2OR...ORB m Among them, the OR represents the "and" operation in bitwise operation; the "and" operation will be performed at each time point, that is, on each bit of the Bitmap generated for each playback: if the corresponding position of any Bitmap is 1, then the final Bitmap is 1 at the corresponding position, indicating that the user has watched the video at this time point.
6. According to claim 5, a method for accurately calculating whether a user has finished playing audio and video by using Bitmap in a database, characterized in that: The formula for calculating the total number of seconds played by a user is as follows: By calculating the final merged BitmapB m The median value is 1, which tells us how many seconds of video the user actually watched: Among them, the B m [k] represents the kth bit of the final Bitmap. If it is 1, it means that it has been viewed within that second.
7. According to claim 6, a method for accurately calculating whether a user has finished playing audio and video by using Bitmap in a database, characterized in that: The calculation formula for the broadcast completion judgment formula is as follows: The conclusion is drawn by comparing the total number of seconds P watched by the user with the total duration T of the video; the completion condition is: If the total number of seconds P watched by the user is greater than or equal to the total duration T of the video, it is considered that the user has finished playing the video.
8. According to claim 1, a method for accurately calculating whether a user has finished playing audio and video by using Bitmap in a database, characterized in that: The system identifies the time periods when users repeatedly play videos, especially the clips that are played back multiple times in a short period of time; identifies the video clips that users skip by judging the time points of fast jumps and skips; determines the locations where users pause and stop playing, as well as the distribution of pause durations, and dynamically changes the index granularity in real time; High-precision recording is used in areas with high frequency of playback, while low-precision recording is used in skipped and low-activity areas.
9. According to claim 8, a method for accurately calculating whether a user has finished playing audio and video by using Bitmap in a database, characterized in that: The specific steps for dynamic adjustment are as follows: When the user starts playing a video, the system selects a preliminary precision based on the video length and the preset default strategy; if the video is short, the second-level precision is used; if the video is long, a larger time granularity is selected; Dynamically evaluate the video's playback density and activity through playback duration, pause, replay, and skip; If the video is continuously watched without skipping any content within a certain time period, the accuracy of the time period during which the video is continuously watched without skipping any content is improved and recorded in a higher-precision Bitmap layer; if the video is skipped within a certain time period and the watching time is short, the accuracy of the time period during which the video is skipped and the watching time is short is dynamically reduced and a coarser-grained Bitmap is used; Feedback the user's behavior to the precision adjustment module, and update the precision in real time during the playback process; if the user frequently switches the playback progress within a certain period of time, the system automatically adjusts the granularity of the part where the playback progress is frequently switched; Each precision adjustment triggers a feedback mechanism to update the granularity of playback records every second, every 10 seconds, and every minute; A cache mechanism is used to temporarily store the user's playback behavior data. Whenever there is 30 seconds to 1 minute of playback data, the system batch updates the accuracy of the time period based on the analysis results. If the behavior pattern of a certain video segment changes significantly, from high-frequency playback to low-frequency playback, the system adjusts the accuracy record of the part with the larger change in the behavior pattern.