A vehicle-mounted historical video playing control method, device and medium
By constructing a multi-dimensional video integrity determination model and dynamically adjusting parameters, the problem of insufficient cached video integrity in the vehicle networking system was solved, achieving efficient video playback control and improving the system's robustness and user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHIZI AUTOMOTIVE TECHNOLOGY CO LTD
- Filing Date
- 2026-05-28
- Publication Date
- 2026-06-26
Smart Images

Figure CN122293884A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of vehicle networking technology, and in particular to a method, device and medium for controlling the playback of in-vehicle historical videos. Background Technology
[0002] In existing vehicle-to-everything (V2X) systems, in-vehicle devices acquire historical video using the following methods: the in-vehicle terminal initiates a historical video request to the server; the server, based on the request, retrieves the video stream from the in-vehicle device in real time, or transcodes the video data and caches it in a storage system (such as object storage or a file server), then returns the corresponding video access address to the in-vehicle device. In some implementations, the server manages the cache of already generated video files and prioritizes returning the cached file address in subsequent requests to reduce resource consumption from repeated streaming. Simultaneously, to determine the availability of a video file, it is generally checked for existence via an HTTP request, or by checking file attributes (such as file size or a fixed duration threshold). In some scenarios, fixed rules (such as an error threshold) can also be used to determine whether the video has been generated. When a cached video is abnormal, a simple retry or a direct rollback of the streaming is performed. The above solutions have the following problems:
[0003] (1) High traffic costs and the lack of an effective mechanism for determining the integrity of cached videos in existing technologies result in a low cache hit rate. When the cache is unavailable or the judgment is inaccurate, it is still necessary to fall back to the vehicle end for real-time streaming, which leads to a large consumption of bandwidth resources on the vehicle end;
[0004] (2) Insufficient caching reliability. When the existing technology determines whether a video is available by the existence of the file, it does not perform feature analysis on the video content itself, lacks integrity determination means, and cannot identify situations where the video is not fully generated or interrupted.
[0005] (3) The judgment method is singular. Existing technologies use fixed thresholds (such as fixed duration error) or single indicators (such as file size) to judge whether a video has been generated. The judgment model lacks the ability to fuse multi-dimensional features and is difficult to accurately reflect the real state of the video.
[0006] (4) Lack of dynamic adaptation capability. Different videos differ in duration, encoding method and generation process, but the existing technology adopts a unified judgment rule and the judgment logic is implemented in a hard-coded manner, which cannot be dynamically adjusted according to video characteristics.
[0007] (5) There is no continuous optimization mechanism. The judgment rules in the existing technology remain unchanged during the system operation. It is impossible to optimize according to the actual playback effect. There is no parameter update mechanism based on feedback data, and no closed-loop optimization system has been formed.
[0008] (6) The system is not robust enough. When the cached video is abnormal, the existing technology only performs simple retry or directly rolls back the stream. It lacks fine control and has not established a cache failure identification and graded rollback mechanism, which can easily lead to duplicate requests or waste of resources. Summary of the Invention
[0009] This invention aims to at least solve the aforementioned technical problems existing in the prior art. To this end, the first aspect of this invention proposes a method for controlling the playback of in-vehicle historical videos, the method comprising:
[0010] In response to a historical video request, query the caching system to see if a corresponding video cache record exists;
[0011] If a video cache record exists, determine whether the video file actually exists; if the video file exists, extract video features and determine whether the cached video is complete.
[0012] If the cached video is complete, return the cached video address and play the video;
[0013] If no video cache record exists or the cached video is incomplete, record the number of failed video requests in the current history. If the number of failed requests is greater than a preset threshold, return the real-time streaming address to play the video; if the number of failed requests is less than or equal to the preset threshold, re-initiate the video generation or streaming request.
[0014] Optionally, the step of extracting video features and determining whether the cached video is complete includes:
[0015] Extract video features; the video features include video duration, file size, and video bitrate.
[0016] The video duration is determined to be complete based on the video length, the expected video length, and a preset tolerance threshold; the tolerance threshold is determined based on a preset minimum tolerance value, a duration tolerance ratio coefficient, and the expected video length.
[0017] Determine whether video data is missing based on file size, the ratio of expected file size to preset file size;
[0018] Determine whether the video has abnormal encoding or is damaged based on the video bitrate, the expected bitrate and the preset bitrate tolerance threshold;
[0019] A comprehensive score is obtained based on whether the video duration is complete, whether the video data is missing, and whether the video has abnormal encoding or corruption.
[0020] The integrity of the cached video is determined based on the comprehensive score and the preset judgment threshold.
[0021] Optionally, it also includes:
[0022] The system continuously collects the judgment results of whether the cached video is complete and the actual playback results, and adjusts the judgment parameters based on the judgment results and the actual playback results; the judgment parameters include the duration tolerance ratio coefficient, the file size ratio coefficient, the bitrate tolerance threshold, and the judgment threshold.
[0023] Optionally, after continuously collecting the judgment result of whether the cached video is complete and the actual playback result, the method further includes:
[0024] The false positive rate is determined based on the number of times the judgment result is complete but playback fails, and the total number of times the judgment result is complete.
[0025] The false negative rate is determined based on the number of times the judgment result is incomplete but the playback is successful, and the total number of times the judgment result is incomplete.
[0026] The overall error rate is determined based on the false positive rate and the false negative rate.
[0027] Optionally, adjusting the judgment parameters based on the judgment result and the actual playback result includes:
[0028] The updated duration tolerance ratio is obtained based on the duration tolerance ratio coefficient, the missed detection rate, and the false detection rate;
[0029] The updated file size ratio coefficient is obtained based on the file size ratio coefficient, the false negative rate, and the false positive rate;
[0030] The updated bitrate tolerance threshold is obtained based on the bitrate tolerance threshold and the video bitrate volatility; the volatility is the standard deviation of the historical video actual bitrate data.
[0031] Optionally, adjusting the judgment parameters based on the judgment result and the actual playback result further includes:
[0032] The updated judgment threshold is obtained based on the judgment threshold, the target judgment result accuracy, and the actual judgment result accuracy; the actual judgment result accuracy is the ratio of the number of correct judgment results to the total number of judgments; the number of correct judgment results includes the number of times the judgment result is complete and the playback is successful, and the number of times the judgment result is incomplete and the playback fails.
[0033] Optionally, the video cache record includes the video access address, video generation status, and video parameters.
[0034] Optionally, determining whether the video file actually exists includes:
[0035] Determine if a video file actually exists by checking the HTTP response status code;
[0036] If it exists, determine whether the video file is accessible.
[0037] A second aspect of the present invention provides an electronic device comprising a processor and a memory, wherein the memory stores at least one instruction or at least one program, the at least one instruction or at least one program being loaded and executed by the processor to implement the in-vehicle historical video playback control method as proposed in the first aspect.
[0038] A third aspect of the present invention provides a computer-readable storage medium storing at least one instruction or at least one program, wherein the at least one instruction or at least one program is loaded and executed by a processor to implement the vehicle-mounted historical video playback control method as proposed in the first aspect.
[0039] The technical solution provided in this application may include the following beneficial effects:
[0040] This application extracts video duration, file size, and video bitrate features, constructs a judgment model, and obtains a comprehensive score result to comprehensively judge the integrity of cached videos. This avoids the misjudgment problem caused by relying solely on file existence judgment, improves the accuracy of cached video integrity judgment, reduces video playback interruptions, and enhances user experience. This application introduces adaptive judgment parameters, including duration tolerance coefficient, file size tolerance coefficient, bitrate tolerance threshold, and judgment threshold, using differentiated judgment standards for videos of different lengths and types. This improves the universality and adaptability of the judgment mechanism and avoids the problems of being too strict or too lenient due to fixed thresholds. This application collects... By comparing historical judgment results with actual playback results, false positive and false negative rate indicators are constructed, and parameters are dynamically optimized to achieve continuous optimization of the judgment model, reducing false positive and false negative rates and realizing a closed-loop system of "judgment-feedback-optimization". This application supports dynamic updating of judgment parameters, realizing online adjustment of judgment strategies without modifying code, enabling differentiated strategies for multiple scenarios and vehicle models, and improving system scalability and maintainability. When cache judgment fails, this application automatically performs cache invalidation processing and dynamically selects retry or rollback to real-time stream based on the number of failures, thereby avoiding the long-term impact of abnormal cache on the system, preventing repeated invalid requests, and improving the robustness and stability of the system. Attached Figure Description
[0041] Figure 1 A flowchart of a vehicle-mounted historical video playback control method provided in an embodiment of the present invention. Detailed Implementation
[0042] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0043] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of embodiments of this disclosure, unless otherwise stated, "a plurality of" means two or more. Furthermore, the use of "based on" or "according to" implies openness and inclusiveness, because processes, steps, calculations, or other actions "based on" or "according to" one or more of the stated conditions or values may in practice be based on additional conditions or beyond the stated values.
[0044] This invention provides a method for controlling the playback of in-vehicle historical videos, such as... Figure 1 As shown, the method may include the following steps:
[0045] Step 101: In response to a historical video request, query the caching system to see if there is a corresponding video cache record.
[0046] In one possible implementation, the video cache record includes the video access address, video generation status, and video parameters.
[0047] Specifically, in response to historical video requests from the vehicle terminal or user, basic validations (such as non-empty checks and format checks) are performed on the parameters in the request, and a unique request identifier is generated for subsequent process tracking. Historical video requests include at least the following information: Vehicle Identifier (VIN), video path (filePath), and optional parameters. The Vehicle Identifier uniquely identifies the vehicle, the video path locates the target video file, and optional parameters include other parameters such as desired video duration and resolution requirements. A cache key-value pair is generated based on the Vehicle Identifier and video path, and the system queries a caching system (such as Redis or a memory cache) to check if a corresponding video cache record exists. The video cache record includes the video access address (URL), video generation status (e.g., completed, generating), and video parameters (e.g., desired duration, file size).
[0048] Step 102: If a video cache record exists, determine whether the video file actually exists; if the video file exists, extract video features and determine whether the cached video is complete.
[0049] In one possible implementation, determining whether the video file actually exists includes:
[0050] Determine if a video file actually exists by checking the HTTP response status code;
[0051] If it exists, determine whether the video file is accessible.
[0052] Specifically, based on the video address in the cache record, the existence of the video file is checked via a network request (such as a HEAD or GET request). The existence of the video file can be determined by the HTTP response status code; 200 indicates existence. After confirming the existence of the video file, it is further determined whether the file is accessible. Insufficient permissions or a timeout indicates that the file is unavailable or inaccessible.
[0053] In one possible implementation, the step of extracting video features and determining whether the cached video is complete includes:
[0054] Extract video features; the video features include video duration, file size, and video bitrate.
[0055] The video duration is determined to be complete based on the video length, the expected video length, and a preset tolerance threshold; the tolerance threshold is determined based on a preset minimum tolerance value, a duration tolerance ratio coefficient, and the expected video length.
[0056] Determine whether video data is missing based on file size, the ratio of expected file size to preset file size;
[0057] Determine whether the video has abnormal encoding or is damaged based on the video bitrate, the expected bitrate and the preset bitrate tolerance threshold;
[0058] A comprehensive score is obtained based on whether the video duration is complete, whether the video data is missing, and whether the video has abnormal encoding or corruption.
[0059] The integrity of the cached video is determined based on the comprehensive score and the preset judgment threshold.
[0060] The video file is parsed to extract key media features. Specifically, the video duration is obtained by parsing video metadata, the file size is obtained from the file system or network, and the video bitrate is calculated using a video parsing tool. For example, FFmpeg can be used as the video parsing tool.
[0061] In this embodiment of the invention, the target parameters and actual parameters are encapsulated into a unified decision context object, including: expected parameters, actual parameters, and current request information. The expected parameters include the expected video duration, expected file size, and expected video bitrate. The actual parameters include the video duration, file size, and video bitrate obtained by parsing the video file. The current request information includes the vehicle identification number (VIN), video identifier, etc. This context is passed as input to the subsequent decision engine for unified processing.
[0062] Based on current video characteristics (such as video duration or business scenario), corresponding judgment strategies are dynamically loaded from the rule center, including: a set of judgment rules (such as duration rules, file size rules, etc.), the weight of each rule, and judgment parameters (including duration tolerance coefficient, file size coefficient, bitrate tolerance threshold, and judgment threshold). In this embodiment of the invention, the rule center supports different strategies for different video types; for example, short videos and long videos can use different judgment logics.
[0063] Based on the loaded rules and context data, a comprehensive judgment is made on the integrity of the video cache. The judgment is based on the video duration, the expected video duration, and the preset tolerance threshold to determine whether the video duration is complete. The judgment formula is as follows:
[0064] |T_expected - T_actual| ≤ Δ
[0065] Δ = max(Δ_min, α × T_expected)
[0066] In the formula, T_expected is the expected video duration, which is the target duration calculated based on the request parameters or business logic; T_actual is the video duration, which is the actual video duration, obtained by parsing the video file; Δ is the preset tolerance threshold, which is the result of dynamic calculation; Δ_min is the preset minimum tolerance value, which is used to ensure that short videos are not misjudged due to excessively small errors; and α is the duration tolerance ratio coefficient, which represents the proportion of the allowed error to the total video duration.
[0067] The above formula is used to determine whether a video's duration is "basically complete." It employs an adaptive mechanism through a maximum value function. When the video is short (e.g., tens of seconds), α × T_expected is small, and Δ is set to Δ_min to avoid overly strict judgment. When the video is long (e.g., several minutes or more), α × T_expected is large, and Δ increases with video length, allowing for reasonable error. This can be understood as allowing a fixed error for short videos and a proportional error for long videos, thus avoiding unreasonable problems caused by a uniform standard.
[0068] The determination of whether video data is missing is based on the file size, the ratio of the expected file size to the preset file size, and the following formula:
[0069] S_actual≥β×S_expected
[0070] In the formula, S_actual is the file size, i.e. the actual file size, obtained through the file system or network; S_expected is the expected file size, which can be estimated based on the video duration and average bitrate; β is the file size ratio coefficient, representing the minimum allowable integrity ratio, and the value of this coefficient is less than 1.
[0071] The above-mentioned formula is used to determine whether video data is missing. Since video files may be interrupted or truncated during generation, even if the duration is close, the file content may still be incomplete. Therefore, it is necessary to supplement the judgment by checking the file size. For example, if the video file duration meets the condition, but the file size is only half the normal size, then the video data may be missing. This embodiment of the invention aims to ensure that the video not only has the correct timing but also sufficient data volume.
[0072] The determination of whether the video bitrate is within a reasonable range is based on the video bitrate, the expected bitrate, and the preset bitrate tolerance threshold. The formula is as follows:
[0073] |B_actual - B_expected|≤γ
[0074] In the formula, B_actual is the video bitrate, which is obtained through video parsing; B_expected is the expected bitrate, which can be obtained based on the encoding strategy or historical data; and γ is the bitrate tolerance threshold, representing the allowable fluctuation range.
[0075] The above formula is used to detect whether a video has abnormal encoding or is damaged, that is, to determine whether the video has been "compressed" or "missing content," or in other words, whether the video quality is normal. If the bitrate deviation is too large, it may indicate that the video has been abnormally compressed, the encoding process is abnormal, or the video data is missing or damaged.
[0076] A comprehensive score is obtained based on factors such as video duration completeness, missing video data, and abnormal encoding or corruption. This involves weighting the results of each rule to obtain a comprehensive score, and then using this comprehensive score against a preset threshold to determine the completeness of the cached video. The expression is as follows:
[0077] Score ≥ Threshold
[0078] Score = Σ (Wi × Ri)
[0079] In the formula, Score is the overall score result, Threshold is the judgment threshold used to determine whether the cache is considered complete, Wi is the weight of the i-th judgment rule, indicating the importance of the rule, and Ri is the judgment result of the i-th judgment rule, which can be 1 or 0, or a continuous score value (between 0 and 1). The judgment rules include whether the video duration is complete, whether the video data is missing, and whether the video has abnormal encoding or corruption. The value of i is 1, 2, or 3.
[0080] The above-described judgment formula is used to make a unified decision on multiple judgment rules. Different rules have varying degrees of importance; duration is usually the primary criterion, while file size and bitrate serve as auxiliary criteria. By combining multiple judgment results through a weighted approach, misjudgment based on a single rule can be avoided. This embodiment of the invention is equivalent to scoring multiple conditions; only when the overall score reaches a preset threshold can the video be judged as complete. For example, if the judgment threshold is set to 0.7, and the duration score is 0.5, the file size score is 0.3, and the bitrate score is 0, then the total score is 0.8, which is greater than 0.7, therefore the video is judged to be complete. It should be noted that the score here refers to the weighted score.
[0081] The above-mentioned judgment formulas together constitute a multi-dimensional judgment system. The duration judgment is used to determine whether the video is recorded completely; the file size judgment is used to determine whether the data is complete; the bitrate judgment is used to determine whether the quality is normal; and the weighted score is used for comprehensive decision-making. By combining multi-dimensional judgments, the false judgment rate can be significantly reduced and the reliability of cached videos can be improved.
[0082] Step 103: If the cached video is complete, return the cached video address and play the video.
[0083] Step 104: If there is no video cache record or the cached video is incomplete, record the number of failures of the current historical video request. If the number of failures is greater than a preset threshold, return the real-time streaming address to play the video; if the number of failures is less than or equal to the preset threshold, re-initiate the video generation or streaming request to obtain the complete video.
[0084] Specifically, if the cached video is incomplete, the current cached record is deleted to prevent the reuse of abnormal data in subsequent calls. This abnormal caching execution mechanism is used to avoid infinite retries or resource waste caused by cache anomalies. The final decision is determined through multiple video requests. When the cache is complete, the cached video is played to improve response speed and reduce bandwidth consumption; when the cache is unavailable or abnormal, real-time streaming is used to ensure video availability. This allows for dynamic switching between cache priority and real-time rollback.
[0085] In this embodiment of the invention, the rules in the rule center are stored in a structured form, including: scene identifier, judgment rule type, weight configuration, and judgment parameters. Rules are dynamically loaded from the rule center, supporting multi-scene switching, canary release, and online updates. To improve the long-term effectiveness and cross-scene adaptability of multi-feature judgment, a self-learning mechanism based on feedback data is introduced on the basis of the rule center and strategy engine to dynamically optimize key parameters (including but not limited to α, β, γ, weight Wi, and judgment threshold Threshold), forming a closed-loop update system.
[0086] In one possible implementation, it also includes:
[0087] The system continuously collects the judgment results of whether the cached video is complete and the actual playback results, and adjusts the judgment parameters based on the judgment results and the actual playback results; the judgment parameters include the duration tolerance ratio coefficient, the file size ratio coefficient, the bitrate tolerance threshold, and the judgment threshold.
[0088] After each video request is processed, the corresponding structured data is recorded for subsequent analysis and learning. Recording methods include real-time writing to a log system or message queue, and periodic aggregation to analytical storage (such as a database or data warehouse). Recorded data includes: the judgment result (whether the cache is considered complete), the actual playback result (including success, playback interruption, loading failure, etc.), and may also include: request timestamp, video type (short video / long video), and network environment information. Specifically, during video judgment and playback, feedback data such as the judgment result of whether the cached video is complete and the actual playback result are continuously collected. Evaluation indicators are constructed based on statistical data, and the judgment parameters are adjusted according to the indicators. Boundary constraints and smoothing processing are applied to the updated parameters to avoid drastic fluctuations. Then, the updated parameters are written to the rule center, and the strategy engine loads the latest parameters and applies them to subsequent video judgments. Through the above process, a closed-loop mechanism of "judgment—feedback—optimization—re-judgment" is formed.
[0089] In one possible implementation, after continuously collecting the judgment result of whether the cached video is complete and the actual playback result, the method further includes:
[0090] The false positive rate is determined based on the number of times the judgment result is complete but playback fails, and the total number of times the judgment result is complete.
[0091] The false negative rate is determined based on the number of times the judgment result is incomplete but the playback is successful, and the total number of times the judgment result is incomplete.
[0092] The overall error rate is determined based on the false positive rate and the false negative rate.
[0093] Specifically, based on historical data, evaluation metrics are calculated within a set time window (such as the most recent hour or the most recent N data points). The false positive rate (FPR) is obtained by comparing the number of times the system judged the video as complete but failed to play it to the total number of times the video was judged as complete. The false positive rate (FPR) measures the degree to which the system is "too lenient," that is, the degree to which it incorrectly judges incomplete videos as complete.
[0094] The false negative rate (FNR) is calculated by dividing the number of times a system's video was successfully played despite being deemed incomplete by the total number of times the video was deemed incomplete. The FNR measures how "overly strict" the system is, i.e., how many times it incorrectly rejects usable videos.
[0095] The expression for the overall error rate is as follows:
[0096] ErrorRate = w1×FPR + w2×FNR
[0097] In the formula, ErrorRate is the overall error rate, w1 and w2 are weighting coefficients that can be configured according to business needs (e.g., w1 can be increased when more attention is paid to playback failure), FPR is the false positive rate, and FNR is the false negative rate. The overall error rate is used to evaluate the overall performance of the current judgment model and provides a basis for parameter updates.
[0098] In one possible implementation, adjusting the judgment parameters based on the judgment result and the actual playback result includes:
[0099] The updated duration tolerance ratio is obtained based on the duration tolerance ratio coefficient, the missed detection rate, and the false detection rate;
[0100] The updated file size ratio coefficient is obtained based on the file size ratio coefficient, the false negative rate, and the false positive rate;
[0101] The updated bitrate tolerance threshold is obtained based on the bitrate tolerance threshold and the video bitrate volatility; the volatility is the standard deviation of the historical video actual bitrate data.
[0102] The updated expression for the duration tolerance ratio is as follows:
[0103] α_new = α + λ1 × FNR − λ2 × FPR
[0104] In the formula, α_new is the updated duration tolerance ratio coefficient, α is the duration tolerance ratio coefficient, that is, the duration tolerance ratio coefficient before the update, which is used to control the allowable error range of video duration, λ1 is the missed detection rate adjustment coefficient (learning rate), which is used to control the degree of influence of FNR on α, and λ2 is the false detection rate adjustment coefficient (learning rate), which is used to control the degree of influence of FPR on α.
[0105] The above formula is used to dynamically adjust the "strictness of duration judgment" based on the actual operating effect of the system. The larger α is, the greater the allowable error in duration, and the more lenient the judgment; the smaller α is, the stricter the duration requirement, and the stricter the judgment. This formula essentially implements a "positive and negative feedback adjustment mechanism." In the FNR term, a high FNR indicates that many videos, although playable, are judged as "incomplete," and the current judgment rule is too strict. Therefore, λ1 × FNR is added to the original duration tolerance ratio coefficient. Increasing α expands the tolerance range, thereby reducing false negatives. In the FPR term, a high FPR indicates that many videos are actually incomplete but are judged as "complete," and the current judgment rule is too lenient. Therefore, λ2 × FPR is subtracted from the original duration tolerance ratio coefficient. Decreasing α makes the judgment more strict, thereby reducing false positives.
[0106] The updated duration tolerance ratio expression considers both FNR and FPR, achieving the following effect: automatically loosening when deemed "too strict" and automatically tightening when deemed "too lenient," thereby dynamically converging α within a reasonable range.
[0107] λ1 and λ2 are used to control the adjustment speed, and their values are both greater than 0 and less than 1. A larger λ1 is more sensitive to missed detections (more inclined to relax the rules), while a larger λ2 is more sensitive to false positives (more inclined to tighten the rules). In practical applications, the settings can be adjusted according to business priorities. For example, if more attention is paid to "playback success rate", λ1 can be increased appropriately; if more attention is paid to "video quality", λ2 can be increased appropriately.
[0108] The updated expression for the file size ratio factor is as follows:
[0109] β_new =β+μ1×FPR−μ2×FNR
[0110] In the formula, β is the file size ratio coefficient, β_new is the updated file size ratio coefficient, and μ1 and μ2 are the FPR and FNR adjustment coefficients in the file size ratio coefficient update expression, respectively.
[0111] If the false positive rate is high, increase β to improve the completeness requirement; if the false negative rate is high, decrease β to relax the judgment conditions.
[0112] The update expression for the bitrate tolerance threshold is as follows:
[0113] γ_new = γ + η × volatility
[0114] In the formula, γ_new is the updated bitrate tolerance threshold, γ is the bitrate tolerance threshold, that is, the bitrate tolerance threshold before the update, which is used to limit the allowable deviation between the actual bitrate and the expected bitrate, and η is the adjustment coefficient (learning rate), which is used to control the degree of influence of volatility on γ. Volatility represents the degree of change of video bitrate over a period of time and is used to reflect the stability of video coding.
[0115] The above formula is used to dynamically adjust the tolerance range of bitrate determination based on the historical fluctuation of video bitrate. The larger γ is, the greater the bitrate deviation allowed and the more lenient the determination; the smaller γ is, the smaller the bitrate deviation allowed and the more stringent the determination.
[0116] Volatility is represented by the standard deviation of historical video bitrate data. Larger historical bitrate variations result in a larger standard deviation, indicating unstable video encoding. High volatility suggests that the video bitrate is significantly affected by encoding, network, or processing factors, and that there are marked differences between different videos. Therefore, increasing γ relaxes the bitrate judgment range, ensuring γ_new is greater than γ to avoid misjudgments. Conversely, low volatility indicates stable video encoding and minimal bitrate variation. Therefore, maintaining or slightly adjusting γ preserves judgment accuracy.
[0117] η is used to control the adjustment range, and its value is greater than 0 and less than 1. If η is larger, the adjustment range of γ is larger and the response is faster; if η is smaller, the adjustment of γ is smoother and more stable.
[0118] For example, if γ=0.1, the volatility is 0.2 (the bitrate fluctuates greatly), and η=0.5, then γ_new is 0.2, which means that the bitrate determination range has been relaxed.
[0119] The aforementioned bitrate tolerance threshold update mechanism can automatically adapt to videos with different encoding strategies, reduce misjudgments caused by bitrate fluctuations, improve the system's adaptability to complex video scenarios, and enhance the stability and robustness of the judgment model.
[0120] In one possible implementation, adjusting the judgment parameters based on the judgment result and the actual playback result further includes:
[0121] The updated judgment threshold is obtained based on the judgment threshold, the target judgment result accuracy, and the actual judgment result accuracy; the actual judgment result accuracy is the ratio of the number of correct judgment results to the total number of judgments; the number of correct judgment results includes the number of times the judgment result is complete and the playback is successful, and the number of times the judgment result is incomplete and the playback fails.
[0122] The updated expression for the threshold is as follows:
[0123] Threshold_new = Threshold +θ×(TargetAccuracy - CurrentAccuracy)
[0124] In the formula, Threshold is the judgment threshold, i.e., the comprehensive score judgment threshold before the update; Threshold_new is the judgment threshold after the update; θ is the adjustment coefficient (learning rate) for the judgment threshold update, used to control the magnitude of the threshold adjustment or the speed of threshold change. θ is greater than 0 and less than 1. When θ is larger, the threshold changes quickly (rapid response, but may be unstable); when θ is smaller, the threshold changes slowly (smoother and more stable). In practical applications, a smaller value is usually taken, generally between 0.01 and 0.1; TargetAccuracy is the target judgment result accuracy, i.e., the expected judgment accuracy (e.g., 95%); CurrentAccuracy is the current actual judgment result accuracy, obtained from historical data statistics.
[0125] The above formula is used to dynamically adjust the "judgment threshold" so that the overall judgment effect gradually approaches the target performance. Specifically, a larger Threshold indicates a stricter judgment (more difficult to judge as "complete"); a smaller Threshold indicates a more lenient judgment (easier to judge as "complete"). This formula is essentially a "target-driven error correction mechanism." When the current actual judgment accuracy is lower than the target judgment accuracy (CurrentAccuracy is less than TargetAccuracy), it indicates that the overall judgment is not ideal, usually manifested as more misjudgments or missed judgments. In this case, increasing the judgment threshold (i.e., Threshold_new is greater than Threshold) makes the judgment more strict, thereby reducing misjudgments. When the current actual judgment accuracy is higher than the target judgment accuracy (CurrentAccuracy is greater than TargetAccuracy), it indicates that the current judgment effect is good, but there may be some redundancy (overly conservative). In this case, appropriately lowering the threshold (i.e., Threshold_new is less than Threshold) makes the judgment more flexible and improves the cache hit rate. This embodiment of the invention will automatically adjust the "pass threshold" according to the current judgment effect; if the performance is poor, the standard will be raised to be more strict; if the performance is good, the standard will be appropriately relaxed to improve efficiency.
[0126] For example, if Threshold=0.7, TargetAccuracy=0.95, CurrentAccuracy=0.9, and θ=0.1, then Threshold_new=0.705, indicating that the judgment criteria have been raised.
[0127] In this embodiment of the invention, the Threshold adjustment is typically used in conjunction with the α, β, and γ parameters. α, β, and γ control the "individual rule determination," while Threshold controls the "overall decision rigor." Together, they achieve a two-tiered optimization of both local and overall aspects.
[0128] Through the Threshold update mechanism, the overall judgment accuracy converges towards the target value, automatically adapts to different data distributions, reduces the need for manual parameter tuning, and achieves a balance between accuracy and resource utilization.
[0129] In addition, to avoid instability in the parameter update process, the following control strategy is adopted: set reasonable ranges for each parameter. For example, the value range of α is [0.02, 0.1], the value range of β is [0.8, 0.95], the value range of γ is [0.05, 0.2], and the value range of Threshold is [0.5, 0.9].
[0130] The updated parameters are then subjected to exponential smoothing, as shown in the following expression:
[0131] Param_final = k × Param_new + (1 - k) × Param_old
[0132] In the formula, k is the smoothing coefficient, which is greater than 0 and less than 1; Param_new is the new parameter value obtained in this round of calculation; Param_old is the historical parameter value before the update; and Param_final is the final parameter value after smoothing. The above formula is used to "buffer" the parameter update results, preventing drastic changes in parameters due to short-term fluctuations. The strategy of this embodiment is not to immediately and completely trust the new data, but to adjust the data gradually.
[0133] Parameter updates are performed at fixed intervals, such as once per hour or after accumulating a certain amount of data. When data anomalies are detected (such as a sudden surge in playback failures), parameter updates are paused or reverted to historical stable parameters. Updated parameters are uniformly managed and distributed through the rule center, supporting version control, canary releases (partial traffic verification), and quick rollback (restoring old parameters in case of anomalies). The policy engine loads the latest version of parameters when executing judgments, enabling online application.
[0134] In this embodiment of the invention, by extracting video duration, file size, and video bitrate features and constructing a judgment model, a comprehensive scoring result is obtained to comprehensively judge the integrity of cached videos. This avoids the misjudgment problem caused by relying solely on file existence judgment, improves the accuracy of cached video integrity judgment, reduces video playback interruptions, and enhances user experience. Adaptive judgment parameters are introduced, including duration tolerance coefficient, file size coefficient, bitrate tolerance threshold, and judgment threshold. Differentiated judgment standards are adopted for videos of different lengths and types, improving the universality and adaptability of the judgment mechanism and avoiding the problems of being too strict or too lenient due to fixed thresholds. By collecting historical judgment results and actual playback results, the system constructs indicators for false positive rate and false negative rate, and dynamically optimizes the parameters to achieve continuous optimization of the judgment model, reducing the false positive rate and false negative rate, thus realizing a closed-loop system of "judgment-feedback-optimization". It supports dynamic updating of judgment parameters, enabling online adjustment of judgment strategies without modifying the code, and realizing differentiated strategies for multiple scenarios and vehicle models, improving system scalability and maintainability. When cache judgment fails, it automatically performs cache invalidation processing and dynamically selects retry or rollback to the real-time stream based on the number of failures, thereby avoiding the long-term impact of abnormal cache on the system, preventing repeated invalid requests, and improving the robustness and stability of the system.
[0135] This invention improves the decoupling capability of system modules by constructing a unified determination context object, encapsulating video features and target parameters, facilitating the expansion of new determination features, and enhancing system maintainability.
[0136] This invention improves the robustness of the judgment results, reduces the risk of a single rule failing, and supports flexible adjustment of the judgment logic by assigning weights to different judgment rules and making a final judgment based on a comprehensive score.
[0137] In this embodiment of the invention, the range of values for the self-learning parameters is set, and a smooth update method is used to control parameter changes, prevent parameter oscillation or divergence, improve system stability, and ensure that the self-learning process is controllable.
[0138] In another embodiment of the present invention, an electronic device is also provided, the electronic device including a processor and a memory, the memory storing at least one instruction or at least one program, the at least one instruction or at least one program being loaded and executed by the processor to implement the vehicle-mounted historical video playback control method proposed in the embodiment of the present invention.
[0139] In another embodiment of the present invention, a computer-readable storage medium is also provided, wherein at least one instruction or at least one program is stored in the storage medium, and the at least one instruction or at least one program is loaded and executed by a processor to implement the vehicle-mounted historical video playback control method proposed in the embodiment of the present invention.
[0140] The foregoing primarily describes the solutions provided by the embodiments of the present invention from the perspective of the device. It is understood that, in order to achieve the above functions, the device includes corresponding hardware structures and / or software modules for executing each function. Those skilled in the art should readily recognize that, in conjunction with the algorithmic steps of the various examples described in the embodiments disclosed herein, the present invention can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present invention.
[0141] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions within the technical scope disclosed in the present invention should be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A method for controlling the playback of in-vehicle historical videos, characterized in that, include: In response to a historical video request, query the caching system to see if a corresponding video cache record exists; If video cache records exist, determine whether the video file actually exists. If the video file exists, extract the video features and determine whether the cached video is complete; If the cached video is complete, return the cached video address and play the video; If there is no video cache record or the cached video is incomplete, record the number of failed video requests in the current history. If the number of failed requests is greater than a preset threshold, return the real-time streaming address to play the video. If the number of failures is less than or equal to a preset threshold, the video generation or streaming request is re-initiated.
2. The in-vehicle historical video playback control method according to claim 1, characterized in that, The step of extracting video features and determining whether the cached video is complete includes: Extract video features; the video features include video duration, file size, and video bitrate. The video duration is determined to be complete based on the video length, the expected video length, and a preset tolerance threshold; the tolerance threshold is determined based on a preset minimum tolerance value, a duration tolerance ratio coefficient, and the expected video length. Determine whether video data is missing based on file size, the ratio of expected file size to preset file size; Determine whether the video has abnormal encoding or is damaged based on the video bitrate, the expected bitrate and the preset bitrate tolerance threshold; A comprehensive score is obtained based on whether the video duration is complete, whether the video data is missing, and whether the video has abnormal encoding or corruption. The integrity of the cached video is determined based on the comprehensive score and the preset judgment threshold.
3. The in-vehicle historical video playback control method according to claim 2, characterized in that, Also includes: The system continuously collects the judgment results of whether the cached video is complete and the actual playback results, and adjusts the judgment parameters based on the judgment results and the actual playback results. The determination parameters include the duration tolerance ratio coefficient, the file size ratio coefficient, the bitrate tolerance threshold, and the determination threshold.
4. The in-vehicle historical video playback control method according to claim 3, characterized in that, After continuously collecting the results of determining whether the cached video is complete and comparing them with the actual playback results, the following is also included: The false positive rate is determined based on the number of times the judgment result is complete but playback fails, and the total number of times the judgment result is complete. The false negative rate is determined based on the number of times the judgment result is incomplete but the playback is successful, and the total number of times the judgment result is incomplete. The overall error rate is determined based on the false positive rate and the false negative rate.
5. The in-vehicle historical video playback control method according to claim 4, characterized in that, The step of adjusting the judgment parameters based on the judgment result and the actual playback result includes: The updated duration tolerance ratio is obtained based on the duration tolerance ratio coefficient, the missed detection rate, and the false detection rate; The updated file size ratio coefficient is obtained based on the file size ratio coefficient, the false negative rate, and the false positive rate; The updated bitrate tolerance threshold is obtained based on the bitrate tolerance threshold and the video bitrate volatility; the volatility is the standard deviation of the historical video actual bitrate data.
6. The in-vehicle historical video playback control method according to claim 4, characterized in that, The step of adjusting the judgment parameters based on the judgment result and the actual playback result further includes: The updated judgment threshold is obtained based on the judgment threshold, the target judgment result accuracy, and the actual judgment result accuracy; the actual judgment result accuracy is the ratio of the number of correct judgment results to the total number of judgments; the number of correct judgment results includes the number of times the judgment result is complete and the playback is successful, and the number of times the judgment result is incomplete and the playback fails.
7. The in-vehicle historical video playback control method according to claim 1, characterized in that, The video cache record includes the video access address, video generation status, and video parameters.
8. The in-vehicle historical video playback control method according to claim 1, characterized in that, The determination of whether a video file actually exists includes: Determine if a video file actually exists by checking the HTTP response status code; If it exists, determine whether the video file is accessible.
9. An electronic device, characterized in that, The electronic device includes a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or at least one program is loaded and executed by the processor to implement the vehicle-mounted historical video playback control method as described in any one of claims 1-8.
10. A computer-readable storage medium, characterized in that, The storage medium stores at least one instruction or at least one program, which is loaded and executed by a processor to implement the vehicle-mounted historical video playback control method as described in any one of claims 1-8.