Audio noise elimination method and system based on frame offset and sequential decoding

By using frame offset and sequential decoding, the problem of discontinuous audio frame output after random positioning of the audio decoder is solved, achieving smooth transition of audio data and high-quality playback, eliminating noise such as popping sounds, and improving the audio playback experience.

CN122053909APending Publication Date: 2026-05-15深圳牛学长科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
深圳牛学长科技有限公司
Filing Date
2026-01-12
Publication Date
2026-05-15

AI Technical Summary

Technical Problem

Existing technologies may produce audio frame outputs after random positioning of the audio decoder, which may contain incompletely initialized samples, discontinuous timestamps, or incomplete waveforms. This can lead to popping or clicking sounds during audio splicing, affecting the listening experience.

Method used

By using frame offset and sequential decoding, the starting decoding time point earlier than the target time point is calculated, and the audio stream is sequentially decoded from that point. Continuous target audio data segments are selected and spliced ​​to eliminate noise.

Benefits of technology

It effectively eliminates audio interruptions or anomalies after Seek operations, ensuring the continuity and accuracy of audio data, significantly reducing noise levels, and improving the listening experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122053909A_ABST
    Figure CN122053909A_ABST
Patent Text Reader

Abstract

The invention discloses an audio noise elimination method and system based on frame offset and sequential decoding, and the method comprises the steps: receiving a target time point for an audio stream, and calculating an initial decoding time point earlier than the target time point; sequentially decoding the audio stream from the decoding starting time point; in the sequential decoding process, the playing timestamps of the audio frames obtained through decoding are compared with a target time point, and screening is carried out according to a comparison result, so that continuous target audio data segments starting from the target time point are obtained; and outputting the target audio data segment, and performing connection processing on the target audio data segment and audio data before the target time point. In the embodiment of the invention, the target time point is shifted backwards for a preset time period during the Seek operation, and the audio data are sequentially read and decoded from the shifted position until the original target time point, so that invalid null data possibly appearing in the initial section after the Seek operation can be effectively eliminated, and therefore, the problem of noise such as plosive sound caused by the invalid null data can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of audio and video processing technology, specifically to an audio noise cancellation method and system based on frame offset and sequential decoding. Background Technology

[0002] In the field of audio and video processing, non-linear access to media streams is a fundamental requirement. Typical operations include seek operations during playback and file splitting and merging during editing. The seek operation allows the player to quickly locate and decode content at any point in the media stream for playback based on user instructions (such as dragging a progress bar) or program logic. To support this functionality, mature multimedia frameworks such as FFmpeg are typically used, whose interfaces, such as av_seek_frame(), can locate the corresponding data packet in the encapsulation file based on the input timestamp.

[0003] The conventional Seek operation process has an inherent problem affecting audio fidelity: because the audio decoder needs to initialize the decoding context and fill the internal buffer after random positioning, the initial audio frames decoded directly from the Seek positioning point may contain incompletely initialized samples, discontinuous timestamps, or transient artifacts with incomplete waveforms. If this data is directly spliced ​​with the normal audio frames before Seek, audible popping or clicking sounds will occur at the splicing point, severely affecting the listening experience. Existing technologies mostly adopt post-processing remedial strategies, such as applying digital filtering after detecting noise. Such methods not only introduce additional processing delays and computational overhead, but also struggle to completely eliminate artifacts embedded in the signal. Summary of the Invention

[0004] The purpose of this invention is to provide an audio noise cancellation method and system based on frame offset and sequential decoding, so as to solve the problems of transient defects in audio splicing mentioned in the background art.

[0005] To achieve the above objectives, the present invention adopts the following technical solution: According to one aspect of the present invention, an audio noise cancellation method based on frame offset and sequential decoding is provided, the method comprising: Receive a target time point for the audio stream and calculate a starting decoding time point earlier than the target time point; The audio stream is sequentially decoded starting from the initial decoding time point; During the sequential decoding process, the playback timestamp of the decoded audio frame is compared with the target time point, and the data is filtered according to the comparison result to obtain a continuous target audio data segment starting from the target time point; The target audio data segment is output and then interleaved with the audio data before the target time point.

[0006] Based on the aforementioned scheme, after receiving the target time point for the audio stream, the method further includes normalizing the target time point: converting the target time point into a representation compatible with the internal time base of the audio stream; determining whether the target time point is within the valid time range of the audio stream; if not, correcting the target time point to the nearest endpoint within the valid time range.

[0007] Based on the aforementioned scheme, the calculation of the starting decoding time point earlier than the target time point includes obtaining the single frame duration of the audio stream; and calculating the starting decoding time point based on the single frame duration and a predetermined offset frame number.

[0008] Based on the aforementioned scheme, the predetermined number of offset frames is greater than the number of consecutive frames of invalid data generated by the audio stream after the Seek operation.

[0009] Based on the aforementioned scheme, the sequential decoding of the audio stream starting from the initial decoding time point includes using a backward search mode to locate the audio stream to the initial decoding time point; starting from the initial decoding time point, reading and decoding the data packets sequentially according to the storage order of the data packets in the audio stream.

[0010] Based on the aforementioned scheme, the backward search mode is used to locate the nearest independently decodeable access point whose timestamp is not greater than the starting decoding time.

[0011] Based on the aforementioned scheme, the step of comparing the playback timestamp of the decoded audio frame with the target time point includes converting the original playback timestamp of the audio frame to the time unit used by the target time point based on the time base of the audio stream, to obtain a first conversion time value; Subtract the global start time offset of the media file from the first conversion time value to obtain the absolute start time of the current frame.

[0012] Based on the aforementioned scheme, the filtering based on the comparison results includes performing a frame-by-frame judgment during the sequential decoding process: if the absolute start time of the current frame is less than or equal to the comparison threshold, the frame is discarded and the next frame is decoded; if the absolute start time of the current frame is greater than the comparison threshold, the frame is retained as the starting frame of the audio data segment; the comparison threshold is equal to the target time point minus the duration of a single frame.

[0013] Based on the aforementioned scheme, the target audio data segment is connected with the audio data before the target time point. This includes performing a memory copy operation on the PCM data of the target audio data segment and the PCM data of the last frame of audio before the target time point in chronological order, forming a continuous PCM data block for playback or storage.

[0014] According to another aspect of the present invention, an audio noise cancellation system based on frame offset and sequential decoding is provided, the system comprising: a receiving and calculation module, a decoding module, a comparison and filtering module, and an output coupling module; The receiving and calculating module is used to receive a target time point for the audio stream and calculate a starting decoding time point earlier than the target time point; The decoding module is used to sequentially decode the audio stream starting from the initial decoding time point; The comparison and filtering module is used to compare the playback timestamp of the decoded audio frame with the target time point during the sequential decoding process, and to filter according to the comparison result to obtain a continuous target audio data segment starting from the target time point. The output connection module is used to output the target audio data segment and connect it with the audio data before the target time point.

[0015] As can be seen from the above technical solution, the present invention has at least the following advantages and positive effects compared with the prior art: By shifting the target time point backward by a predetermined time period during the Seek operation, and sequentially reading and decoding audio data from the shifted position until the original target time point, it can effectively eliminate invalid empty data that may appear in the initial segment after the Seek operation, thereby completely solving the problem of noise such as popping sounds caused by this; it can ensure that the sound data obtained after the Seek operation accurately corresponds to the target time point, improving the positioning accuracy; it ensures that the sound data obtained after the Seek operation is all valid data, avoiding audio interruption or abnormality caused by empty data segments; it effectively maintains the continuity of audio data before and after the Seek operation, achieving a smooth transition; it significantly eliminates noise such as popping sounds caused by direct splicing of audio frames before and after the Seek operation, improving the listening experience; and it significantly reduces the frequency of noise occurrence overall, resulting in a significant improvement in sound quality.

[0016] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit the invention. Attached Figure Description

[0017] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention. It is obvious that the drawings described below are merely some embodiments of the invention, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort. In the drawings: Figure 1 This is a schematic block diagram of the audio noise cancellation method based on frame offset and sequential decoding of the present invention; Figure 2 This is a flowchart of the audio noise cancellation method based on frame offset and sequential decoding of the present invention; Figure 3 This is a schematic diagram of sequential decoding based on the starting decoding time point of the present invention; Figure 4 This is a schematic diagram of the audio noise cancellation system based on frame offset and sequential decoding of the present invention. Detailed Implementation

[0018] To more clearly illustrate the purpose, technical solutions, and advantages of the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein. On the contrary, these embodiments are provided so that the present invention will be more comprehensive and complete, and fully convey the concept of the exemplary embodiments to those skilled in the art.

[0019] Furthermore, the described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. Numerous specific details are provided in the following description to give a full understanding of embodiments of the invention. However, those skilled in the art will recognize that the technical solutions of the invention can be practiced without one or more of the specific details, or other methods, components, apparatuses, steps, etc., can be employed. In other instances, well-known methods, apparatuses, implementations, or operations are not shown or described in detail to avoid obscuring various aspects of the invention.

[0020] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.

[0021] The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily need to be performed in the described order. For example, some operations / steps can be broken down, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.

[0022] The present invention will now be described in detail with reference to specific embodiments: Example 1

[0023] like Figure 1 , 2 As shown, this embodiment provides an audio noise cancellation method based on frame offset and sequential decoding. The specific steps of this method are as follows: S1: Receive the target time point for the audio stream and calculate the starting decoding time point earlier than the target time point.

[0024] This embodiment is implemented using the FFmpeg multimedia processing framework. The use of other frameworks or libraries with similar functionality is also within the scope of this invention. Before starting the noise cancellation process, the target media file is initialized to obtain necessary audio stream parameters, including: sampling rate and frame size. The sampling rate (sample_rate) represents the number of audio samples per second, measured in Hertz (Hz); the frame size (frame_size) represents the number of original PCM samples contained in each compressed audio frame; for most encoding formats, this value is fixed.

[0025] The system receives Seek requests from the application programming interface (API). A Seek operation is the process of quickly moving the playback or processing position of a media file from the current time point to another specified time point, i.e., a jump positioning operation in audio playback. A Seek operation is triggered when the user drags the progress bar or executes a clipping command. The performance and accuracy of the Seek operation directly affect the user experience. The Seek request carries the target time point parameter t_target. t_target is normalized by converting it into a representation compatible with the internal time base of the audio stream, such as converting it to an absolute timestamp based on audio sample points or to units like milliseconds, and the conversion relationship is recorded to ensure the accuracy of subsequent calculations. The system determines whether the target time point is within the valid time range of the audio stream. If not, the target time point is corrected to the nearest endpoint within the valid time range. For example, it determines whether t_target is within the valid time range [0, T_total] of the audio stream, where T_total is the total duration of the audio stream. If t_target < 0, it is corrected to 0; if t_target > T_total, it is corrected to T_total.

[0026] Based on the normalized t_target, a certain amount of time is actively shifted backward; the starting decoding time point t_start, which is earlier than this time point, is calculated. Specifically, based on the acquired audio stream parameters, the duration of a single audio frame is calculated: frame_duration = frame_size / sample_rate, where frame_size is the frame size, representing the number of original PCM sample points contained in each audio compressed frame; sample_rate is the sampling rate, representing the number of audio sample points per second.

[0027] A predetermined offset frame number N is defined, its value determined based on in-depth analysis of the decoding behavior of various mainstream audio encoding formats (such as AAC, MP3, WMA, etc.). The predetermined offset frame number N is greater than the number of consecutive frames of invalid data generated by the audio stream after the Seek operation. Analysis shows that after the Seek operation, before the decoder outputs a stable and valid waveform, there is usually a brief transient process. The length of invalid or incomplete data generated during this process is usually no more than 3 audio frames. To ensure complete coverage of this transient process and to leave a safety margin, N = 6 can be preferably set. The formula for calculating the starting decoding time point is: t_start=t_target-N*frame_duration=t_target-6*frame_duration If the result of t_start is less than 0, then t_start is forced to be set to 0; this process ensures the validity of the calculation result, and when the target point t_target is very close to the start of the stream, decoding will automatically start from the start of the stream.

[0028] By employing an offset of N=6, the offset (6 frames in length) is significantly greater than the typical invalid data length (≤3 frames), ensuring that decoding from t_start has sufficient data length to allow the decoder to fully reach a stable state before reaching t_target. This fundamentally avoids the possibility of transient, flawed data being output. This embodiment uses dynamic calculation based on frame duration to make the offset adapt to the actual encoding parameters of the audio stream. For high sampling rates and short frame length formats, the absolute time of the offset is shorter, avoiding unnecessary data loss and decoding overhead. This optimizes the response speed and processing efficiency of the Seek operation while ensuring noise-free operation.

[0029] By calculating t_start, the decoding process from t_start to t_target can provide the audio decoder with enough data to get through its initial transient instability phase. This ensures that the decoder has entered a stable working state of outputting a continuous and correct waveform before reaching the target time point t_target. This is the key to preventing audio data breakage and noise generation from the source.

[0030] S2: Sequentially decode the audio stream starting from the initial decoding time point.

[0031] like Figure 3 As shown, the underlying multimedia processing framework (such as FFmpeg) calls the Seek interface to locate the audio stream reading position to the starting decoding time point t_start calculated in step S1. This location operation uses a backward Seek mode (e.g., using the AVSEEK_FLAG_BACKWARD flag). The function of this mode is to find and locate the nearest independently decodeable access point on the media timeline whose timestamp is not greater than the starting decoding time point t_start. For audio streams, the basic coding unit (frame) is an independently decodeable keyframe; therefore, this access point is the starting boundary of an audio frame. Using this mode ensures that the data packets read sequentially from this location point have continuously increasing timestamps and contain all audio information from t_start onwards. This operation is a prerequisite for subsequent sequential decoding and generation of continuous waveform data, avoiding data loss between t_start and a point after t_start due to location, thus ensuring the integrity of the acquired data stream.

[0032] After localization, a sequential decoding loop is entered to simulate the data feed process of natural playback, thereby generating a continuous, high-quality audio waveform. To ensure that the decoding process is not interfered with by other tasks or historical states, an independent audio decoder context is created and initialized for the sequential decoding loop processing flow. This context encapsulates all the necessary information and states of the selected audio codec, and its lifecycle is bound to the current Seek processing, independent of other playback threads or decoding tasks, to ensure that its internal state is not disturbed and does not depend on or affect the global playback state. The sequential decoding process includes: starting from the localization point, reading each audio packet sequentially according to the physical storage order of the audio packets in the media stream. This process simulates the linear data feed method during normal playback, rather than random access; sending each read packet to the independent audio decoder context; the decoder executes the decoding algorithm on each input packet and outputs the corresponding Pulse Code Modulation (PCM) audio frame. This frame contains continuous, uncompressed audio sample point data (waveform data) and the accurate start playback timestamp (PTS) information of the frame.

[0033] Since the positioning point t_start is a calculated safe starting point earlier than the target point, the initial few frames decoded starting from t_start correspond to the process of the decoder transitioning from its initial state after positioning (or the residual state of the previous decoding task) to a stable and reliable operating state. This transition may involve the complete initialization of the decoder's internal context, filling of the reference buffer, or clock synchronization. During this period, the audio frames output by the decoder may contain transient artifacts, such as initial silence padding, partial decoded data, or discontinuous timestamps. These non-ideal data generated during the transition period will be identified and discarded in subsequent steps. Once the decoder has passed through this brief initial phase, it will enter a stable operating state, continuously outputting PCM data with continuous timestamps and correct waveform quality. By maintaining an uninterrupted sequential decoding loop starting from t_start, a decoded audio data stream with continuous timestamps and waveforms is dynamically generated, starting from t_start.

[0034] S3: During the sequential decoding process, the playback timestamp of the decoded audio frame is compared with the target time point, and the comparison result is used for filtering to obtain a continuous target audio data segment starting from the target time point.

[0035] In the sequential decoding loop of step S2, whenever the decoder outputs a frame of PCM audio data (denoted as frame_current), its accompanying original playback timestamp (Presentation Timestamp, PTS) is extracted; this timestamp is represented in the audio stream time base (streamq). This original playback timestamp is converted to a unified time base for accurate comparison with the target time point t_target. Through time base conversion, the original playback timestamp value of the current frame is converted to the same target time unit as t_target; that is, the original timestamp framePts of the audio frame is converted from the audio stream's own time base streamq to the target time base resq; the conversion formula is: t_converted=framePts*(streamq.num / streamq.den)*(resq.den / resq.num).

[0036] Where framePts is the original timestamp of the decoded audio frame; streamq is the audio stream time base, containing the numerator num and the denominator den, defining the physical time unit of the framePts value. For example, if streamq = {1, 48000}, then each unit of framePts corresponds to 1 / 48000 of a second; resq is the target time base, defining the required precision and unit for the converted time value t_converted (e.g., milliseconds correspond to {1, 1000}). This conversion ensures that both sides of the comparison are on the same scale. Subtracting the global start time offset fileStartTime of the media file from the converted time value yields the absolute start time t_current of the current frame relative to the start of the media file and based on the same base as t_target, i.e., t_current = t_converted - fileStartTime.

[0037] This embodiment employs a dynamic threshold comparison method based on frame duration, setting the comparison threshold as T_threshold = t_target - frame_duration, where frame_duration is the single frame duration calculated in step S1. During sequential decoding, a judgment is performed frame by frame: if the absolute start time of the current frame is less than or equal to the comparison threshold, the frame is discarded and the next frame is decoded; if the absolute start time of the current frame is greater than the comparison threshold, the frame is retained as the starting frame of a continuous audio data segment.

[0038] Specifically, if the start time t_current of an audio frame satisfies t_current>T_threshold, then it can be deduced that t_current+frame_duration>t_target; this means that the end time of the playback time interval [t_current,t_current+frame_duration] of this frame is later than the target time t_target. Therefore, the first frame that satisfies this condition, which is the earliest frame whose playback interval covers or spans the time t_target, is determined as the target start frame.

[0039] If t_current ≤ T_threshold, the current frame is determined to be before the target audio segment and belongs to the offset segment data that should be discarded. The PCM data buffer and related metadata memory occupied by this frame are released, and the decoding loop of step S2 is returned to continue decoding the next frame. If t_current > T_threshold, the current frame is determined to be the target starting frame. All data of this frame is retained, the sequential decoding loop of step S2 is terminated, and this frame is output as the target starting frame. Audio frames located between the starting decoding time point t_start and the target starting frame frame_target are collectively referred to as offset segment data. Preferably, a boundary check can be added to the decoding loop. For example, if a frame satisfying t_current > T_threshold is not found after decoding to the end of the audio stream, the last valid decoded frame can be output as the target starting frame to ensure the process is complete.

[0040] S4: Output the target audio data segment and perform concatenation processing with the audio data before the target time point.

[0041] The target starting frame output in step S3 is denoted as frame_target. Since step S3 terminates the decoding loop after finding the target frame, a new sequential decoding sub-process needs to be resumed or started, beginning with the next data packet corresponding to frame_target. This sub-process will continue decoding to obtain all subsequent audio frames after frame_target until the predetermined output requirements are met (such as reaching the size of an audio buffer block, or the user stopping playback). Based on the same sequential decoding logic, starting from the next position of the data packet corresponding to frame_target, audio data continues to be read and decoded to obtain all subsequent audio frames after frame_target until the output requirements are met (such as the buffer being full or playback stopping). The PCM data of frame_target and its subsequent frames are sequentially organized into continuous logical data segments, i.e., the target audio data segments.

[0042] The last frame of audio data before the target time point is retrieved from the audio playback buffer and denoted as `frame_previous`. The PCM sample data of `frame_previous` and the PCM sample data of the target audio data segment are then copied sequentially in memory, forming a longer continuous PCM data block. Since the target data segment begins with the output after the decoder has fully stabilized, its initial waveform does not contain high-energy pulses or abrupt changes caused by decoder transients. Therefore, although there is normal sample value concatenation at the junction with the waveform of `frame_previous`, this junction will not contain abnormal signal components that would cause audible clicks / pops. It should be noted that other audio concatenation or smoothing methods with similar functions can be used to achieve continuous playback of two audio data segments, depending on actual needs.

[0043] The processed complete PCM audio data block is output to the audio rendering pipeline for real-time playback, or packaged into a standard audio file and written to storage. Example 2

[0044] like Figure 4 As shown, this embodiment exemplifies an audio noise cancellation system based on frame offset and sequential decoding, including a receiving and calculation module, a decoding module, a comparison and filtering module, and an output connection module.

[0045] The receiving and calculation module receives the target time point of the audio stream and calculates the starting decoding time point earlier than the target time point. It receives Seek requests from external input (such as user interaction or program commands) and extracts the target time point t_target. Internally, the module contains time processing logic to normalize t_target. Based on the acquired audio stream parameters, it calculates the single-frame duration frame_duration and uses this to calculate a starting decoding time point t_start earlier than t_target. The calculation follows a preset strategy, such as t_start = t_target - N * frame_duration (where N is a predetermined value greater than the number of invalid data frames), and handles time out-of-bounds cases.

[0046] The decoding module is used to sequentially decode the audio stream starting from the initial decoding time point. Based on t_start provided by the receiving and computing module, it executes a controlled audio decoding process; it calls the underlying multimedia processing interface to locate the audio stream to t_start using a backward search mode; after location, the module establishes an independent decoding context and starts a sequential decoding loop; this loop strictly follows the physical storage order of the data packets to read compressed audio data, sends it to the decoder for real-time decoding, and outputs audio frames containing PCM data and precise timestamps.

[0047] The comparison and filtering module is used during sequential decoding to compare the playback timestamps of the decoded audio frames with the target time point and filter them based on the comparison results to obtain continuous target audio data segments starting from the target time point. It runs synchronously within the sequential decoding loop of the decoding module, responsible for real-time evaluation and filtering of each frame output. For each frame output by the decoding module, this module performs the following operations: extracts the frame's original timestamp (PTS) and converts it to an absolute start time t_current with the same unit and reference as t_target; calculates the dynamic threshold T_threshold = t_target - frame_duration based on the single frame duration; compares t_current with T_threshold: if t_current ≤ T_threshold, the frame is determined to be a discarded offset segment, the system is instructed to release the frame resource, and the decoding module is notified to continue decoding the next frame; if t_current > T_threshold, the frame is immediately determined to be the target starting frame, the decoding module is instructed to terminate the current decoding loop, and the frame and its subsequent data (obtained through recovery decoding) are marked as target audio data segments.

[0048] The output concatenation module is used to output the target audio data segment and concatenate it with the audio data before the target time point. It seamlessly integrates the selected high-quality audio data with historical audio and generates the final output. It acquires the last frame of PCM data (frame_previous) output before t_target from the system cache or rendering queue, and compares it with the target audio data segment output by the comparison and filtering module. The sampling points of these two parts of PCM data are copied sequentially to the same contiguous memory buffer or directly passed to the audio rendering engine, thus physically forming a longer, continuous, noise-free audio data block. This data block can be directly sent to an audio device for playback or packaged and written to a file.

[0049] The above modules work sequentially or in parallel. The receiving and computing module sets the starting point for the decoding module; while generating the data stream, the decoding module provides real-time frames to the comparison and filtering module; the control commands (continue / stop) of the comparison and filtering module control the loop of the decoding module in turn; finally, the output connection module integrates the results of the comparison and filtering module with historical data to complete the entire processing flow and achieve an end-to-end noise-free Seek operation experience.

[0050] Other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of the invention are indicated by the claims. It should be understood that the invention is not limited to the precise structures described above and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.

Claims

1. An audio noise cancellation method based on frame offset and sequential decoding, characterized in that, The method includes: Receive a target time point for the audio stream and calculate a starting decoding time point earlier than the target time point; The audio stream is sequentially decoded starting from the initial decoding time point; During the sequential decoding process, the playback timestamp of the decoded audio frame is compared with the target time point, and the data is filtered according to the comparison result to obtain a continuous target audio data segment starting from the target time point; The target audio data segment is output and then interleaved with the audio data before the target time point.

2. The audio noise cancellation method based on frame offset and sequential decoding according to claim 1, characterized in that, After receiving the target time point for the audio stream, the method further includes normalizing the target time point: converting the target time point into a representation format compatible with the internal time base of the audio stream. Determine whether the target time point is within the valid time range of the audio stream; If not, the target time point is corrected to the nearest endpoint within the effective time range.

3. The audio noise cancellation method based on frame offset and sequential decoding according to claim 1, characterized in that, The calculation of the starting decoding time point earlier than the target time point includes obtaining the single frame duration of the audio stream; and calculating the starting decoding time point based on the single frame duration and a predetermined offset frame number.

4. The audio noise cancellation method based on frame offset and sequential decoding according to claim 3, characterized in that, The predetermined offset frame number is greater than the number of consecutive frames of invalid data generated by the audio stream after the Seek operation.

5. The audio noise cancellation method based on frame offset and sequential decoding according to claim 1, characterized in that, The sequential decoding of the audio stream starting from the initial decoding time point includes using a backward search mode to locate the audio stream to the initial decoding time point; starting from the initial decoding time point, reading and decoding the data packets sequentially according to the storage order of the data packets in the audio stream.

6. The audio noise cancellation method based on frame offset and sequential decoding according to claim 5, characterized in that, The backward search mode is used to locate the nearest independently decodeable access point whose timestamp is not greater than the starting decoding time.

7. The audio noise cancellation method based on frame offset and sequential decoding according to claim 1, characterized in that, The step of comparing the playback timestamp of the decoded audio frame with the target time point includes converting the original playback timestamp of the audio frame to the time unit used by the target time point based on the time base of the audio stream to obtain a first conversion time value; Subtract the global start time offset of the media file from the first conversion time value to obtain the absolute start time of the current frame.

8. The audio noise cancellation method based on frame offset and sequential decoding according to claim 7, characterized in that, The filtering based on the comparison results includes performing a frame-by-frame judgment during the sequential decoding process: if the absolute start time of the current frame is less than or equal to the comparison threshold, the frame is discarded and the next frame is decoded; if the absolute start time of the current frame is greater than the comparison threshold, the frame is retained as the starting frame of the audio data segment; the comparison threshold is set to be equal to the target time point minus the duration of a single frame.

9. The audio noise cancellation method based on frame offset and sequential decoding according to claim 1, characterized in that, The target audio data segment is connected to the audio data before the target time point. This includes performing a memory copy operation on the PCM data of the target audio data segment and the PCM data of the last frame of audio before the target time point in chronological order to form a continuous PCM data block for playback or storage.

10. An audio noise cancellation system based on frame offset and sequential decoding, used to implement the method as described in any one of claims 1-9, characterized in that, It includes a receiving and processing module, a decoding module, a comparison and filtering module, and an output connection module; The receiving and calculating module is used to receive a target time point for the audio stream and calculate a starting decoding time point earlier than the target time point; The decoding module is used to sequentially decode the audio stream starting from the initial decoding time point; The comparison and filtering module is used to compare the playback timestamp of the decoded audio frame with the target time point during the sequential decoding process, and to filter according to the comparison result to obtain a continuous target audio data segment starting from the target time point. The output connection module is used to output the target audio data segment and connect it with the audio data before the target time point.