Multimedia file transmission optimization method and system
By identifying the format and key attributes of multimedia files, dynamically selecting compression algorithms and optimizing them based on terminal performance, it solves the inefficiency problem of traditional multimedia transmission methods and improves user experience.
Patent Information
- Application Number
- CN202510978572.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-16
- Publication Date
- 2025-10-10
AI Technical Summary
Traditional multimedia data transmission methods do not perform personalized encoding or compression strategy optimization for different types of content, resulting in low transmission efficiency in complex or changing transmission scenarios and an inability to adapt to terminal performance, leading to a poor user experience.
By identifying the format and key attributes of multimedia files, dynamically selecting compression algorithms for optimization, and performing secondary compression based on the device type and performance of the target terminal, an adapted multimedia file is generated.
It improves the transmission efficiency of multimedia files and the display effect on the target terminal, and enhances the user experience.
Smart Images

Figure CN120768892A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of multimedia transmission technology, and in particular to a method and system for optimizing the transmission of multimedia files. Background Art
[0002] With the rapid development of fifth-generation mobile communication technology (5G), multimedia messaging (e.g., high-definition video, audio, and images) is becoming increasingly common in mobile communications. 5G technology, with its high bandwidth, low latency, and massive connectivity, provides a solid foundation for the real-time transmission of multimedia data.
[0003] However, traditional multimedia data transmission methods usually adopt fixed encoding and compression methods, and do not optimize personalized encoding or compression strategies for different types of content (for example, video, audio, and images), resulting in low transmission efficiency in complex or changing transmission scenarios. At the same time, they also fail to dynamically optimize and adjust the transmitted multimedia files based on parameters such as the terminal's device type and processing performance, making the multimedia content displayed in the target terminal unable to adapt to the terminal performance, resulting in problems such as blurred image quality, playback jams, and audio and video asynchrony, resulting in a poor user experience. Summary of the Invention
[0004] The present invention provides a method and system for optimizing the transmission of multimedia files, which can solve at least one of the above technical problems.
[0005] In a first aspect, an embodiment of the present invention provides a method for optimizing transmission of multimedia files, including:
[0006] determining a file type of the first multimedia file based on a format of the first multimedia file;
[0007] Based on the file type of the first multimedia file, determining a key attribute of the first multimedia file in a preset type attribute correspondence table, and identifying an attribute value of the key attribute on the first multimedia file to obtain an attribute value of the key attribute of the first multimedia file;
[0008] Determining a corresponding first compression algorithm based on the format of the first multimedia file and the attribute value of the key attribute, and performing compression optimization on the first multimedia file based on the first compression algorithm to obtain a second multimedia file;
[0009] In response to a multimedia file transmission request from a target terminal, performing secondary compression optimization on the second multimedia file based on the file type of the second multimedia file and the device type and device performance of the target terminal to obtain a target multimedia file;
[0010] The target multimedia file is transmitted to the target terminal.
[0011] In a second aspect, an embodiment of the present invention also provides a multimedia file transmission optimization system, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute any one of the methods described in the embodiments of the present invention.
[0012] In a third aspect, an embodiment of the present invention further provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute any one of the methods described in the embodiments of the present invention.
[0013] According to the technical solution of the present invention, after determining the file type of a first multimedia file based on its format, a preset type attribute correspondence table is traversed to retrieve key attributes corresponding to the file type of the first multimedia file. The attribute values of the key attributes of the first multimedia file are identified by performing attribute value identification on the key attributes of the first multimedia file to obtain the attribute values of the key attributes of the first multimedia file. Based on the format of the first multimedia file and the attribute values of the key attributes of the first multimedia file, a corresponding first compression algorithm is determined. Compression optimization is then performed on the first multimedia file based on the first compression algorithm to obtain a second multimedia file. This approach, unlike using the same encoding and compression method for all multimedia files of different file types, optimizes the compression of the first multimedia file based on the first compression algorithm determined by the format of the first multimedia file and the attribute values of the key attributes, thereby improving multimedia file transmission efficiency. Subsequently, in response to a multimedia file transmission request from a target terminal, compression optimization is performed on the second multimedia file based on the file type of the second multimedia file and the device type and capabilities of the target terminal to obtain a target multimedia file. The resulting target multimedia file is then transmitted to the target terminal. In this way, before transmitting the multimedia file to the target terminal, the multimedia file is first compressed and optimized according to the device type and device performance of the target terminal to obtain the target multimedia file, and then the target multimedia file is transmitted to the target terminal, which improves the display effect of the multimedia file on the target terminal and thus enhances the user experience.
[0014] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present invention, nor is it intended to limit the scope of the present invention. Other features of the present invention will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The accompanying drawings are provided for a better understanding of the present invention and do not constitute a limitation of the present invention.
[0016] Figure 1 is a flow chart of a method for optimizing transmission of multimedia files according to an embodiment of the present invention;
[0017] Figure 2 This is a structural block diagram of a multimedia file transmission optimization device according to an embodiment of the present invention;
[0018] Figure 3 is a block diagram of an electronic device for implementing the method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0019] The following description of exemplary embodiments of the present invention is made in conjunction with the accompanying drawings, in which various details of the embodiments of the present invention are included to facilitate understanding. These details should be considered as merely exemplary. Therefore, it should be appreciated by those skilled in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope of the present invention. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0020] Figure 1 The figure is a flow chart of a method for optimizing transmission of multimedia files according to an embodiment of the present invention.
[0021] like Figure 1 As shown, the multimedia file transmission optimization method may include:
[0022] S110, determining a file type of the first multimedia file based on a format of the first multimedia file;
[0023] S120: Based on the file type of the first multimedia file, determine a key attribute of the first multimedia file in a preset type attribute correspondence table, and identify an attribute value of the key attribute of the first multimedia file to obtain an attribute value of the key attribute of the first multimedia file;
[0024] S130, determining a corresponding first compression algorithm based on the format of the first multimedia file and the attribute value of the key attribute, and performing compression optimization on the first multimedia file based on the first compression algorithm to obtain a second multimedia file;
[0025] S140, in response to the multimedia file transmission request of the target terminal, performing secondary compression optimization on the second multimedia file based on the file type of the second multimedia file and the device type and device performance of the target terminal to obtain a target multimedia file;
[0026] S150: Transmit the target multimedia file to the target terminal.
[0027] In an embodiment of the present invention, unlike conventional methods that compress multimedia files of all file types using the same encoding or compression method before transmission, the present invention determines the file type of the first multimedia file based on its format, then searches a preset type attribute correspondence table for key attributes of the first multimedia file corresponding to its file type, and obtains the attribute values of the key attributes of the first multimedia file by identifying the attribute values of the key attributes. A corresponding first compression algorithm is determined based on the format of the first multimedia file and the attribute values of its key attributes, and compression optimization is performed on the first multimedia file, thereby improving the transmission efficiency of the multimedia file. Subsequently, in response to a multimedia file transmission request from a target terminal, the second multimedia file is first compressed and optimized based on the display capabilities of the target terminal (display capabilities, i.e., device type and performance) and the file type of the second multimedia file obtained by compressing and optimizing the first multimedia file using the first compression algorithm, thereby obtaining the target multimedia file. The obtained target multimedia file is then transmitted to the target terminal, thereby improving its display quality on the target terminal and thereby enhancing the user experience.
[0028] Exemplarily, the first multimedia file refers to a file to be transmitted that contains audio data, video data, or image data. The first multimedia file can be a file of a single file type or a file composed of multiple file types. The format of the first multimedia file is generally identified by the extension of the first multimedia file, for example, .mp3, .mp4, .jpg, .png, .gif, .avi, .wav, or .flac. File types of the first multimedia file include image files, audio files, and video files.
[0029] Exemplarily, the format of the first multimedia file determines the file type to which it belongs, and a file type can be presented in multiple formats.
[0030] For example, the first multimedia file in .mp3 format belongs to the file type of "audio file", but the first multimedia file of the file type of "audio file" includes not only .mp3 format but also .wav, .flac, .aac and other formats.
[0031] For another example, the first multimedia file in .jpeg format belongs to a file type of "picture file", but the first multimedia file of "picture file" file type includes not only .jpeg format, but also .png format and .gif format.
[0032] Exemplarily, the preset type-attribute correspondence table includes multiple file types and key attributes corresponding to each file type, wherein each file type corresponds to at least one key attribute.
[0033] In this example, the file types in the preset type attribute correspondence table include image files, audio files, and video files; among them, the key attributes corresponding to image files include resolution, the key attributes corresponding to audio files include sampling rate, bit depth, and channels, and the key attributes corresponding to video files include resolution, bit rate, and frame rate.
[0034] For example, after obtaining the file type of the first multimedia file in step S110, a preset type-attribute correspondence table is traversed to search for key attributes corresponding to the file type of the first multimedia file in the type-attribute correspondence table. Based on the file type, different attribute value recognition methods are used to identify the attribute values of the key attributes of the first multimedia file, thereby obtaining the attribute values of the key attributes of the first multimedia file. These attribute value recognition methods include deep learning model recognition, speech recognition technology, and computer vision technology.
[0035] Specifically, if the file type of the first multimedia file is a picture file, a deep learning model is used to identify the attribute values of key attributes of the first multimedia file; if the file type of the first multimedia file is an audio file, speech recognition technology is used to identify the attribute values of key attributes of the first multimedia file; if the file type of the first multimedia file is a video file, computer vision technology is used to identify the attribute values of key attributes of the first multimedia file.
[0036] Exemplarily, the first compression algorithm refers to a compression algorithm dynamically selected based on the format of the first multimedia file and the attribute values of key attributes to compress the first multimedia file. The first compression algorithm includes a lossy compression algorithm and a lossless compression algorithm. The first multimedia file is compressed, transcoded, or format-converted using the first compression algorithm to generate a file (i.e., a second multimedia file) that has been preliminarily optimized in terms of quality and size. Compared to traditional methods of compressing and optimizing multimedia files of all types and formats using the same compression or encoding method, the method in this embodiment not only saves bandwidth but also improves transmission efficiency.
[0037] Exemplarily, the device information of the target terminal is obtained (e.g., identified through a request header or client registration information), where the device information of the target terminal includes its device type and device capabilities. Specifically, the device information includes the maximum resolution supported, decoding capabilities, processing capabilities, etc. Based on these parameters, the second multimedia file is compressed again to adapt to the target terminal (e.g., reducing the resolution, lowering the frame rate, switching to a lighter codec format, etc.).
[0038] For example, if the target terminal is a low-end mobile phone that only supports 720p resolution, the server can downscale the second multimedia file from 1080p to 720p and reduce the bit rate to 1.5Mbps, resulting in a target multimedia file with a resolution of 720p and a bit rate of 1.5Mbps. This improves playback smoothness and compatibility on the target terminal, avoids lag or decoding failures, and enhances the user experience.
[0039] For example, when transmitting a target multimedia file to a target terminal, the target multimedia file is transmitted using an encrypted transmission method, specifically including end-to-end encryption (E2EE) and transport layer security (TLS) encryption methods, to ensure that the data is not intercepted or tampered with during the transmission process.
[0040] In this example, the encryption process of encrypted transmission can be divided into the following specific steps:
[0041] First, key pair generation. During system initialization, the client and server each generate an asymmetric key pair (public and private keys) for subsequent authentication and key agreement. This key pair can be generated using a common public key encryption algorithm, such as RSA (Rivers-Shamir-Adleman) or Elliptic Curve Cryptography (ECC), to ensure secure and flexible key management.
[0042] Second, key exchange and negotiation. After generating an asymmetric key pair, the client and server negotiate to generate a symmetric encryption key based on the generated asymmetric key pair using a handshake mechanism such as the Diffie-Hellman (DH) key exchange algorithm or the Transport Layer Security (TLS) protocol. This symmetric key is used for actual data encryption in subsequent steps, effectively reducing the processing performance overhead of asymmetric encryption.
[0043] Third, end-to-end encryption processing. After the key negotiation is completed and the shared symmetric key is obtained, the client locally encrypts the first multimedia file based on the symmetric key to achieve end-to-end encryption (E2EE). Intermediate network devices cannot decrypt or tamper with the encrypted content. The Advanced Encryption Standard AES-256 (Advanced Encryption Standard, 256-bit) can be used here with the Galois / Counter Mode (GCM) to ensure data confidentiality and enhance the ability to resist data tampering.
[0044] Fourth, encrypted content encapsulation and integrity verification. After completing the encryption of the first multimedia file, the system further performs integrity encapsulation processing on the encrypted content (that is, the encrypted first multimedia file). Specifically, it includes generating and appending a hash-based message authentication code (Hash-based Message Authentication Code, HMAC) to verify whether the data has been tampered with or forged during transmission. At the same time, timestamp and serial number information can be added to prevent replay attacks and improve data traceability. This encapsulation process verifies and protects the encrypted data in the third step.
[0045] Fifth, transport layer encryption and data transmission. After encapsulating and verifying the encrypted content, the system sends the encrypted first multimedia file over the network using the transport layer security protocol. To ensure link security, the transmission channel uses the TLS 1.3 (or at least TLS 1.2) protocol for encryption to establish a secure communication link. The TLS handshake phase includes server authentication, public key exchange, and shared key generation, thereby protecting the aforementioned encapsulated data from eavesdropping or hijacking during network transmission, achieving multi-level security protection.
[0046] In addition, according to changes in the network environment, the most secure transmission protocol is intelligently selected to transmit the encrypted first multimedia file to the target terminal. Safe transmission protocols, such as virtual private networks (VPN) or TLS, ensure secure and reliable transmission in complex network environments. Specifically, the VPN transmission protocol is selected in environments where the network environment is unstable, there is a risk of man-in-the-middle attack (MITM) or anonymous relay (for example, a public Wi-Fi network environment, an enterprise intranet accessing an external server, a user selecting an enhanced privacy protection mode, etc.); the TLS transmission protocol is selected in scenarios where the network is relatively reliable but basic security still needs to be guaranteed, such as cellular mobile data networks (for example, 4G / 5G), known trusted networks (for example, home Wi-Fi), and high-concurrency real-time transmission scenarios. After the first multimedia file is compressed and optimized, the server encrypts it and selects a suitable protocol for transmission to ensure the integrity and confidentiality of the data. In this way, not only the stability and real-time performance of file transmission are improved, but it can also adapt to different network environments.
[0047] According to the above-described embodiment, a first compression algorithm is determined based on the file type of the multimedia file and the attribute values of its key attributes to optimize compression of the first multimedia file, thereby improving the transmission efficiency of the first multimedia file. This implements a closed-loop security mechanism from key generation and key negotiation to data encryption, integrity verification, and secure transmission. Each step is interconnected, gradually enhancing the confidentiality and integrity of data at each stage of the client, transmission link, and server. This is suitable for multimedia application scenarios with high requirements for multimedia file data transmission security, such as private communications, audio and video conferencing, and content distribution platforms.
[0048] In an embodiment, based on the file type of the first multimedia file, a key attribute of the first multimedia file is determined in a preset type attribute correspondence table, and attribute value recognition of the key attribute is performed on the first multimedia file to obtain an attribute value of the key attribute of the first multimedia file, including: if the file type of the first multimedia file is a picture file, the key attribute corresponding to the picture file is determined as resolution in the type attribute correspondence table, and the key attribute of the first multimedia file is determined as resolution, and resolution recognition is performed on the first multimedia file through a deep learning model to obtain a resolution value of the first multimedia file; based on the format of the first multimedia file and the attribute value of the key attribute, a corresponding first compression algorithm is determined, including: based on the format of the first multimedia file, it is determined that the first multimedia file is a lossy compression file or a lossless compression file; if the first multimedia file is a lossy compression file, and the resolution value of the first multimedia file is greater than or equal to a preset first threshold, a lossless compression algorithm is determined as the first compression algorithm; if the first multimedia file is a lossless compression file, and the resolution value of the first multimedia file is less than the first threshold, a lossy compression algorithm is determined as the first compression algorithm.
[0049] Exemplarily, the type attribute correspondence table stores a plurality of types of file types, and at least one key attribute corresponding to each type of file type. By traversing the type attribute correspondence table and querying in the table according to the file type of the first multimedia file, the key attribute corresponding to the picture file can be obtained.
[0050] It should be noted that the picture file includes static pictures and dynamic pictures, and whether it is a static picture or a dynamic picture, the compression algorithm is selected in the above manner (i.e., steps S120 and S130).
[0051] Exemplarily, the deep learning model can be MobileNet, EfficientNet or an image analysis model based on OpenCV. The first threshold is a self-defined high-resolution dividing line, which can be 2000x1500.
[0052] For example, the file name and extension of the first multimedia file are vacation.jpg. Since its extension is .jpg, it indicates that the file type of the first multimedia file is a picture file. Alternatively, the file type is confirmed to be a picture file through file header verification (for example, a JPEG file starts with FFD8FF). Subsequently, the key attribute corresponding to the picture file is determined to be resolution in the type attribute correspondence table. The first multimedia file is parsed using a deep learning model (for example, image analysis based on OpenCV) to obtain a resolution value of 3840×2160. Since the format of the first multimedia file of this picture type is .jpg, and the compression method corresponding to the .jpg format is lossy compression, and its resolution value of 3840×2160 is greater than 2000×1500, for vacation.jpg, a lossless compression algorithm such as WebPLossless is used to optimize its compression, and the second multimedia file is vacation.WebP. Not only is the file size reduced by 40% without quality loss, but the transmission efficiency is also improved.
[0053] For another example, the file name and extension of the first multimedia file are logo.png. Since its extension is .png, it indicates that the file type of the first multimedia file is a picture file. Subsequently, the key attribute corresponding to the picture file is determined to be resolution in the type attribute correspondence table. The first multimedia file is parsed using a deep learning model (for example, image analysis based on OpenCV), and a resolution value of 800×600 is obtained. Since the format of the first multimedia file of this picture type is .png, and the compression method corresponding to the .png format is lossless compression, and its resolution value of 800×600 is less than 2000×1500, for logo.png, a lossy compression algorithm such as JPEG is used to optimize its compression, and the second multimedia file obtained is vacation.JPEG. Not only is the file size reduced by 84%, the visual loss is small, and the transmission efficiency is also improved.
[0054] The above implementation automatically selects the optimal compression strategy based on image characteristics (resolution, format) without manual intervention. This avoids a "one-size-fits-all" compression strategy, using lossless compression to preserve details for high-resolution images and lossy compression to significantly reduce the size of low-resolution images, significantly improving transmission efficiency.
[0055] In one embodiment, based on the file type of the first multimedia file, the key attributes of the first multimedia file are determined in a preset type attribute correspondence table, and the attribute values of the key attributes of the first multimedia file are identified to obtain the attribute values of the key attributes of the first multimedia file, including: if the file type of the first multimedia file is an audio file, the key attributes corresponding to the audio file are determined to be sampling rate, bit depth and channel in the type attribute correspondence table, and the key attributes of the first multimedia file are determined to be sampling rate, bit depth and channel, and the attribute values of the sampling rate, bit depth and channel are identified for the first multimedia file respectively through speech recognition technology to obtain the sampling rate value, bit depth value and channel value. channel value, determining a bit rate value of the first multimedia file based on the product of the sampling rate value, the bit depth value and the channel value; determining a corresponding first compression algorithm based on the format of the first multimedia file and the attribute value of the key attribute, including: determining whether the first multimedia file is a lossy compressed file or a lossless compressed file based on the format of the first multimedia file; if the first multimedia file is a lossy compressed file and the bit rate value of the first multimedia file is greater than or equal to a preset second threshold, determining the lossless compression algorithm as the first compression algorithm; if the first multimedia file is a lossless compressed file and the bit rate value of the first multimedia file is less than the second threshold, determining the lossy compression algorithm as the first compression algorithm.
[0056] For example, by traversing the type attribute correspondence table and searching in the table according to the file type of the first multimedia file, it can be obtained that the key attributes corresponding to the file type of audio file are sampling rate, bit depth and channels.
[0057] Exemplarily, speech recognition technology can parse the metadata carried in the audio file encapsulation structure by calling open source audio analysis tools (e.g., FFmpeg, librosa, sox) or programming interfaces (such as Python's wave, pydub) to obtain the attribute values of its key attributes.
[0058] Exemplarily, the second threshold serves as a boundary for distinguishing high-bit-rate audio from low-bit-rate audio, and can be set to 1.5 Mbps.
[0059] For example, the first multimedia file is an audio file in.mp3 format, and its corresponding key attributes are sampling rate, bit depth, and channel. By parsing and extracting the audio metadata (e.g., using the ffprobe tool of FFmpeg), the sampling rate value is obtained as 48000 Hz, the bit depth value is obtained as 24 bit, and the channel value is obtained as 2. Based on the product of the attribute values of the three key attributes (sampling rate value, bit depth value, and channel value), the bit rate value of the audio file is calculated as 2.3 Mbps. Subsequently, since the compression method corresponding to the.mp3 multimedia file format is lossy compression, i.e., it is a lossy compressed file, and 2.3 Mbps is greater than 1.5 Mbps, the system selects a lossless compression algorithm (e.g., FLAC or ALAC) as the first compression algorithm to preserve more audio details and avoid further loss.
[0060] For another example, the first multimedia file is an audio file in.flac format, and its parameters are as follows: the sampling rate value is 22050 Hz, the bit depth value is 16 bit, and the channel value is 1. Based on the product of the attribute values of the three key attributes (sampling rate value, bit depth value, and channel value), the bit rate value of the audio file is calculated as 352.8 kbps. Since the compression method corresponding to the.flac multimedia file format is lossless compression, i.e., it is a lossless compressed file, and 352.8 kbps is less than the second threshold, the system determines a lossy compression algorithm (e.g., MP3 or AAC) as the first compression algorithm to improve compression rate and storage efficiency, and converts the format to reduce storage cost and improve transmission efficiency.
[0061] According to the above embodiments, the key attributes of the audio file are first determined as sampling rate, bit depth, and channel according to the type attribute correspondence table, the specific values of these attributes are obtained through speech recognition technology, and the bit rate value is calculated based on the product of the values. Then, it is determined whether the audio file format is lossy or lossless, and the compression algorithm is selected according to the comparison result of the bit rate value and the preset second threshold, i.e., a lossless algorithm is selected when the bit rate of the lossy file is high, and a lossy algorithm is selected when the bit rate of the lossless file is low. The appropriate compression algorithm can reduce the file size, reduce bandwidth consumption, and speed up the transmission speed in network transmission, and is particularly suitable for online music, voice calls, and other scenarios. In addition, by adjusting the preset second threshold, different requirements of different application scenarios (e.g., music platforms, voice assistants) for audio files can be flexibly adapted, and the versatility is improved.
[0062] In one embodiment, based on the file type of the first multimedia file, the key attributes of the first multimedia file are determined in a preset type attribute correspondence table, and the attribute values of the key attributes of the first multimedia file are identified, including: if the file type of the first multimedia file is a video file, then the key attributes corresponding to the video file are determined to be resolution, bit rate and frame rate in the type attribute correspondence table, and the key attributes of the first multimedia file are determined to be resolution, bit rate and frame rate; the attribute values of resolution, bit rate and frame rate of the first multimedia file are identified by computer vision technology to obtain the resolution value, bit rate value and frame rate value of the first multimedia file; based on the format of the first multimedia file and the attribute values of the key attributes, the corresponding first multimedia file is determined. A compression algorithm includes: determining, based on a format of a first multimedia file, whether the first multimedia file is a lossy compression file or a lossless compression file; if the first multimedia file is a lossless compression file, and a resolution value, a bit rate value, and a frame rate value of the first multimedia file are all greater than or equal to a preset third threshold, and at least one of the resolution value, the bit rate value, and the frame rate value of the first multimedia file is greater than a preset fourth threshold, then determining the lossy compression algorithm as a first compression algorithm; wherein the third threshold is less than the fourth threshold; if the first multimedia file is a lossy compression file, and at least one of the resolution value, the bit rate value, and the frame rate value of the first multimedia file is less than or equal to the preset third threshold, then determining the lossless compression algorithm as the first compression algorithm.
[0063] For example, by traversing the type attribute correspondence table and searching in the table according to the file type of the first multimedia file, it can be obtained that the key attributes corresponding to the file type of the video file are resolution, bit rate and frame rate.
[0064] For example, the computer vision technology may be a structured tool such as FFmpeg or MediaInfo. The structured tool is used to parse and extract video attributes of the first multimedia file whose file type is a video file to obtain a resolution value, a bit rate value, and a frame rate value of the video file.
[0065] For example, the third threshold is a basic value line, which is used to measure whether the first multimedia file meets the minimum standard parameter value of basic playback requirements. The fourth threshold is a high-quality value line, which is used to determine whether the lossless file needs to be further converted to lossy compression to optimize storage / transmission efficiency.
[0066] For example, the third thresholds of the resolution value, the bit rate value, and the frame rate value are set to 720p / 5Mbps / 24fps, respectively. Similarly, the fourth thresholds are set to 1080p / 20Mbps / 30fps, respectively.
[0067] If the first multimedia file is in .mov format, since the compression type corresponding to the .mov format is lossless compression, the first multimedia file is a lossless compressed file. It is parsed and extracted by FFmpeg, and its key attribute values are obtained as resolution value 1920×1080, bit rate value 5Mbps, and frame rate value 30fps. It can be seen that the attribute values of its various key attributes are greater than the third threshold, and its resolution value and bit rate value are greater than the fourth threshold (meeting the standard that at least one value is greater than the preset fourth threshold), so the first compression algorithm corresponding to the first multimedia file is a lossy compression algorithm. That is, H.265 High Efficiency Video Coding (HEVC) is selected as the first compression algorithm to perform compression optimization on the first multimedia file.
[0068] For another example, if the first multimedia file is in .mp4 format, since the compression type corresponding to the .mp4 format is lossy compression, the first multimedia file is a lossy compressed file. Parsing and extracting the file using FFmpeg reveals key attribute values of 640×360 resolution, 800kbps bitrate, and 15fps frame rate. These key attribute values are all less than the third threshold, indicating that the first compression algorithm corresponding to the first multimedia file is a lossless compression algorithm.
[0069] According to the above embodiment, when the first multimedia file is of video type, its key attributes are first clarified as resolution, bit rate and frame rate through the type attribute correspondence table. The attribute values are identified through computer vision technology to obtain the attribute values of these three key parameters (resolution value, bit rate value and frame rate value). Then, according to the format of the first multimedia file, it is judged whether it belongs to lossy or lossless compression, and finally the corresponding compression algorithm is determined in combination with the preset threshold to perform compression optimization. Lossy compression is used for high-quality lossless video (for example, 4K / high frame rate) to reduce the storage volume while retaining visual details; low-parameter lossy video is converted to lossless format to avoid image quality degradation caused by secondary compression. In addition, through dual-threshold dynamic decision-making, "over-compression" or "quality waste" is avoided, and video quality and transmission / storage costs are balanced.
[0070] In one embodiment, based on the file type of the second multimedia file, and the device type and device performance of the target terminal, the second multimedia file is subjected to secondary compression optimization to obtain a target multimedia file, including: based on the file type of the second multimedia file and according to the level of the device type of the target terminal, the second multimedia file is initially compressed to obtain a third multimedia file, and according to the adjustment strategy corresponding to the device performance, the third multimedia file is secondary compressed to obtain the target multimedia file.
[0071] Exemplarily, the level to which the device type of the target terminal belongs includes a first-level device and a second-level device, wherein the first-level device refers to a device terminal with relatively limited computing, display and storage capabilities, such as a smart watch, a low-end or old mobile phone, a wearable device, a small-screen mobile phone, etc.; and the second-level device refers to a terminal with medium-to-high computing and display capabilities and strong multimedia receiving and analyzing capabilities, such as a tablet, a personal computer (PC), a smart speaker device, etc.
[0072] Exemplarily, the acquisition of the device type of the target terminal can be achieved by calling an operating system application programming interface (API), such as Build.MODEL and Build.DEVICE of Android, and UIDevice.current.model of iOS.
[0073] Exemplarily, the device information can be called in a combination of software and hardware, such as MediaCodecInfo class, DisplayMetrics class and SystemProperties class.
[0074] Exemplarily, the device performance includes the frequency and core number of a central processing unit (CPU), the memory capacity of a random access memory (RAM), the graphics processing capability (for example, the level of a graphics processing unit and the support of a graphics application programming interface), the screen resolution and refresh rate, the version of an operating system and the hardware decoding capability, etc.
[0075] According to the above embodiment, the third multimedia file is generated by hierarchical compression according to the type of the second multimedia file (such as a video file, a picture file or an audio file) and the device type level of the target terminal; and the target multimedia file adapted to the target terminal is finally output by performing secondary compression adjustment or optimization on the third multimedia file according to the optimization strategy corresponding to the performance parameter (such as CPU computing power, memory capacity and decoding capability) of the terminal device. The compression parameter (such as resolution and code rate) is dynamically adjusted according to the device performance, so as to ensure the smoothness of playing on a weak-performance terminal (a first-level device) and to retain the quality details on a high-performance terminal (a second-level device).
[0076] In one embodiment, based on the file type of the second multimedia file and the level of the device type of the target terminal, the second multimedia file is initially compressed to obtain a third multimedia file, including: if the file type of the second multimedia file is a picture file and the level of the device type of the target terminal is a first-level device, based on the compression requirements of the first resolution and the first compression format corresponding to the first-level device, the second multimedia file is initially compressed to obtain a third multimedia file; if the file type of the second multimedia file is a picture file and the level of the device type of the target terminal is a second-level device, based on the compression requirements of the second resolution and the second compression format corresponding to the second-level device, the second multimedia file is initially compressed to obtain a third multimedia file; according to the adjustment strategy corresponding to the device performance, the third multimedia file is secondary compressed to obtain a target multimedia file, including: if the device performance is first-level performance, the third multimedia file is first compressed into a first display version, and then the second display version is delayed and loaded according to the adjustment strategy corresponding to the first-level performance, and the third multimedia file is secondary compressed to obtain the target multimedia file.
[0077] For example, if the second multimedia file is an image file, the target terminal's device type is first determined, and then the second multimedia file is initially compressed according to the compression requirements corresponding to that level. After the initial compression yields a third multimedia file, the third multimedia file is then secondary compressed according to an adjustment policy corresponding to the target terminal's device performance to yield the target multimedia file.
[0078] Specifically, if the target terminal's device type is a level 1 device: the compression requirement for the first resolution corresponding to the level 1 device is to automatically reduce the image resolution to a width of less than 480px; the compression requirement for the first compression format corresponding to the level 1 device is to convert the format to high-compression JPEG or WebP format. If the target terminal's device type is a level 2 device: the compression requirement for the second resolution corresponding to the level 2 device is to adjust the resolution to a high resolution (for example, 1080p, 2K); the compression requirement for the second compression format corresponding to the level 2 device is to use WebP high-definition image display.
[0079] Furthermore, compression requirements for each level can be further refined based on the actual transmission needs of the device's performance. For example, for target terminals of level 1 devices, a low quality factor (e.g., Quality = 60%) can be set to avoid animated images and prioritize static images. For target terminals of level 2 devices, a moderate image compression ratio (Quality = 85%) and progressive loading can be required.
[0080] For example, if the device performance is level 1, the corresponding adjustment strategy is to first compress the third multimedia file into a first display version (the first display version is a low-definition version), and then delay loading the second display version (the second display version is a high-definition version). In addition, to adapt to transmission requirements, the decoding resolution can be dynamically controlled during compression optimization to prevent memory overflow.
[0081] According to the above implementation, when the second multimedia file is an image, differentiated primary compression is first performed based on the target terminal's device level to generate a third multimedia file. The third multimedia file is then further optimized based on the compression strategy corresponding to the device's performance, ultimately generating the target multimedia file. Customizing compression parameters based on the device's screen resolution and display capabilities prevents slow loading of images on primary devices due to large size, or blurry images on secondary devices due to resolution mismatches. This ensures consistent display clarity and loading efficiency across different terminals, thereby improving the user experience for different users.
[0082] In one embodiment, based on the file type of the second multimedia file and the level of the device type of the target terminal, the second multimedia file is initially compressed to obtain a third multimedia file, including: if the file type of the second multimedia file is a video file and the level of the device type of the target terminal is a first-level device, then based on the compression requirements of the first resolution and the first frame rate corresponding to the first-level device, the second multimedia file is initially compressed to obtain a third multimedia file; if the file type of the second multimedia file is a video file and the level of the device type of the target terminal is a second-level device, then based on the compression requirements of the second resolution and the second frame rate corresponding to the second-level device, the second multimedia file is initially compressed to obtain a third multimedia file; wherein the first frame rate is less than the second frame rate; according to the adjustment strategy corresponding to the device performance, the third multimedia file is secondary compressed to obtain a target multimedia file, including: if the device performance is second-level performance, the third multimedia file is encoded using a coding format supported by the target terminal, determined as the adjustment strategy corresponding to the second-level performance, and the third multimedia file is secondary compressed and adjusted to obtain the target multimedia file.
[0083] For example, if the second multimedia file is a video file, the target terminal's device type is first determined, and then the second multimedia file is initially compressed according to the compression requirements corresponding to that level. After the initial compression yields a third multimedia file, the third multimedia file is then secondary compressed according to an adjustment policy corresponding to the target terminal's device performance to yield the target multimedia file.
[0084] Specifically, if the target terminal's device type is a Level 1 device, the first resolution compression requirement for Level 1 devices is to compress the video and adjust its resolution to 360p or lower; the first frame rate compression requirement for Level 1 devices is to adjust the frame rate to within the range of 15-24fps. If the target terminal's device type is a Level 2 device, the second resolution compression requirement for Level 2 devices is to adjust the resolution to 720p-1080p; the second frame rate compression requirement for Level 2 devices is to adjust the frame rate to 60fps.
[0085] Furthermore, compression requirements for each level can be further refined based on the actual transmission needs of the device's performance. For example, for a Level 1 target terminal, H.264 encoding can be used with a bitrate below 300kbps. For a Level 2 target terminal, if the device supports hardware decoding, H.265 (HEVC) or VP9 encoding can be used to encode the file for transmission.
[0086] For example, if the device performance is level 2, the corresponding adjustment strategy is to encode the third multimedia file using an encoding format supported by the target terminal's hardware acceleration. Furthermore, the adjustment strategy can be modified based on actual transmission requirements. For example, the adjustment strategy can be modified to reduce the frame rate (e.g., from 30fps to 24fps), dynamically adapt the bitrate, or prioritize high-load content as dynamic images (GIFs or image sequences).
[0087] According to the above implementation, when the second multimedia file is of video type, differentiated primary compression is first performed based on the level corresponding to the device performance of the target terminal to obtain a third multimedia file, and then the third multimedia file is secondary compressed based on the adjustment strategy corresponding to the device performance, and finally the target multimedia file is generated. The primary compression is based on the device level of the target terminal, so that the video initially meets the basic decoding and playback capabilities of the target device; the secondary compression further fine-tunes parameters such as frame rate, bit rate, and resolution based on the specific performance characteristics of the target device (for example, CPU main frequency, GPU decoding capabilities, memory size, resolution support, etc.) to achieve fine-grained optimization; the target multimedia file finally generated can accurately match the terminal capabilities, avoid playback anomalies (for example, freezes, decoding failures), and at the same time meet the actual usage scenarios of different users.
[0088] In one embodiment, based on the file type of the second multimedia file and the level of the device type of the target terminal, the second multimedia file is initially compressed to obtain a third multimedia file, including: if the file type of the second multimedia file is an audio file and the level of the device type of the target terminal is a first-level device, the second multimedia file is initially compressed based on the first compression format and first bit rate compression requirements corresponding to the first-level device to obtain the third multimedia file; if the file type of the second multimedia file is an audio file and the level of the device type of the target terminal is a second-level device, the second multimedia file is initially compressed based on the second compression format and second bit rate compression requirements corresponding to the first-level device to obtain the third multimedia file; wherein the first bit rate is less than the second bit rate; according to the adjustment strategy corresponding to the device performance, the third multimedia file is secondary compressed to obtain the target multimedia file, including: if the device performance is second-level performance, determining the segmented loading mechanism and the constant bit rate encoding method for encoding the third multimedia file as the adjustment strategy corresponding to the second-level performance, and performing secondary compression adjustment on the third multimedia file to obtain the target multimedia file.
[0089] For example, if the second multimedia file is an audio file, the target terminal's device type is first determined, and then the second multimedia file is initially compressed according to the compression requirements corresponding to that level. After the initial compression yields a third multimedia file, the third multimedia file is then secondary compressed according to an adjustment policy corresponding to the target terminal's device performance to yield the target multimedia file.
[0090] Specifically, if the target terminal's device type is a Level 1 device, the first compression format corresponding to the Level 1 device requires a highly compatible format (e.g., MP3 format); the first bit rate corresponding to the Level 1 device requires the bit rate to be adjusted to the range of 64kbps-96kbps. If the target terminal's device type is a Level 2 device, the second compression format corresponding to the Level 2 device requires support for a highly efficient compression format (e.g., AAC / Opus); the second bit rate corresponding to the Level 2 device requires the bit rate to be adjusted to the range of 128kbps-192kbps.
[0091] Furthermore, based on actual transmission needs, further restrictions can be added to the compression requirements for each level. For example, for the target terminals of the first-level device, the stereo effect can be disabled to avoid multi-channel audio; for the target terminals of the second-level device, channel balance optimization can be enabled.
[0092] For example, if the device performance is level 2 performance, the corresponding adjustment strategy is a segmented loading mechanism and encoding the third multimedia file using a constant bit rate (CBR) encoding method.
[0093] According to the above implementation, when the second multimedia file is of audio type, a differentiated primary compression is first performed based on the device level of the target terminal to obtain a third multimedia file. This third multimedia file is then subjected to secondary compression based on an adjustment strategy corresponding to the device performance, ultimately generating the target multimedia file. The segmented loading mechanism reduces memory usage, and combined with constant bitrate encoding (to avoid dynamic bitrate decoding fluctuations), it reduces the probability of lag on level-two performance devices, ensuring continuity in scenarios such as voice calls and music playback, thereby improving the user experience.
[0094] In another embodiment, the second multimedia file can be compressed and optimized using an intelligent compression algorithm and file format based on network bandwidth and the device performance of the target terminal, yielding the target multimedia file. This approach enables adaptive distribution of multimedia file content across multiple terminals and heterogeneous networks, improving multimedia file transmission efficiency and terminal adaptability, and boasts excellent practicality and system compatibility.
[0095] In this example, the current network broadband situation (for example, 4G network, 5G network, Wi-Fi, or mobile hotspot, etc.) is determined based on the real-time monitored network uplink or downlink speed.
[0096] In this example, when the network bandwidth is high (for example, 5 Mbps) and the device performance is high (such as a high-end smartphone): for video files, you can choose to use the HEVC video compression format to transmit high-definition video (such as 1080p) at a lower bit rate; for image files, use the WebP format to optimize images to ensure high-quality display effects; for audio files, compression is adjusted to the 32-bit, 48,000 Hz, 320 Kbps MP3 format.
[0097] In this example, when the network bandwidth is low (for example, 1 Mbps) and the device performance is low (such as a low-end smartphone): for video files, you can choose to use H.264 video encoding with a lower compression ratio to compress the video files; for image files, convert the images to JPEG format to reduce the file size and ensure fast transmission and normal display of content even under limited bandwidth; for audio files, compress and adjust to the MP2 format with 24 bits, 44100 Hz, and 192 Kbps.
[0098] Figure 2 It is a structural block diagram of a multimedia file transmission optimization device according to an embodiment of the present invention.
[0099] like Figure 2 As shown, the multimedia file transmission optimization device may include:
[0100] A file type determination module 510, configured to determine a file type of the first multimedia file based on a format of the first multimedia file;
[0101] an attribute value identification module 520 configured to determine, based on the file type of the first multimedia file, a key attribute of the first multimedia file in a preset type-attribute correspondence table, and identify the attribute value of the key attribute of the first multimedia file to obtain the attribute value of the key attribute of the first multimedia file;
[0102] a compression optimization module 530 configured to determine a corresponding first compression algorithm based on the format of the first multimedia file and the attribute values of the key attributes, and to perform compression optimization on the first multimedia file based on the first compression algorithm to obtain a second multimedia file;
[0103] a secondary compression optimization module 540 configured to, in response to a multimedia file transmission request from a target terminal, perform secondary compression optimization on the second multimedia file based on the file type of the second multimedia file and the device type and device performance of the target terminal to obtain a target multimedia file;
[0104] The transmission module 550 is configured to transmit the target multimedia file to the target terminal.
[0105] In one embodiment, the attribute value identification module 520 is specifically configured to:
[0106] If the file type of the first multimedia file is a picture file, determining in the type-attribute correspondence table that a key attribute corresponding to the picture file is resolution, determining that the key attribute of the first multimedia file is resolution, and performing resolution identification on the first multimedia file using a deep learning model to obtain a resolution value of the first multimedia file;
[0107] The compression optimization module 530 is specifically configured to:
[0108] Based on the format of the first multimedia file, it is determined whether the first multimedia file is a lossy compression file or a lossless compression file; if the first multimedia file is a lossy compression file and the resolution value of the first multimedia file is greater than or equal to a preset first threshold, the lossless compression algorithm is determined to be the first compression algorithm; if the first multimedia file is a lossless compression file and the resolution value of the first multimedia file is less than the first threshold, the lossy compression algorithm is determined to be the first compression algorithm.
[0109] In one embodiment, the attribute value identification module 520 is further configured to:
[0110] If the file type of the first multimedia file is an audio file, determining in the type-attribute correspondence table that key attributes corresponding to the audio file are sampling rate, bit depth, and channels, determining that the key attributes of the first multimedia file are sampling rate, bit depth, and channels, and performing attribute values of the sampling rate, bit depth, and channels on the first multimedia file using speech recognition technology to obtain a sampling rate value, a bit depth value, and a channel value, and determining a bit rate value of the first multimedia file based on a product of the sampling rate value, the bit depth value, and the channel value;
[0111] The compression optimization module 530 is further configured to:
[0112] Based on the format of the first multimedia file, it is determined whether the first multimedia file is a lossy compression file or a lossless compression file; if the first multimedia file is a lossy compression file and the bit rate value of the first multimedia file is greater than or equal to a preset second threshold, the lossless compression algorithm is determined to be the first compression algorithm; if the first multimedia file is a lossless compression file and the bit rate value of the first multimedia file is less than the second threshold, the lossy compression algorithm is determined to be the first compression algorithm.
[0113] In one embodiment, the attribute value identification module 520 is further configured to:
[0114] If the file type of the first multimedia file is a video file, determining in the type-attribute correspondence table that key attributes corresponding to video files are resolution, bit rate, and frame rate, and determining that the key attributes of the first multimedia file are resolution, bit rate, and frame rate; and identifying attribute values of the resolution, bit rate, and frame rate of the first multimedia file using computer vision technology to obtain a resolution value, a bit rate value, and a frame rate value of the first multimedia file;
[0115] The compression optimization module 530 is further configured to:
[0116] Based on the format of the first multimedia file, determine whether the first multimedia file is a lossy compression file or a lossless compression file; if the first multimedia file is a lossless compression file, the resolution value, bit rate value, and frame rate value of the first multimedia file are all greater than or equal to a preset third threshold, and at least one of the resolution value, bit rate value, and frame rate value of the first multimedia file is greater than a preset fourth threshold, then determine the lossy compression algorithm as the first compression algorithm; wherein the third threshold is less than the fourth threshold; if the first multimedia file is a lossy compression file, and at least one of the resolution value, bit rate value, and frame rate value of the first multimedia file is less than or equal to the preset third threshold, then determine the lossless compression algorithm as the first compression algorithm.
[0117] In one embodiment, the secondary compression optimization module 540 is specifically configured to:
[0118] Based on the file type of the second multimedia file and the level of the device type of the target terminal, the second multimedia file is initially compressed to obtain a third multimedia file, and according to the adjustment strategy corresponding to the device performance, the third multimedia file is secondary compressed to obtain the target multimedia file.
[0119] In one embodiment, the performing of the initial compression on the second multimedia file based on the file type of the second multimedia file and according to the level of the device type of the target terminal to obtain the third multimedia file is specifically performed:
[0120] If the file type of the second multimedia file is an image file and the device type of the target terminal is a first-level device, performing primary compression on the second multimedia file based on compression requirements of a first resolution and a first compression format corresponding to the first-level device to obtain the third multimedia file;
[0121] If the file type of the second multimedia file is an image file and the device type of the target terminal is a level 2 device, performing primary compression on the second multimedia file based on the compression requirements of the second resolution and the second compression format corresponding to the level 2 device to obtain the third multimedia file;
[0122] The third multimedia file is compressed twice according to the adjustment strategy corresponding to the device performance to obtain the target multimedia file, which is specifically used as follows: if the device performance is the first-level performance, the third multimedia file is first compressed into the first display version, and then the second display version is delayed and loaded. The adjustment strategy corresponding to the first-level performance is determined to compress the third multimedia file twice to obtain the target multimedia file.
[0123] In one embodiment, the performing of the initial compression on the second multimedia file based on the file type of the second multimedia file and according to the level of the device type of the target terminal to obtain the third multimedia file is specifically performed:
[0124] If the file type of the second multimedia file is a video file and the device type of the target terminal is a first-level device, performing primary compression on the second multimedia file based on compression requirements of a first resolution and a first frame rate corresponding to the first-level device to obtain the third multimedia file;
[0125] If the file type of the second multimedia file is a video file and the device type of the target terminal is a level 2 device, performing primary compression on the second multimedia file based on the compression requirements of the second resolution and second frame rate corresponding to the level 2 device to obtain the third multimedia file; wherein the first frame rate is less than the second frame rate;
[0126] The third multimedia file is compressed twice according to the adjustment strategy corresponding to the device performance to obtain the target multimedia file, which is specifically used as follows: if the device performance is level 2 performance, the third multimedia file will be encoded using the encoding format supported by the target terminal to determine the adjustment strategy corresponding to the level 2 performance, and the third multimedia file will be compressed twice to obtain the target multimedia file.
[0127] In one embodiment, the performing of the initial compression on the second multimedia file based on the file type of the second multimedia file and according to the level of the device type of the target terminal to obtain the third multimedia file is specifically performed:
[0128] If the file type of the second multimedia file is an audio file and the device type of the target terminal is a first-level device, performing primary compression on the second multimedia file based on compression requirements of a first compression format and a first bit rate corresponding to the first-level device to obtain the third multimedia file;
[0129] If the file type of the second multimedia file is an audio file and the device type of the target terminal is a level 2 device, performing primary compression on the second multimedia file based on a second compression format and a second bit rate compression requirement corresponding to the level 1 device to obtain the third multimedia file; wherein the first bit rate is less than the second bit rate;
[0130] The third multimedia file is compressed twice according to the adjustment strategy corresponding to the device performance to obtain the target multimedia file, which is specifically used as follows: if the device performance is level 2 performance, the segmented loading mechanism and the constant bit rate encoding method for encoding the third multimedia file are determined as the adjustment strategy corresponding to the level 2 performance, and the third multimedia file is compressed twice to obtain the target multimedia file.
[0131] For the description of specific functions and examples of each module and submodule of the system in the embodiment of the present invention, please refer to the relevant description of the corresponding steps in the above method embodiment, which will not be repeated here.
[0132] In the technical solution of the present invention, the acquisition, storage and application of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0133] An embodiment of the present invention further provides a multimedia file transmission optimization system, comprising:
[0134] at least one processor; and a memory communicatively coupled to the at least one processor;
[0135] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute any one of the methods in the embodiments of the present invention.
[0136] The beneficial effects of the multimedia file transmission optimization system according to the embodiment of the present invention are equivalent to the beneficial effects of the multimedia file transmission optimization method described above, and are not described in detail here.
[0137] An embodiment of the present invention further provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute any one of the methods of the embodiments of the present invention.
[0138] The beneficial effects of the storage medium of the present invention are equivalent to the beneficial effects of the above-mentioned method for optimizing the transmission of multimedia files, and are not described in detail here.
[0139] Figure 3A schematic block diagram of an example electronic device 800 that can be used to implement embodiments of the present invention is shown. Electronic device 800 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Electronic device 800 can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or claimed herein.
[0140] like Figure 3 As shown, the electronic device 800 includes a computing unit 801, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the electronic device 800 can also be stored. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0141] Multiple components in the electronic device 800 are connected to the I / O interface 805, including an input unit 806, such as a keyboard, a mouse, etc.; an output unit 807, such as various types of displays, speakers, etc.; a storage unit 808, such as a magnetic disk, an optical disk, etc.; and a communication unit 809, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 809 allows the electronic device 800 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0142] The computing unit 801 can be a variety of general-purpose and / or specialized processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units that run machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The computing unit 801 performs the various methods and processes described above, such as the multimedia file transmission optimization method. For example, in some embodiments, the multimedia file transmission optimization method can be implemented as a computer software program that is tangibly contained in a machine-readable medium, such as the storage unit 808. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 800 via the ROM 802 and / or the communication unit 809. When the computer program is loaded into the RAM 803 and executed by the computing unit 801, one or more steps of the multimedia file transmission optimization method described above can be performed. Alternatively, in other embodiments, the computing unit 801 can be configured to perform the multimedia file transmission optimization method by any other appropriate means (e.g., by means of firmware).
[0143] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system comprising at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0144] The program code for implementing the method of the present invention can be written in any combination of one or more programming languages. Such program code can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device so that when the program code is executed by the processor or controller, the functions / operations specified in the flow chart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0145] In the context of the present application, a machine-readable medium can be a tangible medium that can contain or store program for use by or in connection with an instruction execution system, apparatus, or device. Machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable medium can include, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of machine-readable storage medium would include one or more lines of electrical wire, portable computer diskette, hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or Flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the foregoing.
[0146] To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
[0147] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.
[0148] The computer system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0149] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in the present invention can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in the present invention can be achieved. This is not limited herein.
[0150] The above specific embodiments do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the principles of the present invention are intended to be included within the scope of protection of the present invention.
Claims
1. A method for optimizing the transmission of multimedia files, characterized in that: include: determining a file type of the first multimedia file based on a format of the first multimedia file; Based on the file type of the first multimedia file, determining a key attribute of the first multimedia file in a preset type attribute correspondence table, and identifying an attribute value of the key attribute on the first multimedia file to obtain an attribute value of the key attribute of the first multimedia file; Determining a corresponding first compression algorithm based on the format of the first multimedia file and the attribute value of the key attribute, and performing compression optimization on the first multimedia file based on the first compression algorithm to obtain a second multimedia file; In response to a multimedia file transmission request from a target terminal, performing secondary compression optimization on the second multimedia file based on the file type of the second multimedia file and the device type and device performance of the target terminal to obtain a target multimedia file; The target multimedia file is transmitted to the target terminal.
2. The method according to claim 1, characterized in that The step of determining, based on the file type of the first multimedia file, a key attribute of the first multimedia file in a preset type attribute correspondence table, and identifying an attribute value of the key attribute of the first multimedia file to obtain the attribute value of the key attribute of the first multimedia file includes: If the file type of the first multimedia file is a picture file, determining in the type-attribute correspondence table that a key attribute corresponding to the picture file is resolution, determining that the key attribute of the first multimedia file is resolution, and performing resolution identification on the first multimedia file using a deep learning model to obtain a resolution value of the first multimedia file; The determining a corresponding first compression algorithm based on the format of the first multimedia file and the attribute value of the key attribute includes: Based on the format of the first multimedia file, it is determined whether the first multimedia file is a lossy compressed file or a lossless compressed file; if the first multimedia file is a lossy compressed file and the resolution value of the first multimedia file is greater than or equal to a preset first threshold, the lossless compression algorithm is determined to be the first compression algorithm; if the first multimedia file is a lossless compressed file and the resolution value of the first multimedia file is less than the first threshold, the lossy compression algorithm is determined to be the first compression algorithm.
3. The method according to claim 1, characterized in that The step of determining, based on the file type of the first multimedia file, a key attribute of the first multimedia file in a preset type attribute correspondence table, and identifying an attribute value of the key attribute of the first multimedia file to obtain the attribute value of the key attribute of the first multimedia file includes: If the file type of the first multimedia file is an audio file, determining in the type-attribute correspondence table that key attributes corresponding to the audio file are sampling rate, bit depth, and channels, determining that the key attributes of the first multimedia file are sampling rate, bit depth, and channels, and performing attribute values of the sampling rate, bit depth, and channels on the first multimedia file using speech recognition technology to obtain a sampling rate value, a bit depth value, and a channel value, and determining a bit rate value of the first multimedia file based on a product of the sampling rate value, the bit depth value, and the channel value; The determining a corresponding first compression algorithm based on the format of the first multimedia file and the attribute value of the key attribute includes: Based on the format of the first multimedia file, it is determined whether the first multimedia file is a lossy compression file or a lossless compression file; if the first multimedia file is a lossy compression file and the bit rate value of the first multimedia file is greater than or equal to a preset second threshold, the lossless compression algorithm is determined to be the first compression algorithm; if the first multimedia file is a lossless compression file and the bit rate value of the first multimedia file is less than the second threshold, the lossy compression algorithm is determined to be the first compression algorithm.
4. The method according to claim 1, wherein The determining, based on the file type of the first multimedia file, a key attribute of the first multimedia file in a preset type attribute correspondence table, and identifying the attribute value of the key attribute for the first multimedia file includes: If the file type of the first multimedia file is a video file, determining in the type-attribute correspondence table that key attributes corresponding to video files are resolution, bit rate, and frame rate, and determining that the key attributes of the first multimedia file are resolution, bit rate, and frame rate; and identifying attribute values of the resolution, bit rate, and frame rate of the first multimedia file using computer vision technology to obtain a resolution value, a bit rate value, and a frame rate value of the first multimedia file; The determining a corresponding first compression algorithm based on the format of the first multimedia file and the attribute value of the key attribute includes: Based on the format of the first multimedia file, determine whether the first multimedia file is a lossy compression file or a lossless compression file; if the first multimedia file is a lossless compression file, the resolution value, bit rate value, and frame rate value of the first multimedia file are all greater than or equal to a preset third threshold, and at least one of the resolution value, bit rate value, and frame rate value of the first multimedia file is greater than a preset fourth threshold, then determine the lossy compression algorithm as the first compression algorithm; wherein the third threshold is less than the fourth threshold; if the first multimedia file is a lossy compression file, and at least one of the resolution value, bit rate value, and frame rate value of the first multimedia file is less than or equal to the preset third threshold, then determine the lossless compression algorithm as the first compression algorithm.
5. The method according to claim 1, wherein The performing secondary compression optimization on the second multimedia file based on the file type of the second multimedia file and the device type and device performance of the target terminal to obtain the target multimedia file includes: Based on the file type of the second multimedia file and the level of the device type of the target terminal, the second multimedia file is initially compressed to obtain a third multimedia file, and according to the adjustment strategy corresponding to the device performance, the third multimedia file is secondary compressed to obtain the target multimedia file.
6. The method according to claim 5, characterized in that The method of performing primary compression on the second multimedia file based on the file type of the second multimedia file and according to the level of the device type of the target terminal to obtain the third multimedia file includes: If the file type of the second multimedia file is an image file and the device type of the target terminal is a first-level device, performing primary compression on the second multimedia file based on compression requirements of a first resolution and a first compression format corresponding to the first-level device to obtain the third multimedia file; If the file type of the second multimedia file is an image file and the device type of the target terminal is a level 2 device, performing primary compression on the second multimedia file based on the compression requirements of the second resolution and the second compression format corresponding to the level 2 device to obtain the third multimedia file; The method of performing secondary compression on the third multimedia file according to the adjustment strategy corresponding to the device performance to obtain the target multimedia file includes: if the device performance is first-level performance, first compressing the third multimedia file into a first display version, and then delaying the loading of the second display version to determine the adjustment strategy corresponding to the first-level performance, and performing secondary compression on the third multimedia file to obtain the target multimedia file.
7. The method according to claim 5, characterized in that The method of performing primary compression on the second multimedia file based on the file type of the second multimedia file and according to the level of the device type of the target terminal to obtain the third multimedia file includes: If the file type of the second multimedia file is a video file and the device type of the target terminal is a first-level device, performing primary compression on the second multimedia file based on compression requirements of a first resolution and a first frame rate corresponding to the first-level device to obtain the third multimedia file; If the file type of the second multimedia file is a video file and the device type of the target terminal is a level 2 device, performing primary compression on the second multimedia file based on the compression requirements of the second resolution and second frame rate corresponding to the level 2 device to obtain the third multimedia file; wherein the first frame rate is less than the second frame rate; The method of performing secondary compression on the third multimedia file according to the adjustment strategy corresponding to the device performance to obtain the target multimedia file includes: if the device performance is secondary performance, encoding the third multimedia file in the encoding format supported by the target terminal is determined as the adjustment strategy corresponding to the secondary performance, and performing secondary compression adjustment on the third multimedia file to obtain the target multimedia file.
8. The method according to claim 5, characterized in that The method of performing primary compression on the second multimedia file based on the file type of the second multimedia file and according to the level of the device type of the target terminal to obtain the third multimedia file includes: If the file type of the second multimedia file is an audio file and the device type of the target terminal is a first-level device, performing primary compression on the second multimedia file based on compression requirements of a first compression format and a first bit rate corresponding to the first-level device to obtain the third multimedia file; If the file type of the second multimedia file is an audio file and the device type of the target terminal is a level 2 device, performing primary compression on the second multimedia file based on a second compression format and a second bit rate compression requirement corresponding to the level 1 device to obtain the third multimedia file; wherein the first bit rate is less than the second bit rate; The method of performing secondary compression on the third multimedia file according to the adjustment strategy corresponding to the device performance to obtain the target multimedia file includes: if the device performance is level 2 performance, determining the segmented loading mechanism and the use of a constant bit rate encoding method to encode the third multimedia file as the adjustment strategy corresponding to the level 2 performance, performing secondary compression adjustment on the third multimedia file, and obtaining the target multimedia file.
9. A multimedia file transmission optimization system, characterized in that: include: at least one processor; and a memory communicatively coupled to the at least one processor; The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 8.
10. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to enable a computer to execute the method according to any one of claims 1-8.