Intelligent control method, terminal, television receiver and system for television programs
Patent Information
- Application Number
- CN202610547626.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-23
- Publication Date
- 2026-08-18
AI Technical Summary
[0003]现有技术中,电视节目智能控制及广告替换方法存在以下问题:广播节目的广告时段编排存在不确定性,节目播出时间可能因前序节目超时、直播延时等因素发生偏移,导致预设的广告起止时间与实际播出时间不符,现有方法难以准确预测广告时段的到达时间
(1)本发明通过第一层卡尔曼滤波器处理节目编排不确定性,第二层卡尔曼滤波器处理编码层随机性,两层预测误差互不传播放大,降低了整体预测误差。覆盖操作限定在帧内编码帧上执行,使接收端解码器在切换瞬间无需重建参考帧列表即可正常解码。预转码阶段根据编码缓冲区占用率预测值调整替代广告起始图像组的编码参数,将码率跳变控制在预设阈值以内,避免了因码率突变导致的解码器缓冲区上溢或下溢。时序校验模块的持续监测和反馈回路,使双层卡尔曼滤波器能够根据实际偏差动态校正预测模型,提高了后续广告时段预测的准确度。
Smart Images

Figure CN122601934A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to image communication, such as the field of television technology, specifically to intelligent control methods, terminals, television receivers, and systems for television programs. Background Technology
[0002] Television receivers (including digital televisions, set-top boxes, smart TV terminals, etc.) are used to receive real-time broadcast streams transmitted by broadcast operators through cable television networks, satellite networks, or Internet Protocol (IP) networks. They demultiplex and decode the received streams before outputting them to display devices. In broadcast television programs, advertising slots are a fixed component of the programming; advertisers purchase these slots to deliver commercial information to viewers. With the increasing demand for personalized and regionalized advertising, real-time replacement of advertising content in the broadcast stream at the receiving end has become a key area of technological development.
[0003] Existing technologies for intelligent control and ad replacement of television programs suffer from the following problems: The scheduling of ad slots in broadcast programs is uncertain; program broadcast times may shift due to factors such as preceding program timeouts or live broadcast delays, leading to discrepancies between the preset ad start and end times and the actual broadcast times. Existing methods struggle to accurately predict the arrival time of ad slots. When switching ad content at the encoded stream level, improper switching points (such as switching on predictive or bidirectional predictive encoded frames) can cause breaks in the receiver decoder's reference frame list, resulting in decoding errors or screen tearing. Sudden changes in the encoding buffer occupancy rate during switching can cause decoder buffer overflow or underflow, resulting in playback stuttering or interruption. Audio signal switching during ad replacement often produces "pops" or abrupt changes in timbre, affecting the auditory experience. Traditional ad replacement strategies lack consideration for user preferences; the replacement ads have low relevance to user interests, and there is a risk of user privacy data leakage. The authenticity of playback data for ad replacement events is difficult to verify, and the distribution of revenue among multiple parties lacks a transparent and automated mechanism.
[0004] Therefore, a method, terminal, television receiver, and system for intelligent control of television programs are provided. Summary of the Invention
[0005] To address the problems mentioned in the background art, the present invention provides the following technical solution: an intelligent control method for television programs, applied to broadcast real-time television programs, comprising: The system receives real-time broadcast streams and predicts advertising periods based on a two-layer Kalman filter: the first-layer Kalman filter uses the advertising period offset and the rate of change of offset as state vectors to output the macroscopic prediction time window and macroscopic confidence interval of the advertising period; the second-layer Kalman filter uses the coding buffer occupancy rate and the rate of change of coding complexity between image groups as state vectors to search for the optimal switching point at the boundary of the image group within the macroscopic confidence interval. When the predicted advertising period is about to arrive, an alternative advertisement is obtained and, during the pre-transcoding process, the encoding parameters of the starting image group of the alternative advertisement are adjusted according to the predicted value of the encoding buffer occupancy rate at the optimal switching point, so that the difference between the initial encoding buffer occupancy rate of the alternative advertisement at the switching point and the encoding buffer occupancy rate of the real-time broadcast stream at the switching point does not exceed the preset safety margin. Overlay is performed on the intra-coded frame at the optimal switching point to replace the advertising period content. The encoding parameters of the overlay start frame are adjusted according to the predicted value of the encoding buffer occupancy rate so that the bit rate jump at the moment of overlay is lower than the preset threshold. The system continuously monitors the time deviation and coding buffer occupancy deviation after coverage. The time deviation is fed back to the first-layer Kalman filter to correct the macroscopic prediction, and the coding buffer occupancy deviation is fed back to the second-layer Kalman filter to correct the microscopic prediction.
[0006] Furthermore, in the dual-layer Kalman filter, the first-layer Kalman filter recursively updates the state estimate using historical observations from the past N broadcast cycles, outputting a macroscopic error covariance matrix, and the macroscopic confidence interval is determined by the macroscopic error covariance matrix; The second-layer Kalman filter recursively updates the state estimate using real-time data from the coding layer of the real-time broadcast stream within the macroscopic confidence interval, and outputs the microscopic error covariance matrix. The preprocessing pipeline module dynamically adjusts the lead amount of the preload based on the norm of the macro error covariance matrix; the greater the prediction uncertainty, the greater the lead amount. The multi-dimensional feature fusion engine receives at least three types of feature inputs and performs fusion judgment: audio energy envelope features, video scene switching features, electronic program guide timestamp features, and historical advertising time slot offset features. When the width of the macro confidence interval exceeds the preset abnormal threshold, it is judged as an arrangement abnormality, and advertising replacement is not performed.
[0007] Furthermore, the search strategy for the optimal switching point includes: parsing the network abstraction layer unit type of real-time broadcast stream coding, identifying the position of intra-coded frames, and calculating the length of the image group; Among all intra-coded frames of image group boundaries selected within the macro confidence interval, the image group boundary with the closest predicted coding buffer occupancy rate to the preset safe median and the lowest coding complexity is selected as the optimal switching point. If there are no image group boundaries that meet the safety margin conditions within the macro confidence interval, then relax the buffer constraint to the suboptimal range and re-select; If no image group boundary meets the conditions, wait for the next macroscopic confidence interval; The amount of encoding parameter adjustment in subsequent overlay operations is dynamically adjusted based on the monitored time deviation and / or encoding buffer occupancy deviation. If the original duration of the alternative advertisement is inconsistent with the predicted duration of the advertisement segment, and the speed factor is within the preset allowable range, then speed-changing processing will be performed synchronously during the pre-transcoding stage so that the playback duration after speed-changing is equal to the predicted duration of the advertisement segment.
[0008] Furthermore, crossfade-in and crossfade-out processing is performed on the audio signals at the start and end of coverage. The duration of the crossfade-in and crossfade-out is adaptively determined based on the perceived spectral distance between the audio at the start of the alternative advertisement and the audio at the end of the original live broadcast stream. The perceived spectral distance is calculated using a frequency domain weighting method based on a psychoacoustic model: short-time Fourier transforms are performed on the two audio signals to obtain the spectrum, and perceptual weights are applied to each frequency band according to the equal loudness curve and the simultaneous masking effect to calculate the weighted spectral distance. The larger the perceived spectral distance, the longer the crossfade-in and crossfade-out duration, ranging from 50 milliseconds to 300 milliseconds. When the perceived spectral distance exceeds a preset perceptual distortion threshold, spectral bridging processing is performed before crossfade-in and crossfade-out: audio segments of 20 to 50 milliseconds are taken on both sides of the coverage boundary, and the spectral envelope of the audio at the start of the alternative advertisement is gradually interpolated using a phase vocoder to transition it to the spectral envelope of the audio at the end of the original live broadcast stream before crossfade-in and crossfade-out is performed. At the same time, the speed factor is limited to the range of 0.95 to 1.05.
[0009] Furthermore, the selection of alternative advertisements is based on the user preference model local to the terminal: a user preference vector for alternative advertisement categories is maintained locally, and the preference vector is updated locally on the terminal based on the user's historical viewing and selection behavior, without uploading the original behavior data; a matching score is calculated between the candidate alternative advertisements and the preference vector, and the alternative advertisement with the highest score is selected for preloading and pre-transcoding; during non-advertising periods, the user is prompted with information about the upcoming alternative advertisement in a non-blocking interface, and the advertisement will play automatically if the user does not interact within a preset time; if the user issues a change command, a list of alternatives will be displayed; the matching score is transmitted to the multi-dimensional feature fusion engine, which is used as a weighting factor to adjust the weights of each historical observation in the first-layer Kalman filter. When the matching score is lower than a preset relevance threshold, the fusion weight of the electronic program guide timestamp feature is reduced, and the fusion weights of the audio energy envelope feature and the video scene switching feature are increased accordingly.
[0010] Furthermore, this also includes: packaging key data of the ad replacement event into a blockchain transaction and submitting it to the consensus network for notarization. The key data includes at least: a unique time period identifier, an alternative ad identifier, a sequence of timestamps for image group boundary switching, a sequence of encoding buffer occupancy deviations, and the actual playback duration; the smart contract on the blockchain verifies the continuity of the timestamp sequence and the total duration to confirm that the alternative ad was played completely within the target ad period; the smart contract also verifies whether each deviation value in the encoding buffer occupancy deviation sequence is within the preset safety margin range. If there are deviation values exceeding the range, the revenue distribution amount is deducted proportionally according to the excess amount; the multi-party revenue distribution is only triggered when both playback verification and buffer compliance verification pass.
[0011] A smart TV program control terminal, comprising: The signal access module is used to receive real-time broadcast streams of broadcast television programs; A multi-dimensional feature fusion engine is used to dynamically predict advertising periods based on a two-layer Kalman filter. The first-layer Kalman filter outputs a macroscopic prediction time window and a macroscopic confidence interval as a state vector with the advertising period offset and the rate of change of the offset. The second-layer Kalman filter searches for the optimal switching point within the macroscopic confidence interval using the coding buffer occupancy rate and the rate of change of coding complexity between image groups as a state vector. It also receives feedback signals from the timing verification module to update the internal Kalman filter model. The preprocessing pipeline module is used to pre-transcode the alternative advertisement to the same encoding parameters as the real-time broadcast stream. It adjusts the encoding parameters of the starting image group of the alternative advertisement based on the predicted value of the encoding buffer occupancy rate at the optimal switching point, so that the difference between the initial encoding buffer occupancy rate of the alternative advertisement at the switching point and the encoding buffer occupancy rate of the real-time broadcast stream at the switching point does not exceed a preset safety margin. The advertising overlay module is used to perform overlay on the intra-coded frame at the optimal switching point to replace the advertising period content. The encoding parameters of the overlay start frame are adjusted according to the predicted value of the encoding buffer occupancy rate so that the bit rate jump amplitude at the moment of overlay is lower than the preset threshold. The timing verification module is used to continuously monitor the time deviation and encoding buffer occupancy deviation of the real-time broadcast stream after coverage, and feed the deviation back to the multi-dimensional feature fusion engine and the advertising coverage module in real time. The output module is used to output the overlaid real-time broadcast stream to the display device.
[0012] A television receiver comprising a smart control terminal for television programs.
[0013] A smart control system for television programs includes: At least one smart control terminal for television programs; The vendor server includes an advertising material library, a model parameter library, and a model update module. The model update module is used to update the parameters of the two-layer Kalman filter model based on the switching timestamps and encoding buffer occupancy deviation data reported by multiple terminals, and then distribute the updated model parameters to each terminal. A blockchain consensus network is used to store proof of playback and buffer compliance for advertising replacement events and to execute smart contract-driven multi-party revenue distribution.
[0014] Furthermore, the model update module collects the time correction sequence and encoding buffer occupancy deviation sequence reported by each terminal, statistically analyzes the macro-prediction deviation distribution and micro-prediction deviation distribution of each terminal, and updates the process noise covariance matrix and observation noise covariance matrix of the first-layer Kalman filter and the second-layer Kalman filter respectively, and sends the updated model parameters to each terminal, so that each terminal can obtain the model prior parameters based on global data optimization while maintaining local two-layer adaptive correction.
[0015] Beneficial effects The present invention has the following beneficial effects: (1) This invention uses a first-layer Kalman filter to handle program scheduling uncertainty and a second-layer Kalman filter to handle coding layer randomness. The prediction errors of the two layers do not propagate and amplify each other, thus reducing the overall prediction error. The overlay operation is limited to intra-frame coded frames, so that the receiver decoder can decode normally without rebuilding the reference frame list at the moment of switching. In the pre-transcoding stage, the coding parameters of the replacement advertisement starting image group are adjusted according to the predicted value of the coding buffer occupancy rate, and the bit rate jump is controlled within the preset threshold, avoiding decoder buffer overflow or underflow caused by sudden bit rate changes. The continuous monitoring and feedback loop of the timing verification module enables the dual-layer Kalman filter to dynamically correct the prediction model according to the actual deviation, improving the accuracy of subsequent advertisement segment prediction.
[0016] (2) This invention uses the first-layer Kalman filter to accumulate program scheduling rules from historical observations, and the macroscopic error covariance matrix quantitatively reflects the prediction uncertainty; the second-layer Kalman filter is activated only within the macroscopic confidence interval, narrowing the search range and reducing the amount of computation; the preprocessing pipeline module dynamically adjusts the preloading advance based on the norm of the macroscopic error covariance matrix to achieve a balance between resource utilization and time guarantee; the multi-dimensional feature fusion engine uses the complementarity of multiple features to improve the reliability of observations; and anomaly detection prevents advertisement replacement when the prediction accuracy is insufficient, thus avoiding broadcast accidents.
[0017] (3) This invention accurately identifies the position of intra-frame encoded frames by parsing the network abstraction layer unit type, and determines the boundary of image groups, avoiding decoding errors caused by switching within image groups. Candidate switching points are screened within the macro-confidence interval, narrowing the search range from all frames to a small number of candidate points, thus reducing computational load. The optimal switching point is selected by comprehensively considering the deviation between the predicted value and the safe median of the encoding buffer occupancy rate, as well as the encoding complexity, ensuring that the switching point meets the buffer stability requirements and has a low decoding burden. Suboptimal relaxed screening and waiting mechanisms ensure that executable switching points can still be obtained in extreme cases. Dynamically adjusting encoding parameters can adaptively correct prediction errors. Variable speed processing ensures that the duration of the alternative advertisement is precisely matched with the duration of the predicted advertisement period, avoiding black screens due to insufficient duration or content loss due to exceeding the duration limit.
[0018] (4) This invention adaptively determines the cross-fade-in and fade-out duration based on the perceived spectral distance. When the spectral difference is small, a short duration of 50 milliseconds is used to reduce masking, and when the spectral difference is large, a long duration of 300 milliseconds is used to provide sufficient transition. The perceived spectral distance is based on a psychoacoustic model, using equal loudness curves and simultaneous masking effects for frequency domain weighting, so that the distance measurement is consistent with the actual perception of the human ear. The spectral bridging process performs gradual interpolation on the spectral envelope of the replacement advertisement's starting audio before the cross-fade-in and fade-out, reducing the spectral discontinuity at the coverage boundary and minimizing abrupt changes in timbre. The speed factor is limited to the range of 0.95 to 1.05 to ensure that the impact of the speed processing on pitch and playback speed is below the threshold perceptible to the human ear.
[0019] Of course, any product implementing this invention does not necessarily need to achieve all of the advantages described above at the same time. Attached Figure Description
[0020] Figure 1 This is a flowchart of the advertising time prediction process of the present invention.
[0021] Figure 2 This is a flowchart of the optimal switching point search strategy of the present invention.
[0022] Figure 3 This is a flowchart of the advertising substitution and pre-transcoding process of the present invention.
[0023] Figure 4 This is a flowchart illustrating the advertising coverage process of the present invention.
[0024] Figure 5 This is a flowchart of the continuous monitoring and feedback correction process of the present invention.
[0025] Figure 6 This is a flowchart illustrating the blockchain-based evidence storage and revenue distribution process of this invention. Detailed Implementation
[0026] 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.
[0027] Please see Figures 1 to 6 This invention provides a technical solution: an intelligent control method for television programs, applied to broadcast real-time television programs, comprising: The system receives real-time broadcast streams and predicts advertising periods based on a two-layer Kalman filter: the first-layer Kalman filter uses the advertising period offset and the rate of change of offset as state vectors to output the macroscopic prediction time window and macroscopic confidence interval of the advertising period; the second-layer Kalman filter uses the coding buffer occupancy rate and the rate of change of coding complexity between image groups as state vectors to search for the optimal switching point at the boundary of the image group within the macroscopic confidence interval. When the predicted advertising period is about to arrive, an alternative advertisement is obtained and, during the pre-transcoding process, the encoding parameters of the starting image group of the alternative advertisement are adjusted according to the predicted value of the encoding buffer occupancy rate at the optimal switching point, so that the difference between the initial encoding buffer occupancy rate of the alternative advertisement at the switching point and the encoding buffer occupancy rate of the real-time broadcast stream at the switching point does not exceed the preset safety margin. Overlay is performed on the intra-coded frame at the optimal switching point to replace the advertising period content. The encoding parameters of the overlay start frame are adjusted according to the predicted value of the encoding buffer occupancy rate so that the bit rate jump at the moment of overlay is lower than the preset threshold. The system continuously monitors the time deviation and coding buffer occupancy deviation after coverage. The time deviation is fed back to the first-layer Kalman filter through the timing verification module to correct the macroscopic prediction, and the coding buffer occupancy deviation is fed back to the second-layer Kalman filter to correct the microscopic prediction.
[0028] In practice, it receives real-time broadcast streams. It receives real-time broadcast streams from broadcast operators.
[0029] Macroscopic prediction is performed based on a two-layer Kalman filter. The first-layer Kalman filter uses the advertising time slot offset and the rate of change of the offset as the state vector, and recursively updates it using historical observations from the past N broadcast cycles, outputting the macroscopic prediction time window and macroscopic confidence interval for the advertising time slot.
[0030] A microscopic search is performed based on a two-layer Kalman filter. The second-layer Kalman filter uses the coding buffer occupancy rate and the rate of change of coding complexity between image groups as state vectors to search for the optimal switching point at the boundary of the image group within the macroscopic confidence interval.
[0031] During the pre-transcoding stage, the encoding parameters of the alternative advertisement are adjusted. When the predicted advertisement period is about to arrive, the alternative advertisement is acquired. During the pre-transcoding process, based on the predicted value of the encoding buffer occupancy rate at the optimal switching point, the encoding parameters of the starting image group of the alternative advertisement are adjusted so that the difference between the initial encoding buffer occupancy rate of the alternative advertisement at the switching point and the encoding buffer occupancy rate of the real-time broadcast stream at the switching point does not exceed a preset safety margin.
[0032] Perform overlay at the optimal switching point. The overlay operation is performed on the intra-coded frame at the optimal switching point, replacing the advertisement segment content with an alternative advertisement. The encoding parameters of the overlay start frame are adjusted based on the predicted encoding buffer occupancy rate, ensuring that the bitrate jump at the moment of overlay is below a preset threshold.
[0033] Continuously monitor and provide feedback corrections. Continuously monitor the time deviation and coding buffer occupancy deviation after coverage. Feed the time deviation back to the first-layer Kalman filter to correct macroscopic predictions, and feed the coding buffer occupancy deviation back to the second-layer Kalman filter to correct microscopic predictions.
[0034] The first-layer Kalman filter handles program scheduling uncertainties, while the second-layer Kalman filter handles coding layer randomness. The prediction errors of the two layers do not propagate or amplify each other, reducing the overall prediction error. Overlay operations are limited to intra-coded frames, avoiding decoding dependency chain breaks caused by switching between predictive coded frames or bidirectional predictive coded frames. This allows the receiver decoder to decode normally without rebuilding the reference frame list at the moment of switching. During the pre-transcoding stage, the coding parameters of the replacement advertisement's initial image group are adjusted based on the predicted coding buffer occupancy rate, keeping bitrate jumps within a preset threshold and preventing decoder buffer overflow or underflow due to sudden bitrate changes. The continuous monitoring and feedback loop of the timing verification module enables the dual-layer Kalman filter to dynamically correct the prediction model based on actual deviations, improving the accuracy of subsequent advertisement predictions.
[0035] Furthermore, in the dual-layer Kalman filter, the first-layer Kalman filter recursively updates the state estimate using historical observations from the past N broadcast cycles, outputting a macroscopic error covariance matrix, and the macroscopic confidence interval is determined by the macroscopic error covariance matrix; The second-layer Kalman filter recursively updates the state estimate using real-time data from the coding layer of the real-time broadcast stream within the macroscopic confidence interval, and outputs the microscopic error covariance matrix. The preprocessing pipeline module dynamically adjusts the lead amount of the preload based on the norm of the macroscopic error covariance matrix; the greater the prediction uncertainty, the greater the lead amount. The multi-dimensional feature fusion engine receives at least three types of feature inputs and performs fusion judgment: audio energy envelope features, video scene switching features, electronic program guide timestamp features, and historical advertising time slot offset features; When the width of the macro confidence interval exceeds the preset abnormal threshold, it is judged as an arrangement abnormality, and the advertisement replacement is not performed.
[0036] In practice, the first-layer Kalman filter is updated recursively. The first-layer Kalman filter uses the advertising time slot offset and the rate of change of offset as its state vector, maintaining a sliding window of length N to store historical observations from the past N broadcast cycles. For each broadcast cycle, the filter is updated recursively using these historical observations: first, it calculates the prior state estimate and prior error covariance matrix based on the state transition matrix; then, it receives the current observations output by the multi-dimensional feature fusion engine, calculates the Kalman gain, and updates the posterior state estimate and posterior error covariance matrix. The filter outputs a macroscopic error covariance matrix, and the macroscopic confidence interval is determined based on the variance of the advertising time slot offset component in this macroscopic error covariance matrix.
[0037] Multi-dimensional feature fusion and anomaly detection. The multi-dimensional feature fusion engine receives at least three types of features: audio energy envelope features, video scene switching features, electronic program guide timestamp features, and historical advertising time slot offset features. The engine weights and fuses the received features, outputting the observed advertising time slot offset values to the first-layer Kalman filter. Simultaneously, the engine calculates the width of the macro-confidence interval output by the first-layer Kalman filter and compares this width with a preset anomaly threshold. If the width exceeds the threshold, it is determined to be a scheduling anomaly, and no advertising replacement operation is performed in this cycle; the first-layer Kalman filter continues to accumulate observation data. If the width does not exceed the threshold, subsequent steps are executed.
[0038] The second-layer Kalman filter is updated recursively. The second-layer Kalman filter uses the coding buffer occupancy rate and the rate of change in inter-group coding complexity as its state vector. It is activated only within the macroscopic confidence interval of the first-layer Kalman filter's output. It is recursively updated using real-time data from the coding layer of the real-time broadcast stream, outputting a microscopic error covariance matrix.
[0039] The preprocessing pipeline module dynamically adjusts the preloading advance. It receives the macroscopic error covariance matrix output from the first-layer Kalman filter and calculates its Frobenius norm. The preloading advance is dynamically adjusted based on the norm value: a larger norm indicates higher prediction uncertainty, requiring a larger preloading advance; a smaller norm requires a smaller preloading advance. The preprocessing pipeline module then initiates the preloading and pre-transcoding of alternative advertisements according to the adjusted advance.
[0040] Ad Coverage and Feedback Correction. The ad coverage module performs coverage operations on the intra-coded frames at the optimal switching point determined by the second-layer Kalman filter. Simultaneously, the timing verification module continuously monitors the time deviation and coding buffer occupancy deviation after coverage, feeding back the time deviation to the first-layer Kalman filter to correct macroscopic predictions, and feeding back the coding buffer occupancy deviation to the second-layer Kalman filter to correct microscopic predictions.
[0041] The first-layer Kalman filter accumulates program scheduling patterns using historical observations, and the macroscopic error covariance matrix quantitatively reflects prediction uncertainty. The second-layer Kalman filter is activated only within the macroscopic confidence interval, narrowing the search range and reducing computational load. The preprocessing pipeline module dynamically adjusts the preloading advance based on the norm of the macroscopic error covariance matrix, achieving a balance between resource utilization and time assurance. The multi-dimensional feature fusion engine improves the reliability of observations by utilizing the complementarity of multiple features. Anomaly detection prevents ad replacement when prediction accuracy is insufficient, avoiding broadcast accidents.
[0042] Furthermore, the search strategy for the optimal switching point includes: parsing the network abstraction layer unit type of real-time broadcast stream coding, identifying the position of intra-coded frames, and calculating the length of the image group; Among all intra-coded frames of image group boundaries selected within the macro confidence interval, the image group boundary with the closest predicted coding buffer occupancy rate to the preset safe median and the lowest coding complexity is selected as the optimal switching point. If there are no image group boundaries that meet the safety margin conditions within the macro confidence interval, then relax the buffer constraint to the suboptimal range and re-select; If no image group boundary meets the conditions, wait for the next macroscopic confidence interval; The amount of encoding parameter adjustment in subsequent overlay operations is dynamically adjusted based on the monitored time deviation and / or encoding buffer occupancy deviation. If the original duration of the alternative advertisement is inconsistent with the predicted duration of the advertisement segment, and the speed factor is within the preset allowable range, then speed-changing processing will be performed synchronously during the pre-transcoding stage so that the playback duration after speed-changing is equal to the predicted duration of the advertisement segment.
[0043] In practice, the network abstraction layer unit (NAL) type is parsed to identify the position of intra-coded frames and calculate the picture group length. For real-time broadcast stream coding, the NAL type is parsed as follows: for H.264 / Advanced Video Coding (H.264) streams, a NAL type value of 5 indicates an intra-coded frame; for H.265 / High Efficiency Video Coding (H.265), a NAL type value of 19 indicates an intra-coded frame. The number of frames between adjacent intra-coded frames is recorded to determine the picture group length, and the playback timestamp of each intra-coded frame is marked as the picture group boundary position.
[0044] Candidate switching points are selected within a macro-confidence interval. Within the macro-confidence interval, all intra-coded frames located at the boundaries of image groups are selected to construct a set of candidate switching points.
[0045] Select the optimal switching point. For each candidate switching point in the candidate switching point set, obtain the predicted value of the encoding buffer occupancy and the estimated value of the encoding complexity at that candidate switching point. Assume the preset safety median is... Safety margin is .
[0046] Calculate the comprehensive evaluation value ,in For coding complexity, For the normalized upper limit, and These are the weighting coefficients, and their sum is 1. Choose... Minimum and satisfy The candidate switching point is taken as the optimal switching point.
[0047] Suboptimal broadening of the selection criteria. If the candidate switching point set does not contain a match... At the condition switching point, the buffer constraints are relaxed to a safety margin of 1.5 times. Under the relaxed constraints, the selection is re-filtered, and the best options are chosen. The smallest candidate switching point is taken as the optimal switching point.
[0048] Wait for the next macroeconomic confidence interval. If no suitable switching point is found under the relaxed constraints, wait for the next macroeconomic confidence interval and re-execute the screening.
[0049] Dynamically adjust the coding parameters. Based on the monitored time deviation, dynamically adjust the coding parameters in subsequent coverage operations: if the actual handover time is later than the predicted handover time, reduce the handover advance for subsequent coverage; if the actual handover time is earlier than the predicted handover time, increase the handover advance. Based on the monitored coding buffer occupancy deviation, if the deviation exceeds a preset buffer deviation threshold, adjust the quantization parameter offset of the starting frame of subsequent coverage.
[0050] Speed adjustment. If the original duration of the replacement advertisement differs from the predicted advertisement duration, the ratio of the original duration to the predicted duration is calculated. If this ratio is within the preset allowable range [0.95, 1.05], speed adjustment is performed synchronously during the pre-transcoding stage. The video frames are time-remapped, and the audio signal is time-scaled while maintaining the pitch, so that the playback duration after speed adjustment equals the predicted advertisement duration. If the ratio is not within the allowable range, speed adjustment is not performed, and switching is performed when the replacement advertisement finishes playing or the advertisement period ends (whichever arrives first).
[0051] By accurately identifying the intra-frame encoded frame location through parsing the network abstraction layer unit type, the boundaries of image groups are determined, avoiding decoding errors caused by switching within image groups. Candidate switching points are filtered within a macro-confidence interval, narrowing the search range from all frames to a small number of candidate points, reducing computational load. The optimal switching point is selected by comprehensively considering the deviation between the predicted and safe median coding buffer occupancy rates and coding complexity, ensuring that the switching point meets buffer stability requirements and has a low decoding burden. Suboptimal relaxed filtering and waiting mechanisms ensure that executable switching points can still be obtained in extreme cases. Dynamically adjusting coding parameters can adaptively correct prediction errors. Variable-speed processing ensures that the duration of the alternative advertisement precisely matches the duration of the predicted advertisement period, avoiding black screens due to insufficient duration or content loss due to exceeding the duration limit.
[0052] Furthermore, crossfade-in and crossfade-out processing is performed on the audio signals at the start and end of coverage. The duration of the crossfade-in and crossfade-out is adaptively determined based on the perceived spectral distance between the audio at the start of the alternative advertisement and the audio at the end of the original live broadcast stream. The perceived spectral distance is calculated using a frequency domain weighting method based on a psychoacoustic model: short-time Fourier transforms are performed on the two audio signals to obtain the spectrum, and perceptual weights are applied to each frequency band according to the equal loudness curve and the simultaneous masking effect to calculate the weighted spectral distance. The larger the perceived spectral distance, the longer the crossfade-in and crossfade-out duration, ranging from 50 milliseconds to 300 milliseconds. When the perceived spectral distance exceeds a preset perceptual distortion threshold, spectral bridging processing is performed before crossfade-in and crossfade-out: audio segments of 20 to 50 milliseconds are taken on both sides of the coverage boundary, and the spectral envelope of the audio at the start of the alternative advertisement is gradually interpolated using a phase vocoder to transition it to the spectral envelope of the audio at the end of the original live broadcast stream before crossfade-in and crossfade-out is performed. At the same time, the speed factor is limited to the range of 0.95 to 1.05.
[0053] In practice, audio segments are extracted. Before coverage begins, the last audio segment A, which is 20 to 50 milliseconds before the coverage boundary, is extracted from the live broadcast stream, and the first audio segment B, which is 20 to 50 milliseconds after the coverage boundary, is extracted from the pre-processed alternative advertisement.
[0054] Short-Time Fourier Transform. Apply a Hanning window to audio segment A and audio segment B respectively, perform a short-time Fourier transform with a window length of 20 milliseconds and a frame shift of 10 milliseconds, and output the spectral representations of the two audio signals. and .
[0055] Calculate the perceived spectral distance. Based on the psychoacoustic model, calculate the perceived weights for each frequency band: apply weighting coefficients L(f) to the frequency components according to the equal loudness curves; calculate the masking threshold for each frequency band based on the critical band model to obtain the masking effect weights. Perceived weights .
[0056] Calculate the weighted sensing spectral distance .
[0057] The specific meanings are as follows: and : represent the spectrum of the audio segment A at the end of the original real-time broadcast stream and the audio segment B at the beginning of the alternative advertisement (obtained through short-time Fourier transform), respectively, where f is the frequency.
[0058] Perceptual weights, calculated based on a psychoacoustic model (the product of equal loudness curves and simultaneous masking effect), are used to simulate the differences in human ear sensitivity to different frequencies.
[0059] The square of the difference in spectral amplitude between two audio segments at frequency f reflects the energy difference at that frequency.
[0060] The weighted total difference is obtained by summing the weighted energy differences at each frequency point.
[0061] The sum of the sensing weights at each frequency point is used for normalization to eliminate the influence of weight scaling.
[0062] Square root operation converts the energy dimension into the amplitude dimension, making distance measurement more consistent with the human ear's loudness perception characteristics.
[0063] Overall physical meaning: This formula calculates the weighted root mean square of the difference in the spectra of two audio segments under the influence of perceptual weights. The larger the value, the greater the spectral difference between the two audio segments as perceived by the human ear, requiring a longer crossfade-in and fade-out duration for a smooth transition.
[0064] Determine the cross-fade-in and fade-out parameters based on the perceived spectral distance. Determine the cross-fade-in and fade-out duration
[0065] , Its meaning is as follows: 50: Shortest crossfade-in / fade-out duration (milliseconds), corresponding to two audio segments with very similar spectra ( (The situation is as follows.)
[0066] 300: Longest crossfade-in / fade-out duration (milliseconds), corresponding to the difference in the spectrum of two audio segments reaching or exceeding the upper limit. (The situation is as follows.)
[0067] D_max: The normalized upper bound of the perceptual spectral distance, when If the value exceeds this, the difference is considered large enough, and there is no need to continue increasing the duration.
[0068] :Will Mapped to the interval [0,1]. If If, then take the ratio; if If , then take 1.
[0069] (300-50)·min(...): Calculates the duration increment, ranging from 0 to 250 milliseconds.
[0070] 50+ Increments: The final duration varies linearly between 50 milliseconds and 300 milliseconds.
[0071] Physical meaning: The greater the spectral difference, the longer the crossfade-in and fade-out duration to provide a more adequate transition; the smaller the spectral difference, the shorter the duration to reduce masking of the original audio. When the difference reaches or exceeds the upper limit, the longest duration (300 milliseconds) is used.
[0072] The duration ranges from 50 milliseconds to 300 milliseconds. The perceived spectral distance is compared with a preset perceived distortion threshold: if it exceeds the threshold, spectral bridging is performed; otherwise, spectral bridging is skipped.
[0073] Spectrum bridging processing (conditional execution). When the perceived spectral distance exceeds the threshold, audio segments A' and B', each ranging from 20 to 50 milliseconds, are taken from both sides of the coverage boundary. The spectral envelope and instantaneous frequency information of segment B' are extracted using a phase vocoder. The spectral envelope is then gradually interpolated on the time axis, so that it gradually transitions from the spectral envelope of segment B' itself to the spectral envelope of segment A'.
[0074] Perform cross-fade-in / fade-out. At the start of the coverage, for a duration of... Within the time window, a gain curve that decreases linearly from 1 to 0 is applied to the audio at the end of the original broadcast stream, while a gain curve that increases linearly from 0 to 1 is applied to the audio at the beginning of the alternative advertisement. The two weighted audio signals are then summed and output. At the end of the coverage, the opposite crossfade-in and crossfade-out operations are performed.
[0075] Limit the shift factor. During the pre-transcoding stage, limit the shift factor to the range of 0.95 to 1.05.
[0076] The crossfade-in and fade-out durations are adaptively determined based on the perceived spectral distance. A short duration of 50 milliseconds is used to reduce masking when spectral differences are small, while a long duration of 300 milliseconds is used to provide a sufficient transition when spectral differences are large. The perceived spectral distance is based on a psychoacoustic model, using equal-loudness curves and simultaneous masking effects for frequency domain weighting, ensuring that the distance measurement is consistent with actual human perception. Spectral bridging processing performs gradual interpolation on the spectral envelope of the replacement advertisement's starting audio before the crossfade-in and fade-out, reducing spectral discontinuities at the coverage boundary and minimizing abrupt changes in timbre. The speed factor is limited to the range of 0.95 to 1.05 to ensure that the impact of speed processing on pitch and playback speed is below the perceptible threshold for the human ear.
[0077] Furthermore, the selection of alternative advertisements is based on the user preference model local to the terminal: a user preference vector for alternative advertisement categories is maintained locally, and the preference vector is updated locally on the terminal based on the user's historical viewing and selection behavior, without uploading the original behavior data; a matching score is calculated between the candidate alternative advertisements and the preference vector, and the alternative advertisement with the highest score is selected for preloading and pre-transcoding; during non-advertising periods, the user is prompted with information about the upcoming alternative advertisement in a non-blocking interface, and the advertisement will play automatically if the user does not interact within a preset time; if the user issues a change command, a list of alternatives will be displayed; the matching score is transmitted to the multi-dimensional feature fusion engine, which is used as a weighting factor to adjust the weights of each historical observation in the first-layer Kalman filter. When the matching score is lower than a preset relevance threshold, the fusion weight of the electronic program guide timestamp feature is reduced, and the fusion weights of the audio energy envelope feature and the video scene switching feature are increased accordingly.
[0078] In practice, the user preference model is maintained locally. A user preference vector for alternative ad categories is maintained in the terminal's local storage. The preference vector is updated locally on the terminal based on the user's historical viewing and selection behavior: recording the user's cumulative viewing time for various program content, the alternative ad category selected by the user when issuing a change command via remote control before the alternative ad plays, periodically generating behavioral statistical feature values, updating them according to an exponentially weighted moving average rule, and normalizing them. Raw behavioral data is not uploaded.
[0079] Calculate the matching score and select alternative ads. Calculate the matching score (weighted sum of components) between the candidate alternative ads and the preference vector. Select the alternative ad with the highest score for preloading and pre-transcoding.
[0080] User interaction. During non-advertising periods, display alternative ad information to the user in a non-blocking interface. Start a timer for a preset duration (e.g., 10 seconds): play automatically if the user does not interact; if the user issues a change command, display a list of the top 3 candidates based on matching scores, and update the alternative ad according to the user's selection.
[0081] The matching score is fed back to the multi-dimensional feature fusion engine. The highest matching score is sent to the multi-dimensional feature fusion engine. When the highest matching score is lower than a preset relevance threshold, the fusion weight of the EPT (Electronic Program Guide) timestamp feature is reduced, while the fusion weights of the audio energy envelope feature and the video scene transition feature are correspondingly increased. The adjustment method is as follows: new EPT timestamp feature weight = default weight × (highest matching score / relevance threshold); the sum of the increases in the weights of the audio energy envelope feature and the video scene transition feature equals the decrease in the weight of the EPT timestamp feature.
[0082] The user preference model is maintained and updated locally on the terminal without uploading raw behavioral data, protecting user privacy while providing personalized alternative ad options. Ad selection is based on matching scores, making ad content more relevant to user interests and increasing user acceptance. Non-blocking interface prompts and user-replacement mechanisms preserve user intervention capabilities. Matching scores are fed back to a multi-dimensional feature fusion engine; when the matching score falls below a threshold, the weight of the EPC guide timestamp feature is reduced, while the weight of the real-time stream feature is increased, making the first-layer Kalman filter more reliant on real-time signals for prediction.
[0083] Furthermore, this also includes: packaging key data of the ad replacement event into a blockchain transaction and submitting it to the consensus network for notarization. The key data includes at least: a unique time period identifier, an alternative ad identifier, a sequence of timestamps for image group boundary switching, a sequence of encoding buffer occupancy deviations, and the actual playback duration; the smart contract on the blockchain verifies the continuity of the timestamp sequence and the total duration to confirm that the alternative ad was played completely within the target ad period; the smart contract also verifies whether each deviation value in the encoding buffer occupancy deviation sequence is within the preset safety margin range. If there are deviation values exceeding the range, the revenue distribution amount is deducted proportionally according to the excess amount; the multi-party revenue distribution is only triggered when both playback verification and buffer compliance verification pass.
[0084] In practice, key data related to the ad replacement event is packaged into a blockchain transaction. This key data includes at least: a unique time-period identifier, a replacement ad identifier, a sequence of timestamps indicating image group boundary switching, a sequence of encoding buffer occupancy deviations, and the actual playback duration. The transaction is then signed using the terminal's private key.
[0085] Submit to the consensus network for notarization. Submit the signed transaction to the blockchain consensus network, and after consensus is reached, write it into a block to complete the notarization.
[0086] Smart contract playback verification. The smart contract verifies the continuity of the timestamp sequence and the total duration to confirm that the alternative advertisement is played completely within the target advertisement period: it checks that the interval between adjacent timestamps is within a preset reasonable range, and that the error between the total duration and the actual playback duration does not exceed a preset threshold.
[0087] Smart contract buffer compliance verification. The smart contract verifies whether each deviation value in the occupancy deviation sequence of the coded buffer is within the preset safety margin range. If there are deviation values that exceed the range, the extent of each deviation value is recorded.
[0088] Revenue Distribution. Revenue distribution is triggered only when both playback verification and buffer compliance verification pass. If playback verification passes but buffer compliance is only partially compliant, the revenue distribution amount is reduced proportionally based on the excess amount: Total deduction = Sum of all excess amounts divided by the safety margin, multiplied by the deduction ratio, and then multiplied by the total revenue amount. Actual distribution amount = Total revenue amount - Total deduction amount.
[0089] Key data related to ad replacement events is stored as blockchain transactions, leveraging the immutability of blockchain to provide verifiable playback proof. The smart contract's playback verification function automatically confirms whether the replacement ad was played completely without manual review, reducing review costs. Buffer compliance verification incorporates encoding quality into revenue distribution constraints, incentivizing terminal device providers to improve the encoding quality of ad replacements. A mechanism that proportionally deducts revenue for exceeding acceptable limits directly links encoding quality deviations to economic benefits, providing an automated quality constraint mechanism.
[0090] A smart TV program control terminal, comprising: The signal access module is used to receive real-time broadcast streams of broadcast television programs; A multi-dimensional feature fusion engine is used to dynamically predict advertising periods based on a two-layer Kalman filter. The first-layer Kalman filter outputs a macroscopic prediction time window and a macroscopic confidence interval as a state vector with the advertising period offset and the rate of change of the offset. The second-layer Kalman filter searches for the optimal switching point within the macroscopic confidence interval using the coding buffer occupancy rate and the rate of change of coding complexity between image groups as a state vector. It also receives feedback signals from the timing verification module to update the internal Kalman filter model. The preprocessing pipeline module is used to pre-transcode the alternative advertisement to the same encoding parameters as the real-time broadcast stream. It adjusts the encoding parameters of the starting image group of the alternative advertisement based on the predicted value of the encoding buffer occupancy rate at the optimal switching point, so that the difference between the initial encoding buffer occupancy rate of the alternative advertisement at the switching point and the encoding buffer occupancy rate of the real-time broadcast stream at the switching point does not exceed a preset safety margin. The advertising overlay module is used to perform overlay on the intra-coded frame at the optimal switching point to replace the advertising period content. The encoding parameters of the overlay start frame are adjusted according to the predicted value of the encoding buffer occupancy rate so that the bit rate jump amplitude at the moment of overlay is lower than the preset threshold. The timing verification module is used to continuously monitor the time deviation and encoding buffer occupancy deviation of the real-time broadcast stream after coverage, and feed the deviation back to the multi-dimensional feature fusion engine and the advertising coverage module in real time. The output module is used to output the overlaid real-time broadcast stream to the display device.
[0091] In practice, the intelligent control terminal for television programs connects to the broadcast signal source via a coaxial cable or Ethernet interface and to the television set via a high-definition multimedia interface cable. After power is turned on, the main processor starts the operating system and loads the drivers and software programs for each module in sequence.
[0092] Signal Access: The signal access module receives real-time broadcast streams of broadcast television programs through a coaxial cable tuner or Internet Protocol (IP) network receiver, and outputs the transmission stream data packets to the multi-dimensional feature fusion engine and advertising coverage module.
[0093] Advertising Segment Prediction and Switching Point Search: The multi-dimensional feature fusion engine dynamically predicts advertising segments based on a two-layer Kalman filter. The first-layer Kalman filter uses the advertising segment offset and its rate of change as state vectors, outputting a macroscopic prediction time window and a macroscopic confidence interval. The second-layer Kalman filter uses the encoding buffer occupancy rate and the rate of change of inter-group encoding complexity as state vectors, searching for the optimal switching point within the macroscopic confidence interval. This multi-dimensional feature fusion engine also receives feedback signals from the time-series verification module to update the internal Kalman filter model.
[0094] Pre-transcoding and parameter adjustment: The preprocessing pipeline module retrieves alternative ads from the ad creative library and pre-transcodes them with encoding parameters consistent with the live broadcast stream. Based on the predicted value of the encoding buffer occupancy rate at the optimal switching point output by the multi-dimensional feature fusion engine, the encoding parameters of the initial image group of the alternative ad are adjusted so that the difference between the initial encoding buffer occupancy rate of the alternative ad at the switching point and the encoding buffer occupancy rate of the live broadcast stream at the switching point does not exceed a preset safety margin. After adjustment, the encoded data of the alternative ad is transmitted to the ad coverage module.
[0095] Coverage Execution: The ad coverage module performs a coverage operation on the intra-coded frame at the optimal switching point determined by the multi-dimensional feature fusion engine, replacing the original ad segment content with an alternative ad. The encoding parameters of the coverage start frame are adjusted based on the predicted encoding buffer occupancy rate, ensuring that the bitrate jump at the moment of coverage is lower than a preset threshold.
[0096] Continuous monitoring and feedback: The timing verification module continuously monitors the real-time broadcast stream output by the advertising coverage module, calculates the time deviation and the coding buffer occupancy deviation, and feeds the deviation back to the multi-dimensional feature fusion engine (used to correct macro and micro predictions) and the advertising coverage module (used to dynamically adjust the coding parameter adjustment amount of subsequent coverage).
[0097] Output: The output module outputs the overlaid real-time broadcast stream to the display device through a high-definition multimedia interface.
[0098] The signal access module supports both coaxial cable and Internet Protocol (IP) network access methods, and is compatible with both cable TV and IPTV broadcast transmission methods, improving terminal deployment flexibility. The multi-dimensional feature fusion engine is deployed as a software module on the main processor, facilitating software updates to upgrade Kalman filter model parameters and feature extraction algorithms. The advertising coverage module runs as a high-priority real-time process, ensuring that the timing accuracy of coverage operations meets frame-level real-time requirements. The timing verification module runs as an independent monitoring thread; its monitoring and feedback processes do not block the normal operation of the advertising coverage module, enabling parallel execution of monitoring and coverage functions.
[0099] A television receiver comprising a smart control terminal for television programs.
[0100] In practical implementation, the intelligent control terminal for television programs is integrated into the television receiver, making the advertisement replacement function a built-in capability of the receiver, eliminating the need for users to purchase separate advertisement replacement equipment. The television receiver directly outputs the broadcast stream after coverage through the display panel interface, resulting in a short signal transmission path and reducing the number of external connection cables. The remote control receiving unit works in conjunction with the user interface submodule, allowing users to easily select and change alternative advertisements using the remote control.
[0101] A smart control system for television programs includes: At least one smart control terminal for television programs; The vendor server includes an advertising material library, a model parameter library, and a model update module. The model update module is used to update the parameters of the two-layer Kalman filter model based on the switching timestamps and encoding buffer occupancy deviation data reported by multiple terminals, and then distribute the updated model parameters to each terminal. A blockchain consensus network is used to store proof of playback and buffer compliance for advertising replacement events and to execute smart contract-driven multi-party revenue distribution.
[0102] In practice, manufacturers deploy their own servers in data centers to initialize the advertising material library, model parameter library, and model update module. They also deploy a blockchain consensus network and smart contracts on the blockchain to set revenue distribution schemes, playback verification rules, and buffer compliance verification rules. Users install smart TV control terminals; upon initial startup, the terminals connect to the manufacturer's server via the internet to download initialized model parameters, alternative advertising materials, and smart contract interface configuration information.
[0103] Each TV program's smart control terminal independently executes the advertisement replacement operation. After each operation, it reports the switching timestamp data and encoding buffer occupancy deviation data to the manufacturer's server. Simultaneously, it packages the key data of the advertisement replacement event into a blockchain transaction and submits it to the blockchain consensus network for notarization. The model update module in the manufacturer's server periodically collects the data reported by each terminal, executes model parameter update operations, and distributes the updated model parameters to each terminal. After the notarized transaction is confirmed, the smart contract in the blockchain consensus network automatically executes playback verification and buffer compliance verification, and distributes multi-party revenue based on the verification results.
[0104] As the central node of the system, the vendor server centrally manages advertising creatives and model parameters, enabling centralized updates of advertising creatives and optimization of model parameters before distribution to various terminals for execution, thus reducing system maintenance complexity. By collecting data reported from multiple terminals, the vendor server obtains richer statistical information than a single terminal, resulting in better generalization capabilities for model parameters optimized based on globally available data. The blockchain consensus network provides a decentralized notarization and verification mechanism for advertising replacement events, eliminating reliance on a single trusted third party and reducing the system's dependence on centralized institutions.
[0105] Furthermore, the model update module collects the time correction sequence and encoding buffer occupancy deviation sequence reported by each terminal, statistically analyzes the macro-prediction deviation distribution and micro-prediction deviation distribution of each terminal, and updates the process noise covariance matrix and observation noise covariance matrix of the first-layer Kalman filter and the second-layer Kalman filter respectively, and sends the updated model parameters to each terminal, so that each terminal can obtain the model prior parameters based on global data optimization while maintaining local two-layer adaptive correction.
[0106] In practice, the data collection submodule sends data reporting requests to each TV program intelligent control terminal at a preset collection cycle, and receives the time correction sequence and encoding buffer occupancy deviation sequence reported by each terminal. The time correction sequence records the time deviation value fed back from the timing verification module to the first-layer Kalman filter in each advertisement replacement operation, and the encoding buffer occupancy deviation sequence records the encoding buffer occupancy deviation value fed back from the timing verification module to the second-layer Kalman filter in each advertisement replacement operation.
[0107] The macro-prediction deviation distribution analysis unit in the statistical analysis submodule merges the time correction data of all terminals into a global sample set and calculates the mean and variance of the macro-prediction deviation. The micro-prediction deviation distribution analysis unit performs a similar operation on the coding buffer occupancy deviation sequence reported by each terminal and calculates the mean and variance of the micro-prediction deviation.
[0108] The noise covariance matrix update submodule updates the noise covariance matrix of the Kalman filter based on the statistical analysis results. For the process noise covariance matrix of the first-layer Kalman filter... ,
[0109] According to the formula , The specific meanings are as follows: The diagonal element of the i-th state component in the current (before update) process noise covariance matrix represents the current estimate of the process noise variance of the i-th state component (such as advertising period offset or offset change rate) by the filter.
[0110] The variance of the macroscopic prediction bias of the i-th state component is obtained from the time correction sequence reported by multiple terminals, reflecting the degree of fluctuation of the actual prediction error.
[0111] η (value is 0.3): Update step size factor, used to control the magnitude of each update and avoid filter instability caused by parameter mutations.
[0112] This factor is the η-th power of the ratio of the actual deviation variance to the current noise estimate. When the actual deviation variance is greater than the current estimate, the ratio > 1, and this factor > 1, making... Increase; conversely make Decrease. The exponent η compresses the ratio (for example, when the ratio is 2, 2^0.3 ≈ 1.23, instead of directly doubling), thus playing a smoothing role.
[0113] Physical meaning: This formula allows the process noise covariance of the Kalman filter to gradually approximate the prediction bias variance obtained from actual statistics, thus enabling the filter's prediction to more accurately reflect the true level of uncertainty. η ensures smooth convergence of parameter updates, avoiding filter divergence caused by single statistical fluctuations.
[0114] Update, where η is the update step size factor (with a value of 0.3). Let be the variance of the macroscopic prediction bias corresponding to the i-th state component. Similarly, update the observation noise covariance matrix of the first-layer Kalman filter, as well as the process noise covariance matrix and observation noise covariance matrix of the second-layer Kalman filter, based on the variance of the microscopic prediction bias.
[0115] The parameter distribution submodule encrypts and distributes the updated model parameters to each TV program intelligent control terminal via a hypertext transfer security protocol. Upon receiving the parameters, each terminal replaces the corresponding parameters of the first and second layer Kalman filters in its local multi-dimensional feature fusion engine with the new noise covariance matrix. This replacement operation does not affect the current state estimate or error covariance matrix; it only updates the noise covariance matrix. While maintaining its local two-layer adaptive correction capability, each terminal obtains model prior parameters optimized based on global data.
[0116] The model update module collects data reported by multiple terminals, obtaining richer statistical samples than a single terminal, enabling more accurate estimation of the distribution characteristics of macroscopic and microscopic prediction biases. Based on the global statistical distribution, it updates the noise covariance matrix, making the Kalman filter's noise model closer to actual noise characteristics and improving state estimation accuracy. The updated step size factor controls the parameter update amplitude, preventing filter instability caused by sudden parameter changes. Each terminal obtains globally optimized prior parameters while maintaining local adaptive correction, achieving collaborative work between local real-time correction and global offline optimization. Model parameters are distributed via an encrypted hypertext transfer security protocol, ensuring data integrity and confidentiality during transmission.
Claims
1. A method for intelligent control of television programs, applied to real-time broadcast television programs, characterized in that, include: The system receives real-time broadcast streams and predicts advertising periods based on a two-layer Kalman filter: the first-layer Kalman filter uses the advertising period offset and the rate of change of offset as state vectors to output the macroscopic prediction time window and macroscopic confidence interval of the advertising period; the second-layer Kalman filter uses the coding buffer occupancy rate and the rate of change of coding complexity between image groups as state vectors to search for the optimal switching point at the boundary of the image group within the macroscopic confidence interval. When the predicted advertising period is about to arrive, an alternative advertisement is obtained and, during the pre-transcoding process, the encoding parameters of the starting image group of the alternative advertisement are adjusted according to the predicted value of the encoding buffer occupancy rate at the optimal switching point, so that the difference between the initial encoding buffer occupancy rate of the alternative advertisement at the switching point and the encoding buffer occupancy rate of the real-time broadcast stream at the switching point does not exceed a preset safety margin. Overlay is performed on the intra-coded frame at the optimal switching point to replace the advertising period content. The encoding parameters of the overlay start frame are adjusted according to the predicted value of the encoding buffer occupancy rate so that the bit rate jump amplitude at the moment of overlay is lower than a preset threshold. The system continuously monitors the time deviation and coding buffer occupancy deviation after coverage, feeds the time deviation back to the first layer Kalman filter to correct macroscopic predictions, and feeds the coding buffer occupancy deviation back to the second layer Kalman filter to correct microscopic predictions.
2. The method according to claim 1, characterized in that, In the dual-layer Kalman filter, the first layer Kalman filter recursively updates the state estimate using historical observations from the past N broadcast cycles and outputs a macroscopic error covariance matrix. The macroscopic confidence interval is determined by the macroscopic error covariance matrix. The second-layer Kalman filter recursively updates the state estimate within the macroscopic confidence interval using real-time data from the coding layer of the real-time broadcast stream, and outputs the microscopic error covariance matrix. The preprocessing pipeline module dynamically adjusts the lead time of the preload based on the norm of the macroscopic error covariance matrix; the greater the prediction uncertainty, the greater the lead time. The multi-dimensional feature fusion engine receives at least three types of feature inputs and performs fusion judgment: audio energy envelope features, video scene switching features, electronic program guide timestamp features, and historical advertising time slot offset features; when the width of the macro confidence interval exceeds the preset abnormal threshold, it is determined to be an arrangement abnormality and advertising replacement is not performed.
3. The method according to claim 1, characterized in that, The search strategy for the optimal switching point includes: parsing the network abstraction layer unit type of the real-time broadcast stream coding, identifying the position of the intra-frame coded frame and calculating the length of the image group; Among all the intra-coded frames of the image group boundary selected within the macro confidence interval, the image group boundary with the closest predicted coding buffer occupancy rate to the preset safe median and the lowest coding complexity is selected as the optimal switching point. If there is no image group boundary that meets the safety margin condition within the macro confidence interval, then the buffer constraint is relaxed to the suboptimal range and the image is re-selected. If no image group boundary meets the conditions, wait for the next macroscopic confidence interval; The amount of encoding parameter adjustment in subsequent overlay operations is dynamically adjusted based on the monitored time deviation and / or encoding buffer occupancy deviation. If the original duration of the alternative advertisement is inconsistent with the predicted duration of the advertisement period, and the speed change factor is within the preset allowable range, then speed change processing is performed synchronously during the pre-transcoding stage so that the playback duration after speed change is equal to the predicted duration of the advertisement period.
4. The method according to claim 1, characterized in that, Crossfade-in and crossfade-out processing is performed on the audio signals at the start and end of coverage. The duration of the crossfade-in and crossfade-out is adaptively determined based on the perceived spectral distance between the audio at the start of the alternative advertisement and the audio at the end of the original live broadcast stream. The perceived spectral distance is calculated using a frequency domain weighting method based on a psychoacoustic model: short-time Fourier transforms are performed on the two audio signals to obtain their spectra, and perceptual weights are applied to each frequency band according to equal loudness curves and simultaneous masking effects to calculate the weighted spectral distance. The larger the perceived spectral distance, the longer the crossfade-in and crossfade-out duration, ranging from 50 milliseconds to 300 milliseconds. When the perceived spectral distance exceeds a preset perceptual distortion threshold, spectral bridging processing is performed before crossfade-in and crossfade-out: audio segments of 20 to 50 milliseconds are taken on both sides of the coverage boundary, and the spectral envelope of the audio at the start of the alternative advertisement is gradually interpolated using a phase vocoder to transition it to the spectral envelope of the audio at the end of the original live broadcast stream before crossfade-in and crossfade-out is performed. At the same time, the speed factor is limited to the range of 0.95 to 1.
05.
5. The method according to claim 1, characterized in that, The selection of alternative advertisements is based on a local user preference model on the terminal: a user preference vector for alternative advertisement categories is maintained locally, and the preference vector is updated locally on the terminal based on the user's historical viewing and selection behavior, without uploading the original behavior data; Calculate the matching score between the candidate alternative ads and the preference vector, and select the alternative ad with the highest score for preloading and pre-transcoding; During non-advertising periods, users are prompted with alternative advertisements via a non-blocking interface. If the user does not interact within a preset time, the advertisement will play automatically. If the user issues a change command, an alternative list will be displayed. The matching score is transmitted to a multi-dimensional feature fusion engine and used as a weighting factor to adjust the weights of each historical observation in the first-layer Kalman filter. When the matching score is lower than a preset relevance threshold, the fusion weight of the electronic program guide timestamp feature is reduced, and the fusion weights of the audio energy envelope feature and video scene switching feature are increased accordingly.
6. The method according to claim 1, characterized in that, Also includes: The key data of the ad replacement event is packaged into a blockchain transaction and submitted to the consensus network for notarization. The key data includes at least: a unique time period identifier, an alternative ad identifier, an image group boundary switching timestamp sequence, an encoding buffer occupancy deviation sequence, and the actual playback duration. The smart contract on the blockchain verifies the continuity and total duration of the timestamp sequence to confirm that the alternative advertisement is played completely within the target advertisement period. The smart contract also verifies whether each deviation value in the encoding buffer occupancy deviation sequence is within the preset safety margin range. If there is a deviation value that exceeds the range, the revenue distribution amount is deducted proportionally according to the excess. The multi-party revenue distribution is triggered only when both the playback verification and the buffer compliance verification pass.
7. A smart control terminal for television programs, characterized in that, The intelligent control method for television programs according to any one of claims 1 to 7 includes: The signal access module is used to receive real-time broadcast streams of broadcast television programs; A multi-dimensional feature fusion engine is used to dynamically predict advertising periods based on a two-layer Kalman filter. The first-layer Kalman filter outputs a macroscopic prediction time window and a macroscopic confidence interval as a state vector with the advertising period offset and the rate of change of the offset. The second-layer Kalman filter searches for the optimal switching point within the macroscopic confidence interval using the coding buffer occupancy rate and the rate of change of coding complexity between image groups as a state vector. It also receives feedback signals from the timing verification module to update the internal Kalman filter model. The preprocessing pipeline module is used to pre-transcode the alternative advertisement to the same encoding parameters as the real-time broadcast stream. Based on the predicted value of the encoding buffer occupancy rate at the optimal switching point, the encoding parameters of the starting image group of the alternative advertisement are adjusted so that the difference between the initial encoding buffer occupancy rate of the alternative advertisement at the switching point and the encoding buffer occupancy rate of the real-time broadcast stream at the switching point does not exceed a preset safety margin. The advertising overlay module is used to perform overlay on the intra-coded frame at the optimal switching point to replace the advertising period content. The encoding parameters of the overlay start frame are adjusted according to the predicted value of the encoding buffer occupancy rate so that the bit rate jump amplitude at the moment of overlay is lower than a preset threshold. The timing verification module is used to continuously monitor the time deviation and encoding buffer occupancy deviation of the real-time broadcast stream after coverage, and to feed the deviation back to the multi-dimensional feature fusion engine and the advertising coverage module in real time. The output module is used to output the overlaid real-time broadcast stream to the display device.
8. A television receiver, characterized in that: It includes the intelligent control terminal for television programs as described in claim 7.
9. A smart control system for television programs, characterized in that, include: At least one intelligent television program control terminal as described in claim 7; The vendor server includes an advertising material library, a model parameter library, and a model update module. The model update module is used to update the parameters of the two-layer Kalman filter model based on the switching timestamps and encoding buffer occupancy deviation data reported by multiple terminals, and to send the updated model parameters to each terminal. A blockchain consensus network is used to store proof of playback and buffer compliance for advertising replacement events and to execute smart contract-driven multi-party revenue distribution.
10. The system according to claim 9, characterized in that, The model update module collects the time correction sequence and encoding buffer occupancy deviation sequence reported by each terminal, statistically analyzes the macro-prediction deviation distribution and micro-prediction deviation distribution of each terminal, and updates the process noise covariance matrix and observation noise covariance matrix of the first-layer Kalman filter and the second-layer Kalman filter respectively. The updated model parameters are then sent to each terminal, so that each terminal can obtain the model prior parameters based on global data optimization while maintaining local two-layer adaptive correction.