Efficient real-time voice and video transmission method
By dynamically selecting the video frame encoding method and clock synchronization, the problem of insufficient encoding strategy in the existing technology in different scenarios is solved, and efficient and low-latency audio and video transmission is achieved to meet the needs of high quality and real-time.
Patent Information
- Application Number
- CN202411259442.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-10
- Publication Date
- 2024-12-13
AI Technical Summary
The existing video transmission technology lacks flexibility when dealing with changes in different video content and cannot dynamically adjust the encoding strategy, resulting in wasted bandwidth in static scenes and video quality in dynamic scenes, which cannot meet the requirements of high picture quality.
By capturing the brightness and motion state parameters of video frames, dynamically selecting the video frame encoding method, high compression rate encoding is used in static state, low compression rate encoding is used in dynamic state, and clock synchronization and buffer adjustment is performed through network time protocol. Ensure packets are played in sequence and synchronously.
Adaptive encoding according to the status of the video content is realized, data transmission efficiency and video quality are optimized, data volume is reduced, transmission speed is improved, audio and video data synchronization and high-quality transmission are achieved, and the high requirements of real-time and clarity are met.
Smart Images

Figure CN119135819A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of voice and video transmission, and in particular, relates to an efficient real-time voice and video transmission method. Background Art
[0002] The voice and video transmission method is a technology used to efficiently and reliably transmit audio and video data in a network environment. The method usually involves capturing video and audio data through a camera and a microphone, and encoding the data and transmitting it to the receiving end through the network. During the transmission process, an appropriate encoding method is used to optimize the data volume and transmission efficiency. For example, high compression rate encoding is used to reduce the data volume and save bandwidth in static scenes; low compression rate encoding is used in dynamic scenes to retain more details and ensure video quality. In addition, a time synchronization protocol is used to calibrate the clocks of the sender and the receiver to ensure synchronous data transmission. Through reasonable buffer management, this method can also effectively handle the disorder and loss of data packets, reduce the phenomenon of audio and video asynchrony, and improve user experience. This transmission method can provide smooth, high-definition, and low-latency audio and video services under various network conditions, and is widely used in scenarios such as video conferencing, online live broadcasting, and distance education.
[0003] In the prior art, audio and video transmission systems usually have the following problems:
[0004] Traditional video transmission technology usually uses a fixed encoding method, which lacks flexibility in dealing with changes in different video content and cannot dynamically adjust the encoding strategy according to the actual changes in video content. In static scenes, the changes between video frames are small, and the use of high-compression encoding can greatly reduce the amount of data and save bandwidth resources. However, the fixed encoding method cannot recognize this change feature and may still use low-compression encoding, resulting in bandwidth waste. On the other hand, in dynamic scenes, the video content changes rapidly and more detailed information needs to be retained. At this time, it is necessary to use low-compression encoding. However, the fixed encoding method cannot be flexibly adjusted and may still use high-compression encoding, which will lose a lot of image details, resulting in a decrease in video quality and cannot meet application scenarios with high image quality requirements.
[0005] In view of this, the present invention is proposed. Summary of the invention
[0006] The technical problem to be solved by the present invention is to overcome the deficiencies of the prior art, provide an efficient real-time voice and video transmission method, and solve the problems raised in the above background technology.
[0007] In order to solve the above technical problems, the basic concept of the technical solution adopted by the present invention is:
[0008] An efficient real-time voice and video transmission method comprises the following steps:
[0009] The video data and the audio data are captured by the camera and the recorder respectively, and transmitted to the buffer, and the buffer is used for temporarily storing the audio and video data;
[0010] Obtaining parameters of each video frame in the video data from the buffer, including brightness and motion state of the video frame, and then determining a static state or a dynamic state of the video according to the parameters;
[0011] Select the video frame encoding method according to the video state; when the video is in a static state, use a high compression rate encoding method to reduce the amount of data; when the video is in a dynamic state, use a low compression rate encoding method to retain video details;
[0012] The encoded video data and audio data are transmitted to the receiving end through the network.
[0013] Optionally, the following steps are performed while transmitting the encoded video data and audio data to the receiving end through the network:
[0014] Obtain the current time from an external time source through the Network Time Protocol, and periodically synchronize the clock to adjust the deviation of the device clock;
[0015] The sending end timestamps the audio and video data packets and records the generation time of the data packets; after receiving the data packets, the receiving end parses the timestamp information and compares it with the current system time to calculate the timestamp error;
[0016] Determine whether the timestamp error is within a preset range; if so, the receiving end adjusts the play order of the buffer according to the timestamp sequence to ensure synchronous playback of audio and video data; if beyond the preset range, the receiving end dynamically adjusts the buffer size to compensate for the time error;
[0017] When packet loss or delay caused by network fluctuations is detected, the receiver handles timestamp errors differentially and dynamically adjusts the buffer size.
[0018] Optionally, during the video transmission process, selecting an appropriate video frame encoding method according to the state of the video content can effectively optimize data transmission efficiency and video quality. The specific steps are as follows:
[0019] After receiving the video data, each video frame is analyzed, and the inter-frame difference parameter is calculated to determine the degree of change between the video frames and preset the corresponding threshold;
[0020] The state of the video is judged according to the preset threshold. When the inter-frame difference parameter is less than or equal to the preset threshold, the video is judged to be in a static state and a high-compression encoding method is used. When the inter-frame difference parameter is greater than the preset threshold, the video is judged to be in a dynamic state and a low-compression encoding method is used. Finally, the video state is continuously monitored during the encoding process, and the encoding method is dynamically adjusted according to the changes in the inter-frame difference parameter. When the video state changes, the encoding method is automatically switched to adapt to the current video content.
[0021] Optionally, the specific steps of obtaining the current accurate time from an external time source through the Network Time Protocol and periodically synchronizing the clock are as follows:
[0022] Configure the NTP protocol on the sending and receiving ends, and specify an external time source as the time reference;
[0023] When the device starts, it sends a request to an external time source through the NTP protocol to obtain the current accurate time and synchronize the system clock to the external time;
[0024] After the first synchronization is completed, set a regular synchronization cycle and send time requests to the external time source regularly according to the cycle;
[0025] The deviation between the system clock and the external time is preset and after each time data is received, the deviation between the system clock and the external time is calculated. If the deviation exceeds the allowable range, the system clock is adjusted to maintain synchronization.
[0026] Optionally, the specific steps of performing timestamp marking and synchronization adjustment on the audio and video data packets include the following steps:
[0027] Initialize the timestamp recording mechanism at the sending end and obtain the current system time when the audio and video data packets are generated at the sending end, and mark the time as the timestamp in the packet header, and then transmit the timestamp-marked data packet to the receiving end through the network;
[0028] After receiving the audio and video data packets, the receiver parses the timestamp information in the packet header and compares it with the current system time, calculates the time error during the transmission process and presets the time error threshold;
[0029] The receiving end determines whether the timestamp error is within the allowable range based on the preset time error threshold; if it is within the allowable range, the transmission and synchronization are normal; if it is out of the range, further synchronization adjustments are made.
[0030] Optionally, audio and video synchronization is adjusted based on the timestamp error range, specifically including the following steps:
[0031] When the timestamp error is within the allowable range, the receiver plays the audio and video data in the order of the timestamps to ensure synchronous playback. When the timestamp error exceeds the allowable range, the receiver triggers the synchronization correction mechanism to compensate for the time difference by adjusting the clock, resynchronizing, or dynamically adjusting the buffer size.
[0032] Optionally, when the timestamp error is within a preset range, the receiving end performs synchronous playback by adjusting the playback order of the buffer, specifically including:
[0033] The receiving end initializes the audio and video data buffer and temporarily stores the received data packets. Then, after receiving the audio and video data packets, the receiving end extracts the timestamp information from the data packet header;
[0034] The receiving end extracts the timestamp of the data packet, compares it with the current system time, calculates the timestamp error, and determines whether it is within the preset range;
[0035] Store the data packets into a buffer and sort them according to the timestamp information to ensure that they are arranged in chronological order;
[0036] After the buffer is sorted, the play queue is updated to ensure that the data packets in the play queue are arranged in the order of timestamps. Then, the data packets are read from the buffer in the order of timestamps to play the audio and video data.
[0037] Optionally, when packet loss or delay caused by network fluctuation is detected, the receiving end performs differential processing of timestamp errors and dynamically adjusts the buffer size as follows:
[0038] During the monitoring process, the receiver checks the sequence number and timestamp of the data packet, identifies the lost data packet, and measures the transmission time to determine the delay. When the packet loss or delay outside the normal range is detected, the abnormal data packet is marked;
[0039] For successfully received packets, the receiver calculates the timestamp error, which is the difference between the actual arrival time of the packet and the generation time. Based on these errors, the impact of transmission delays and network fluctuations is determined;
[0040] Based on the calculated timestamp error type and degree, the receiving end determines whether it is a small-scale error or a large-scale error, and executes the corresponding differentiated processing strategy;
[0041] The receiving end dynamically adjusts the buffer size according to the needs of differentiated processing. If the network condition deteriorates, the buffer is increased to accommodate more data packets; if the network condition improves, the buffer is reduced to reduce latency.
[0042] After adopting the above technical solution, the present invention has the following beneficial effects compared with the prior art. Of course, any product implementing the present invention does not necessarily need to achieve all of the following advantages at the same time:
[0043] By selecting the appropriate video frame encoding method according to the state of the video content, the system can use a high-compression encoding method in a static state to effectively reduce the amount of data and save network bandwidth, and use a low-compression encoding method in a dynamic state to retain more video details, thereby minimizing the amount of data transmission without affecting the video quality and improving the overall transmission efficiency; at the same time, since the amount of data transmitted is reduced and the data transmission speed is increased, this not only helps to reduce the transmission delay of audio and video data, but also through reasonable buffer management, it can effectively reduce the audio and video asynchrony caused by data packet disorder, ensure that audio and video data are played in the order of generation, optimize the user viewing experience, and achieve high-quality, low-latency audio and video transmission services to meet users' high requirements for real-time and clarity.
[0044] The specific implementation modes of the present invention are further described in detail below with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] The drawings described below are only some embodiments. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0046] In the figure:
[0047] Figure 1 It is a structural diagram.
[0048] It should be noted that these drawings and textual descriptions are not intended to limit the conceptual scope of the present invention in any way, but are intended to illustrate the concept of the present invention for those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0049] The present invention will now be described in further detail with reference to the accompanying drawings.
[0050] See also Figure 1 As shown, in this embodiment, an efficient real-time voice and video transmission method is provided, comprising the following steps:
[0051] The video data and audio data are captured by the camera and the recorder respectively, and then transferred to the buffer, which is used to temporarily store the audio and video data; after the data is captured, the data is transferred to the buffer for temporary storage. This process helps to smooth the data flow, prevent delays or losses caused by the mismatch between data processing speed and capture speed, and ensure the integrity and continuity of audio and video data.
[0052] The parameters of each video frame in the video data are obtained from the buffer, including the brightness and motion state of the video frame. Then, the static state or dynamic state of the video is determined based on the parameters. By analyzing the extracted parameters, the system can effectively determine whether the video is in a static state or a dynamic state. The static state usually means that the video frame changes less, while the dynamic state means that the video frame changes more. Such a judgment provides a basis for the selection of subsequent encoding strategies and helps to optimize data processing efficiency.
[0053] Select the video frame encoding method according to the video state; when the video is in a static state, use a high compression rate encoding method to reduce the amount of data; when the video is in a dynamic state, use a low compression rate encoding method to retain video details; select the corresponding encoding method according to the state of the video (static or dynamic). This strategy can adapt to the video content and optimize data transmission efficiency. For example, using high compression rate encoding in static videos can help reduce the amount of data and save bandwidth; while using low compression rate encoding in dynamic videos can better retain video details and image quality.
[0054] Transmit the encoded video and audio data to the receiving end through the network. Transmitting the encoded data through the network helps to maintain the synchronization and integrity of the audio and video data. The encoded data is usually optimized and compressed, which can be transmitted more efficiently while reducing the probability of errors and packet loss during transmission.
[0055] In this embodiment, the following steps are performed while transmitting the encoded video data and audio data to the receiving end through the network:
[0056] The current time is obtained from an external time source through the Network Time Protocol, and the clock is synchronized periodically to adjust the deviation of the device clock; the device clock is synchronized regularly through the Network Time Protocol (NTP) to ensure that the time of the sender and the receiver is consistent. This process eliminates synchronization problems caused by clock drift and helps maintain the synchronization of audio and video under different network conditions. Continuously adjusting the deviation of the device clock can reduce the accumulation of time errors, ensure accurate time synchronization during long-term transmission, and thus ensure the orderly transmission of data packets.
[0057] The sending end timestamps the audio and video data packets and records the generation time of the data packets. After receiving the data packets, the receiving end parses the timestamp information and compares it with the current system time to calculate the timestamp error. The sending end timestamps each data packet to ensure that each data packet has an accurate generation time. This helps the receiving end to accurately calculate the timestamp error and make necessary synchronization adjustments. By comparing the timestamp and the current system time, the receiving end can accurately assess the delay or packet loss problems that may occur during the transmission process, providing data support for subsequent error adjustments.
[0058] Determine whether the timestamp error is within the preset range; if it is within the preset range, the receiver adjusts the playback order of the buffer according to the timestamp sequence to ensure that the audio and video data are played synchronously; if it exceeds the preset range, the receiver dynamically adjusts the buffer size to compensate for the time error; by determining the timestamp error, the system can dynamically decide whether to adjust the playback order or buffer size. For small errors, only the playback order needs to be adjusted; for large errors, the buffer size is adjusted to compensate. This allows for flexible response to synchronization issues of varying degrees. Ensuring that audio and video data are played in timestamp order reduces the asynchrony caused by disordered data packets, helps provide a smooth playback experience, and improves user satisfaction.
[0059] When packet loss or delay caused by network fluctuations is detected, the receiver can quickly detect packet loss or delay and respond by differential processing and adjusting the buffer size. This helps maintain the stability of audio and video transmission in unstable network conditions. Through targeted adjustments, the system can maintain high audio and video transmission quality under different network conditions, enhancing the robustness and stability of the system.
[0060] In this embodiment, during the video transmission process, an appropriate video frame encoding method is selected according to the state of the video content, which can effectively optimize the data transmission efficiency and video quality. The specific steps are as follows:
[0061] After receiving the video data, each video frame is analyzed, and the inter-frame difference parameters are calculated to determine the degree of change between the video frames and preset the corresponding thresholds; analyzing each video frame and calculating the inter-frame difference parameters helps to intelligently judge the dynamic changes of the video and provide data support for the subsequent selection of encoding methods.
[0062] The state of the video is judged according to the preset threshold. When the inter-frame difference parameter is less than or equal to the preset threshold, the video is judged to be in a static state and a high compression rate encoding method is used; when the inter-frame difference parameter is greater than the preset threshold, the video is judged to be in a dynamic state and a low compression rate encoding method is used. Finally, the video state is continuously monitored during the encoding process, and the encoding method is dynamically adjusted according to the changes in the inter-frame difference parameter. When the video state changes, the encoding method is automatically switched to adapt to the current video content. By judging the static or dynamic state of the video, the system can select an appropriate encoding method, which can save bandwidth in static scenes and maintain video quality in dynamic scenes. This adaptive encoding strategy helps to optimize transmission efficiency and video quality. The video state is continuously monitored during the encoding process, and the encoding method can be dynamically adjusted according to the actual situation to automatically adapt to changes in video content. This dynamic adjustment mechanism ensures that the system always runs in the best state and improves the stability and fluency of video transmission.
[0063] In this embodiment, the specific steps of obtaining the current accurate time from an external time source through the network time protocol and periodically performing clock synchronization are:
[0064] Configure the NTP protocol on the sending and receiving ends, and specify an external time source as a time reference; by configuring the NTP protocol on the sending and receiving ends and specifying the same external time source, ensure that all devices use a unified time reference. This can avoid synchronization problems caused by inconsistent time between devices and improve the accuracy of data transmission. Among them, the NTP protocol is a standard network time synchronization protocol that can provide millisecond-level time accuracy. By specifying an external time source as a reference, the system can obtain high-precision time information and ensure the accuracy of time synchronization.
[0065] When the device starts, it sends a request to the external time source through the NTP protocol to obtain the current accurate time and synchronize the system clock to the external time. By obtaining the current accurate time and synchronizing the system clock to the external time, the time error that may exist when the device starts is eliminated. This can avoid synchronization problems caused by inaccurate startup clocks and ensure that the system enters a normal synchronization state immediately after startup.
[0066] After the first synchronization is completed, set a regular synchronization cycle and send time requests to the external time source regularly according to the cycle; by setting a regular synchronization cycle, the system can regularly update the time information to prevent clock drift over time. This can continuously maintain time synchronization between devices and ensure the long-term stability of the system.
[0067] The deviation between the system clock and the external time is preset, and after each time data is received, the deviation between the system clock and the external time is calculated. If the deviation exceeds the allowable range, the system clock is adjusted to maintain synchronization. By presetting the deviation range between the system clock and the external time, the system can promptly detect and correct time errors that exceed the allowable range. This ensures the accuracy of time synchronization and reduces synchronization problems caused by time errors. After each time data is received, the deviation between the system clock and the external time is calculated, and the system clock is adjusted according to the deviation. This dynamic adjustment mechanism can correct time errors in a timely manner, ensure that the system clock is always synchronized with the external time source, and improve the stability of time synchronization.
[0068] In this embodiment, the specific steps of performing timestamp marking and synchronization adjustment on the audio and video data packets include the following steps:
[0069] Initialize the timestamp recording mechanism at the sending end and obtain the current system time when the audio and video data packets are generated at the sending end, and mark the time as the timestamp in the packet header, and then transmit the timestamp-marked data packet to the receiving end through the network; after receiving the audio and video data packets, the receiving end parses the timestamp information in the packet header and compares it with the current system time, calculates the time error in the transmission process and presets the time error threshold;
[0070] The receiving end determines whether the timestamp error is within the allowable range based on the preset time error threshold; if it is within the allowable range, the transmission and synchronization are normal; if it is beyond the range, further synchronization adjustments are made. By setting the time error threshold, the system's tolerance range for time errors is clarified. This design can flexibly respond to various situations in network delays and data transmission to ensure the stability of transmission and synchronization. If the timestamp error is within the allowable range, it means that the data transmission and synchronization are normal; if it is beyond the range, further synchronization adjustments are required. This not only provides preventive measures, but also includes response strategies, which helps the system maintain the stability and consistency of audio and video transmission under various network conditions.
[0071] In this embodiment, the audio and video synchronization adjustment is performed based on the timestamp error range, specifically including the following steps:
[0072] When the timestamp error is within the allowable range, the receiver plays the audio and video data in the order of the timestamps to ensure synchronous playback. When the timestamp error exceeds the allowable range, the receiver triggers the synchronization correction mechanism to compensate for the time difference by adjusting the clock, resynchronizing, or dynamically adjusting the buffer size.
[0073] In this embodiment, when the timestamp error is within a preset range, the receiving end performs synchronous playback by adjusting the playback order of the buffer, specifically including:
[0074] The receiving end initializes the audio and video data buffer and temporarily stores the received data packets. Then, after receiving the audio and video data packets, the receiving end extracts the timestamp information from the packet header. The receiving end adopts differentiated processing strategies for different timestamp errors. For small errors, simply adjusting the playback order is sufficient, while for large errors, more complex synchronization corrections are required, such as adjusting the clock or buffer size. Such differentiated processing helps to select the most suitable solution according to the specific situation and improve the flexibility and response speed of the system.
[0075] The receiving end extracts the timestamp of the data packet, compares it with the current system time, calculates the timestamp error, and determines whether it is within the preset range;
[0076] The data packets are stored in the buffer and sorted according to the timestamp information to ensure that they are arranged in chronological order; by sorting the data packets according to the timestamps in the buffer and updating the play queue, the audio and video data are played in the order of generation. This method can effectively reduce the phenomenon of audio and video asynchrony caused by disordered data packets, ensure the synchronous playback of audio and video, and optimize the user experience.
[0077] After the buffer is sorted, the play queue is updated to ensure that the data packets in the play queue are arranged in the order of timestamps. Then, the data packets are read from the buffer in the order of timestamps to play the audio and video data. When the timestamp error exceeds the allowable range, the receiver can trigger the synchronization correction mechanism and make dynamic adjustments. This design ensures that the system can quickly adjust when encountering errors of varying degrees to maintain the continuity and stability of audio and video transmission.
[0078] In this embodiment, when a packet loss or delay caused by network fluctuation is detected, the receiving end performs differential processing of timestamp errors and dynamically adjusts the buffer size in the following steps:
[0079] During the monitoring process, the receiver checks the sequence number and timestamp of the data packet, identifies the lost data packet, and measures the transmission time to determine the delay. When the packet loss or delay beyond the normal range is detected, the abnormal data packet will be marked and the receiver will adopt different processing strategies according to the type and degree of timestamp error. This differentiated processing method helps to accurately deal with different problems caused by network fluctuations and improve the stability and efficiency of data transmission.
[0080] For successfully received data packets, the receiving end calculates the timestamp error, which is the difference between the actual arrival time of the data packet and the generation time. Based on these errors, the impact of transmission delay and network fluctuations is determined; according to changes in network conditions, the buffer size is dynamically adjusted to meet real-time transmission requirements. This mechanism can effectively reduce delays, optimize data transmission performance, and ensure the stability of audio and video transmission.
[0081] According to the calculated timestamp error type and degree, the receiver determines whether it is a small error or a large error, and executes the corresponding differentiated processing strategy. For example, for a small error, it may only be necessary to adjust the playback order; for a large error, synchronization adjustment or retransmission request is required; by setting different processing strategies for small errors and large errors, the receiver can flexibly respond to various network fluctuations, and can quickly adjust when the network condition fluctuates slightly, and can also take stronger error correction measures in the case of more serious fluctuations.
[0082] The receiving end dynamically adjusts the buffer size according to the needs of differentiated processing. If the network condition deteriorates, the buffer is increased to accommodate more data packets; if the network condition improves, the buffer is reduced to reduce latency. Through differentiated processing and dynamic adjustment, the receiving end can maintain high audio and video synchronization under different network conditions, reduce playback freezes and asynchrony caused by network fluctuations, and thus improve user experience.
[0083] Specifically, when the network condition is poor, dynamically increasing the buffer can accommodate more data packets, prevent data loss, and improve the reliability of audio and video transmission; when the network condition recovers, reducing the buffer can reduce delays and ensure real-time performance. Such measures help maintain good transmission quality under various network conditions.
[0084] The present invention is not limited to the above-mentioned embodiments. Anyone should be aware that any structural changes made under the enlightenment of the present invention, and any technical solutions that are the same or similar to the present invention, fall within the protection scope of the present invention. The technology, shape, and structural parts not described in detail in the present invention are all well-known technologies.
Claims
1. An efficient real-time voice and video transmission method, characterized in that: The following steps are involved: The video data and the audio data are captured by the camera and the audio recorder respectively, and transmitted to the buffer, and the buffer is used for temporarily storing the audio and video data; Obtaining parameters of each video frame in the video data from the buffer, including brightness and motion state of the video frame, and then determining a static state or a dynamic state of the video according to the parameters; Select the video frame encoding method according to the video state; when the video is in a static state, use a high compression rate encoding method to reduce the amount of data; when the video is in a dynamic state, use a low compression rate encoding method to retain video details; The encoded video data and audio data are transmitted to the receiving end through the network.
2. An efficient real-time voice and video transmission method according to claim 1, characterized in that: The following steps are performed while transmitting the encoded video data and audio data to the receiving end through the network: Obtain the current time from an external time source through the Network Time Protocol, and periodically synchronize the clock to adjust the deviation of the device clock; At the sending end, the audio and video data packets are timestamped to record the generation time of the data packets; After receiving the data packet, the receiver parses the timestamp information, compares it with the current system time, and calculates the timestamp error; Determine whether the timestamp error is within a preset range; if so, the receiving end adjusts the playback order of the buffer according to the timestamp sequence to ensure synchronous playback of audio and video data; If it exceeds the preset range, the receiving end dynamically adjusts the buffer size to compensate for the time error; When packet loss or delay caused by network fluctuations is detected, the receiver handles timestamp errors differentially and dynamically adjusts the buffer size.
3. An efficient real-time voice and video transmission method according to claim 1, characterized in that: During video transmission, select the appropriate video frame encoding method according to the state of the video content to effectively optimize data transmission efficiency and video quality. The specific steps are as follows: After receiving the video data, each video frame is analyzed, and the inter-frame difference parameter is calculated to determine the degree of change between the video frames and preset the corresponding threshold; The state of the video is determined according to a preset threshold. When the inter-frame difference parameter is less than or equal to the preset threshold, the video is determined to be in a static state and a high compression rate encoding method is used; When the inter-frame difference parameter is greater than the preset threshold, the video is judged to be in a dynamic state and a low-compression encoding method is used. Finally, the video state is continuously monitored during the encoding process, and the encoding method is dynamically adjusted according to the changes in the inter-frame difference parameter. When the video state changes, the encoding method is automatically switched to adapt to the current video content.
4. An efficient real-time voice and video transmission method according to claim 1, characterized in that: The specific steps to obtain the current accurate time from an external time source through the Network Time Protocol and periodically synchronize the clock are as follows: Configure the NTP protocol on the sending and receiving ends, and specify an external time source as the time reference; When the device starts, it sends a request to an external time source through the NTP protocol to obtain the current accurate time and synchronize the system clock to the external time; After the first synchronization is completed, set a regular synchronization cycle and send time requests to the external time source regularly according to the cycle; The deviation between the system clock and the external time is preset and after each time data is received, the deviation between the system clock and the external time is calculated. If the deviation exceeds the allowable range, the system clock is adjusted to maintain synchronization.
5. An efficient real-time voice and video transmission method according to claim 1, characterized in that: The specific steps of timestamping and synchronizing the audio and video data packets include the following steps: Initialize the timestamp recording mechanism at the sending end and obtain the current system time when the audio and video data packets are generated at the sending end, and mark the time as the timestamp in the packet header, and then transmit the timestamp-marked data packet to the receiving end through the network; After receiving the audio and video data packets, the receiver parses the timestamp information in the packet header and compares it with the current system time, calculates the time error during the transmission process and presets the time error threshold; The receiving end determines whether the timestamp error is within the allowable range based on the preset time error threshold; if it is within the allowable range, the transmission and synchronization are normal; if it is out of the range, further synchronization adjustments are made.
6. An efficient real-time voice and video transmission method according to claim 1, characterized in that: The audio and video synchronization is adjusted based on the timestamp error range, specifically including the following steps: When the timestamp error is within the allowable range, the receiver plays the audio and video data in the order of the timestamps to ensure synchronous playback. When the timestamp error exceeds the allowable range, the receiver triggers the synchronization correction mechanism to compensate for the time difference by adjusting the clock, resynchronizing, or dynamically adjusting the buffer size.
7. An efficient real-time voice and video transmission method according to claim 1, characterized in that: When the timestamp error is within the preset range, the receiving end adjusts the playback order of the buffers for synchronous playback, including: The receiving end initializes the audio and video data buffer and temporarily stores the received data packets. Then, after receiving the audio and video data packets, the receiving end extracts the timestamp information from the data packet header; The receiving end extracts the timestamp of the data packet, compares it with the current system time, calculates the timestamp error, and determines whether it is within the preset range; Store the data packets into a buffer and sort them according to the timestamp information to ensure that they are arranged in chronological order; After the buffer is sorted, the play queue is updated to ensure that the data packets in the play queue are arranged in the order of timestamps. Then, the data packets are read from the buffer in the order of timestamps to play the audio and video data.
8. An efficient real-time voice and video transmission method according to claim 1, characterized in that: When packet loss or delay caused by network fluctuations is detected, the receiver processes the timestamp error differentially and dynamically adjusts the buffer size in the following steps: During the monitoring process, the receiver checks the sequence number and timestamp of the data packet, identifies the lost data packet, and measures the transmission time to determine the delay. When it detects data packet loss or delay beyond the normal range, it marks the abnormal data packet; For successfully received packets, the receiver calculates the timestamp error, which is the difference between the actual arrival time of the packet and the generation time. Based on these errors, the influence of transmission delay and network fluctuation is determined; Based on the calculated timestamp error type and degree, the receiving end determines whether it is a small-scale error or a large-scale error, and executes the corresponding differentiated processing strategy; According to the needs of differentiated processing, the receiving end dynamically adjusts the buffer size. If the network condition deteriorates, the buffer is increased to accommodate more data packets; if the network condition improves, the buffer is reduced to reduce latency.
Citation Information
Cited By
Work card-wearable audio and video equipment capable of realizing 4G network transmission
CN119342163A
Ad hoc network voice transmission test platform and method
CN119892681A
Game performance optimization method and device based on dynamic scheduling and storage medium
CN120045336A
5G differential adaptive link delay detection method and system
CN120835018A
Method and system for measuring carbon emission factor of fixed combustion source
CN121027461A
