Video playing method and device, electronic equipment, readable storage medium and product
Patent Information
- Application Number
- CN202411259208.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-09
- Publication Date
- 2026-09-15
- Estimated Expiration
- 2044-09-09
AI Technical Summary
随着电子设备的发展,越来越多的用户利用电子设备进行视频的播放,但在利用电子设备进行视频播放时,常常会带来较大的功耗
[0014] In this embodiment of the application, the video file of the target video is decoded using a first decoding method to obtain a decoded video file, and the target video is played based on the decoded video file. The first decoding method is determined by decoding the video file of the first video segment of the target video using at least two decoding methods respectively. For example, the first decoding method can be the decoding method with the lowest power consumption among at least two decoding methods, which can reduce the power consumption of video playback.
Smart Images

Figure CN119211643B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of electronic equipment technology, specifically relating to a video playback method, apparatus, electronic device, readable storage medium, and product. Background Technology
[0002] Electronic devices have become one of the most commonly used consumer electronics products in people's daily lives. With the development of electronic devices, more and more users are using them to play videos, but playing videos on electronic devices often results in significant power consumption. Summary of the Invention
[0003] The purpose of this application is to provide a video playback method, apparatus, electronic device, readable storage medium, and product that can reduce the power consumption of video playback.
[0004] In a first aspect, embodiments of this application provide a video playback method applied to an electronic device, the method comprising:
[0005] The target video file is decoded using a first decoding method to obtain a decoded video file; the first decoding method is determined by decoding the video file of the first video segment of the target video using at least two decoding methods respectively.
[0006] Play the target video based on the decoded video file.
[0007] Secondly, embodiments of this application provide a video playback device applied to an electronic device, the device comprising:
[0008] A decoding module is used to decode the video file of the target video using a first decoding method to obtain a decoded video file; the first decoding method is determined by decoding the video file of the first video segment of the target video using at least two decoding methods respectively;
[0009] The playback module is used to play the target video based on the decoded video file.
[0010] Thirdly, embodiments of this application provide an electronic device including a processor and a memory, the memory storing a program or instructions executable on the processor, the program or instructions, when executed by the processor, implementing the steps of the method as described in the first aspect.
[0011] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method as described in the first aspect.
[0012] Fifthly, embodiments of this application provide a chip, which includes a processor and a communication interface, the communication interface and the processor being coupled together, the processor being used to run programs or instructions to implement the steps of the method as described in the first aspect.
[0013] In a sixth aspect, embodiments of this application provide a computer program product stored in a storage medium, which is executed by at least one processor to implement the steps of the method as described in the first aspect.
[0014] In this embodiment of the application, the video file of the target video is decoded using a first decoding method to obtain a decoded video file, and the target video is played based on the decoded video file. The first decoding method is determined by decoding the video file of the first video segment of the target video using at least two decoding methods respectively. For example, the first decoding method can be the decoding method with the lowest power consumption among at least two decoding methods, which can reduce the power consumption of video playback. Attached Figure Description
[0015] Figure 1 This is one of the flowcharts for the video playback method provided in the embodiments of this application;
[0016] Figure 2 The second flowchart of the video playback method provided in the embodiments of this application;
[0017] Figure 3 A schematic diagram illustrating the principle of the video playback method provided in this application embodiment;
[0018] Figure 4 This is a schematic diagram of the structure of the video playback device provided in the embodiments of this application;
[0019] Figure 5 A schematic diagram of the structure of an electronic device provided for an embodiment of this application;
[0020] Figure 6 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0021] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.
[0022] The terms "first," "second," etc., used in this application's specification are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class, without limiting the number of objects; for example, a first object can be one or more. Furthermore, in the specification, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects have an "or" relationship.
[0023] This application provides a video playback method, apparatus, electronic device, readable storage medium, and product, which can solve the problem of high power consumption of electronic devices during video playback in related technologies.
[0024] The video playback method provided in this application will be described below with reference to specific application scenarios and embodiments.
[0025] It should be noted that the video playback method provided in this application can be executed by electronic devices such as mobile phones, tablets, laptops, PDAs, and in-vehicle electronic devices. Some embodiments of this application use electronic devices as the executing entity to illustrate the video playback method provided in this application.
[0026] Figure 1 A flowchart of a video playback method provided in an embodiment of this application is shown below. Figure 1 As shown, the video playback method may include the following steps:
[0027] S110, the video file of the target video is decoded using a first decoding method to obtain a decoded video file; the first decoding method is determined by decoding the video file of the first video segment of the target video using at least two decoding methods respectively.
[0028] In this embodiment, the target video refers to the video content that the user or system wishes to display in the current playback environment. The target video can be a video stored in the local storage of an electronic device, or a video located on a network server that needs to be downloaded or streamed via the Internet.
[0029] In the embodiments of this application, the first decoding method may refer to the decoding method that is determined to have the lowest power consumption under the current electronic device and playback conditions after a prior power consumption assessment or real-time testing among a given plurality of video decoding options.
[0030] At least two decoding methods can be broadly categorized into software decoding and hardware decoding. Software decoding refers to using general-purpose computing resources such as the central processing unit (CPU) or graphics processing unit (GPU) of an electronic device to decode video data through software algorithms. Software decoding does not rely on a specific hardware decoder, but may consume more power due to its higher computational complexity. Hardware decoding refers to using a dedicated video decoder integrated into the electronic device (such as a video processing unit (VPU)) to decode video data.
[0031] In this embodiment, a video file refers to an electronic file that stores video data. A video file may include a series of image frames and an associated audio stream (if the video contains audio). These image frames and audio streams are encoded according to a certain encoding format and compression algorithm to obtain the video file.
[0032] In this embodiment, the video file decoding process refers to converting the encoded data in the video file back into the original image frames and audio streams for real-time display and playback by electronic devices. Therefore, the decoded video file consists of image frames and audio stream data generated during the decoding process for use by electronic devices.
[0033] In one feasible implementation of this application, the electronic device can predefine a power consumption evaluation and selection mechanism. This mechanism first presets or acquires multiple available video decoding methods in real time, and prepares to attempt decoding the video file of the first video segment of the target video. In order to find the decoding method with the lowest power consumption, the electronic device can start the power consumption evaluation process during a relatively low-load period of time (such as when the device is idle or charging), or during a preprocessing stage before the user first requests to play the target video.
[0034] During the power consumption evaluation process, the electronic device decodes a small portion of the video (such as the first few seconds or a few keyframes) using each decoding method. Simultaneously, power monitoring tools record the real-time power consumption of the electronic device under each decoding method. After evaluating all decoding methods, the electronic device compares these power consumption data and selects the decoding method with the lowest power consumption as the "first decoding method."
[0035] Furthermore, electronic devices can implement a dynamic adjustment mechanism. Considering the characteristics of different videos (such as encoding format, resolution, frame rate, etc.) and the current state of the electronic device (such as battery level, heat dissipation, resource consumption by other applications, etc.), the lowest power decoding method may change. Therefore, the electronic device can re-execute the above evaluation process each time a new video is played or when the device state changes significantly, to ensure that the lowest power decoding method (i.e., the first decoding method) under the current conditions is always used.
[0036] S120, Play the target video according to the decoded video file.
[0037] In one feasible implementation of this application, the electronic device can utilize a built-in media player or framework to play the decoded video file. Specifically, the decoded video file can be passed to the player, which is responsible for rendering it onto the screen of the electronic device and simultaneously outputting audio. To optimize the playback experience, the player can also implement functions such as cache management, playback control (e.g., pause, fast forward, rewind), and volume adjustment.
[0038] Electronic devices can also select or configure the most suitable playback mode based on the characteristics of the decoded video file. For example, for high-resolution or high-frame-rate videos, electronic devices can enable hardware-accelerated rendering to reduce the CPU load and improve playback smoothness.
[0039] In addition, electronic devices can also achieve multi-screen interaction, allowing users to project decoded video content onto other display devices (such as TVs, projectors, etc.). Specifically, Wi-Fi, Bluetooth, or other wireless communication technologies can be used to transmit decoded video files from the electronic device to the target display device for playback.
[0040] In this embodiment of the application, the video file of the target video is decoded using a first decoding method to obtain a decoded video file, and the target video is played based on the decoded video file. The first decoding method is determined by decoding the video file of the first video segment of the target video using at least two decoding methods respectively. For example, the first decoding method can be the decoding method with the lowest power consumption among at least two decoding methods, which can reduce the power consumption of video playback.
[0041] In one embodiment, before decoding the target video file using the first decoding method to obtain the decoded video file, the method further includes:
[0042] When the usage scenario of the electronic device is the target scenario, the video file of the first video segment is extracted from the video file of the target video;
[0043] The video file of the first video segment is decoded using the at least two decoding methods respectively, and the first power consumption corresponding to the at least two decoding methods is obtained respectively;
[0044] The process of decoding the target video file using the first decoding method to obtain the decoded video file includes:
[0045] The target video file is decoded using the decoding method corresponding to the first target power consumption to obtain the decoded video file;
[0046] Wherein, the first target power consumption is the minimum power consumption among the first power consumptions corresponding to the at least two decoding methods.
[0047] Optionally, the usage scenario of an electronic device refers to the specific environment or situation in which a user uses the electronic device. These usage scenarios can affect various aspects of the electronic device, such as performance, power consumption, and user experience. For example, usage scenarios can include charging scenarios, idle scenarios, gaming scenarios, and video playback scenarios. Among them, the charging scenario refers to the usage scenario when the electronic device is charging. The idle scenario refers to the electronic device not currently in any active usage state.
[0048] Optionally, in the target scenario, the electronic device has sufficient time and resources to perform power consumption assessment. For example, in an idle scenario, the electronic device is inactive, and utilizing this time for power consumption assessment can ensure that the electronic device is ready with the optimal decoding method when the user needs to play the target video, improving response speed and user experience.
[0049] Optionally, the video file of the first video segment is a file corresponding to at least one video segment pre-fetched from the video file. The first video segment can be a keyframe, a key scene, or a randomly selected video segment from the video file, used for power consumption evaluation during decoding under multiple decoding methods. It should be noted that the target video file is a complete video resource, while the video file of the first video segment is a video file corresponding to a portion of the video segments pre-fetched from this complete video resource.
[0050] Optionally, in one feasible implementation of this application, if the electronic device is in a preset charging or idle scenario, the electronic device will automatically pre-fetch a video file of the first video segment from the video file of the target video to be played as a test sample. Subsequently, the electronic device can use multiple decoding methods in parallel, including software decoding, hardware decoding, and hybrid decoding (such as hardware decoding for video and software decoding for audio, or vice versa), to decode the video file of the pre-fetched first video segment.
[0051] The built-in power consumption detection module (such as a fuel gauge chip in the electronic device or a power sampling device in the circuit) collects and calculates the average power consumption of the electronic device during the decoding process under each decoding method in real time (i.e., the first power consumption). After completing the power consumption evaluation of all decoding methods, the electronic device compares these first power consumptions and selects the decoding method with the lowest power consumption (i.e., the decoding method corresponding to the first target power consumption) as the best decoding method for the target video file.
[0052] In one example, the formula for calculating the first power consumption can be as follows:
[0053]
[0054] Where P is the first power consumption of the electronic device when decoding the video file of the first video segment, and V is... i Let I be the voltage sampled at the i-th time during the decoding process of the video file containing the first video segment. i Let be the current sampled at the i-th time during the decoding process of the video file of the first video segment, and n be the number of samples taken during the decoding process of the video file of the first video segment.
[0055] Optionally, in other embodiments of this application, the first power consumption can be not only the average power consumption, but also the total power consumption. Total power consumption refers to the total power consumption consumed throughout the entire decoding process from start to finish. Therefore, when selecting the first decoding method, the decoding method with the lowest total power consumption can be selected. Alternatively, the first power consumption can also be the peak power consumption. Peak power consumption refers to the maximum power consumption reached by the electronic device at a certain instant during the decoding process. Thus, selecting the decoding method with the lowest peak power consumption as the first decoding method ensures that the device will not overheat or experience performance bottlenecks due to excessive power consumption during the decoding process.
[0056] Optionally, in other embodiments of this application, a first decoding method can be selected based on the power efficiency ratio corresponding to each decoding method. The power efficiency ratio refers to the ratio between decoding performance (such as decoding speed and decoding quality) and power consumption. Selecting the decoding method with the optimal power efficiency ratio means that better decoding performance can be obtained under the same power consumption, or lower power consumption under the same decoding performance.
[0057] In these alternative embodiments, by intelligently determining the usage scenario of the electronic device, power consumption tests of multiple decoding methods are performed on at least a portion of the video segments of the video file in advance, and the decoding method with the lowest power consumption is selected as the decoding method for the target video file, thereby minimizing the power consumption of the electronic device.
[0058] In one embodiment, the video file of the target video includes a video data stream and an audio data stream;
[0059] Before decoding the target video file using the first decoding method to obtain the decoded video file, the method further includes:
[0060] The video data stream of the first video segment is decoded using the at least two decoding methods respectively, and the second power consumption corresponding to the at least two decoding methods is obtained respectively;
[0061] The audio data stream corresponding to the first video segment is decoded using the at least two decoding methods respectively, to obtain the third power consumption corresponding to the at least two decoding methods respectively;
[0062] The process of decoding the target video file using the first decoding method to obtain the decoded video file includes:
[0063] The video data stream of the target video is decoded using the decoding method corresponding to the second target power consumption, and the audio data stream of the target video is decoded using the decoding method corresponding to the third target power consumption to obtain the decoded video file;
[0064] Wherein, the second target power consumption is the minimum power consumption among at least two second power consumptions, and the third target power consumption is the minimum power consumption among at least two third power consumptions.
[0065] Optionally, the video data stream is the portion of the video file that contains the video content and is responsible for presenting the dynamic changes of the image. The video data stream contains all the frame data that make up the video frame. These frame data are arranged in a certain time sequence, and when they are played continuously, they form the video frame of the target video.
[0066] Optionally, the audio data stream is the portion of the video file that contains audio content, responsible for playing sound synchronized with the video visuals. The audio data stream can include speech, music, ambient sound effects, etc. Together with the video data stream, the audio data stream constitutes the complete video file.
[0067] Optionally, in one feasible implementation of this application, for the video data stream of the first video segment, the electronic device uses multiple decoding methods to decode it, and measures the second power consumption under each decoding method. Finally, the decoding method with the lowest power consumption (i.e. the decoding method corresponding to the second target power consumption) is selected as the decoding strategy for the video data stream.
[0068] Similarly, for the audio data stream corresponding to the first video segment, the electronic device also uses multiple decoding methods to decode it, and measures the third power consumption under each decoding method. The decoding method with the lowest power consumption (i.e. the decoding method corresponding to the third target power consumption) is selected as the decoding strategy for the audio data stream.
[0069] Finally, the electronic device decodes the video and audio data streams according to the selected decoding methods corresponding to the second and third target power consumptions, respectively. Then, it merges the decoded video and audio data streams to generate and play the decoded complete video file. It should be noted that the second and third power consumptions can be one of average power consumption, total power consumption, or peak power consumption. For details on how to select the decoding method with the lowest power consumption, please refer to the description in the above embodiments; this application will not repeat it here.
[0070] In these alternative embodiments, through power consumption assessment and the selection process of video and audio data stream decoding methods, the electronic device can ensure that the video and audio data streams are decoded in a way that minimizes power consumption when playing the entire target video, thereby effectively extending the battery life of the electronic device without sacrificing playback quality.
[0071] In one embodiment, such as Figure 2 As shown, the process of decoding the target video file using the first decoding method to obtain the decoded video file includes:
[0072] S111, using the first decoding method, decode the video files of the M video segments of the target video to obtain the decoded video file; the M video segments are video segments to be played.
[0073] The method further includes:
[0074] S112, the processor of the electronic device is switched to low power mode.
[0075] Optionally, in one feasible implementation of this application, the electronic device first locates the video segment where the current playback progress is located and obtains the video file corresponding to the video segment where the current playback progress is located. Then, the electronic device selects and decodes M video segments immediately following the video segment where the current playback progress is located, according to a first decoding method. It should be noted that the target video can be pre-divided into N smaller video segments to facilitate segmented decoding processing.
[0076] During the decoding process, the electronic device monitors the decoding progress in real time. Once the decoding of M video segments is complete, these decoded video segments are immediately sent to the buffer for subsequent playback. Simultaneously, the electronic device automatically switches its processor to a low-power mode to reduce power consumption. This low-power mode remains in place until more video segments need to be decoded for continued playback, at which point the processor is awakened and resumes operation.
[0077] In these alternative embodiments, the video is segmented into multiple segments, decoded on demand, and the processor is automatically switched to a low-power mode after decoding is completed by monitoring the decoding progress in real time. This effectively reduces the processor's idle power consumption, thereby significantly improving the device's energy efficiency. This dynamic power management strategy not only extends the device's battery life but also reduces unnecessary energy waste and lowers the power consumption of electronic devices during video playback.
[0078] S113, when the processor of the electronic device has been in low-power mode for a period of time up to the target duration and the M video segments have not been played completely, the video files of the Q video segments of the target video are decoded using the first decoding method to obtain the decoded video files; the Q video segments are the video segments after the M video segments in the target video.
[0079] Optionally, in one feasible implementation of this application, after the electronic device completes decoding of M video segments and switches the processor to low-power mode, a timer is simultaneously started to monitor the duration of the low-power mode. If the M video segments have not been fully played within the preset target duration, the electronic device will anticipate subsequent playback needs and wake up the processor in advance.
[0080] Subsequently, the electronic device will continue to decode the Q video segments immediately following the M video segments in the target video, according to the first decoding method. Here, the selection of the Q video segments is determined based on the current playback progress and the estimated playback speed to ensure that there is sufficient decoding time to decode the Q video segments within the remaining time of playing the M video segments.
[0081] After the Q video segments are decoded, these decoded Q video segments are also sent to the buffer. The processor then enters a low-power mode again after completing the decoding task, waiting for the next wake-up and decoding request. Through this pre-decoding and dynamic adjustment strategy, electronic devices can further optimize energy efficiency while ensuring smooth video playback.
[0082] In these alternative embodiments, pre-decoding and dynamic adjustment strategies significantly improve the smoothness of video playback and the device's battery life.
[0083] In one embodiment, the method further includes:
[0084] When the playback progress of the M video segments reaches the target progress, the video files of the R video segments in the target video are decoded using the first decoding method to obtain the decoded video files; the R video segments are the video segments after the M video segments in the target video.
[0085] Optionally, in one feasible implementation of this application, during the playback of M video segments, the electronic device not only monitors the playback progress of the M video segments but also maintains a decoding queue containing R video segments following the M video segments to be decoded. Once the M video segments reach a preset target progress (such as a specific time point, percentage, or keyframe), the electronic device immediately wakes up the processor from low-power mode and quickly decodes the R video segments in the decoding queue. After decoding, the decoded R video segments are sent to the buffer, and the processor then switches back to low-power mode to save energy.
[0086] Meanwhile, the electronic device continuously monitors the playback progress of the R video segments. When the R video segments reach the preset target playback progress, the above process repeats: the processor is woken up, decodes the video segments immediately following the R video segments, and then re-enters low-power mode. This process loops continuously until all video segments in the video file have been decoded. The next batch of video segments is decoded in advance in each loop to ensure continuous and smooth playback.
[0087] Alternatively, in another feasible implementation of this application, such as Figure 3 As shown, the target video can first be divided into multiple video segments, for example, according to... Figure 3 As shown, the target video is divided into 12 independent video segments.
[0088] Next, the electronic device determines the current playback mode. If the current playback mode is normal playback mode, the electronic device selects several video segments (i.e., M video segments) following the currently playing video segment for decoding, and sends the decoded video segments to the buffers of the display and audio playback devices. After completing these operations, the processor enters a low-power mode. When the decoded video segments reach a preset progress point, the electronic device selects adjacent video segments for decoding again.
[0089] If playback is currently paused, the electronic device will stop the decoding unit from working. Similarly, if playback has ended, the electronic device will also stop the decoding unit and terminate the entire playback process. This not only avoids continuous operation of the processor and decoding unit but also saves power when video playback is stopped or exited midway, as unplayed video portions are not decoded.
[0090] Optionally, the target video being in normal playback mode means that the video plays continuously from beginning to end according to the user's or a preset time sequence. In normal playback mode, the target video is decoded and played one segment after another in the order they are segmented until the entire video is played. The opposite of normal playback mode are pause mode or exit playback mode. Pause mode temporarily stops video decoding and playback, while exit playback mode completely stops video decoding and playback, ending the playback process.
[0091] In these alternative embodiments, when M video segments reach a preset target playback progress, the electronic device can pre-decode the subsequent R video segments, ensuring the continuity of video playback and avoiding stuttering caused by decoding delays. Simultaneously, this strategy optimizes the energy management of the electronic device by switching the processor to a low-power mode during non-decoding periods, effectively reducing the overall power consumption of the device. Furthermore, dynamically adjusting the decoding plan according to the actual progress of video playback achieves efficient resource utilization, further reducing power consumption during video playback.
[0092] In one embodiment, the method further includes:
[0093] If the target video is in the target playback state, stop decoding the video file of the target video.
[0094] Optionally, the playback status of the target video refers to the specific state of the currently playing target video. Playback status can include normal playback, paused, fast forward / rewind, mute playback, background playback, etc.
[0095] Optionally, the target state refers to a specific state within these playback states where the electronic device defines the need to stop decoding. Target states can include scenarios such as the user actively pausing playback, the user stopping playback, the video entering background playback, and the user not interacting with it for an extended period.
[0096] Optionally, in one feasible implementation of this application, the electronic device monitors the playback status of the target video in real time and identifies whether the current playback status is a preset "target status" through a built-in status detection mechanism. Once the playback status of the target video is detected to be the target status, the electronic device immediately triggers a stop decoding command. This command notifies the decoding unit to stop further decoding operations on the current video file, and can also put the decoding unit into standby or low-power mode.
[0097] In these alternative embodiments, by monitoring the video playback status in real time and stopping decoding when a specific target state is reached, unnecessary consumption of computing resources and energy waste are effectively reduced, thereby improving the operating efficiency and battery life of electronic devices.
[0098] In one embodiment, the video file of the target video includes a video data stream; the target state is a background playback state.
[0099] The step of stopping decoding the video file of the target video when the playback state of the target video is the target state includes:
[0100] When the target video is playing in the background, the first decoding unit of the electronic device is controlled to be in a non-working state. The first decoding unit is used to decode the video data stream.
[0101] Optionally, when the playback status is in background playback mode, meaning the electronic device has been switched to another application or screen, but the target video continues to play (possibly in another window or tab). In this state, the user may not be able to directly see the video, but can still hear the audio (if it is not muted).
[0102] Optionally, when the electronic device is in a screen-off state, the user cannot directly watch the video content, and continuing to decode the video file at this time would consume unnecessary power. Therefore, stopping the decoding operation of the first decoding unit when the electronic device is in a screen-off state can significantly reduce the device's power consumption, thereby extending battery life.
[0103] Optionally, in one feasible implementation of this application, when the target video is detected to be playing in the background or the electronic device is in a screen-off state, the electronic device will stop the operation of the first decoding unit responsible for decoding the video data stream and put the display path components related to the first decoding unit into a low-power mode. This decision not only avoids or reduces unnecessary video data stream decoding operations when the user cannot directly view the video screen, but also significantly reduces overall energy consumption by putting the first decoding unit and its related display path components into a low-power mode.
[0104] In these alternative embodiments, by stopping the decoding of the video data stream by the first decoding unit in a specific state, unnecessary consumption of computing resources can be effectively reduced, device power consumption can be lowered, battery life can be extended, and the overall energy efficiency ratio of the electronic device can be improved.
[0105] In one embodiment, the video file of the target video includes an audio data stream; the target state is a silent playback state;
[0106] The step of stopping decoding the video file of the target video when the playback state of the target video is the target state includes:
[0107] When the target video is in a mute playback state, the second decoding unit of the electronic device is in a non-working state, and the second decoding unit is used to decode the audio data stream.
[0108] Optionally, when the target video is playing silently, the user has turned off the audio portion of the video but still wants to watch the video content. In this state, although decoding the audio data stream is no longer necessary, decoding the video data stream still needs to continue to ensure smooth playback.
[0109] Optionally, in this embodiment of the application, when the target video is detected to be in a silent playback state, the electronic device will turn off the audio decoding unit (i.e., the second decoding unit) and power-consuming devices on the audio path, such as audio power amplifiers and headphones, thereby further reducing the power consumption of the electronic device.
[0110] In these alternative embodiments, when the target video is in a silent playback state, stopping the decoding of the audio data stream and controlling the second decoding unit to enter a non-working state can effectively reduce the processing burden and energy consumption of the electronic device.
[0111] It should be noted that the various optional implementation methods described in the embodiments of this application can be combined with each other or implemented individually without conflict, and the embodiments of this application do not limit this.
[0112] The video playback method provided in this application can be executed by a video playback device. This application uses a video playback device executing the video playback method as an example to illustrate the wireless network connection device provided in this application.
[0113] Figure 4 This is a schematic diagram of the structure of a video playback device provided in an embodiment of this application.
[0114] like Figure 4 As shown, the video playback device is applied to an electronic device, and the video playback device 400 may include:
[0115] The decoding module 401 is used to decode the video file of the target video using a first decoding method to obtain a decoded video file; the first decoding method is determined by decoding the video file of the first video segment of the target video using at least two decoding methods respectively;
[0116] The playback module 402 is used to play the target video according to the decoded video file.
[0117] In some embodiments, the video playback device 400 further includes an acquisition module:
[0118] The acquisition module is used to extract the video file of the first video segment from the video file of the target video when the usage scenario of the electronic device is the target scenario.
[0119] The decoding module 401 is further configured to decode the video file of the first video segment using the at least two decoding methods respectively, and obtain the first power consumption corresponding to the at least two decoding methods respectively;
[0120] The decoding module 401 decodes the target video file using a first decoding method, and the resulting decoded video file specifically includes:
[0121] The decoding module 401 is further configured to decode the video file of the target video using the decoding method corresponding to the first target power consumption, and obtain the decoded video file;
[0122] Wherein, the first target power consumption is the minimum power consumption among the first power consumptions corresponding to the at least two decoding methods.
[0123] In some embodiments, the video file includes a video data stream and an audio data stream;
[0124] The decoding module 401 is further configured to decode the video data stream of the first video segment using the at least two decoding methods respectively, and obtain the second power consumption corresponding to the at least two decoding methods respectively;
[0125] The decoding module 401 is further configured to decode the audio data stream corresponding to the first video segment using the at least two decoding methods respectively, and obtain the third power consumption corresponding to the at least two decoding methods respectively;
[0126] The decoding module 401 decodes the target video file using a first decoding method, and the resulting decoded video file specifically includes:
[0127] The decoding module 401 is further configured to decode the video data stream of the target video using the decoding method corresponding to the second target power consumption, and to decode the audio data stream of the target video using the decoding method corresponding to the third target power consumption, to obtain a decoded video file;
[0128] Wherein, the second target power consumption is the minimum power consumption among at least two second power consumptions, and the third target power consumption is the minimum power consumption among at least two third power consumptions.
[0129] In some embodiments, the video playback device further includes a switching module;
[0130] The decoding module 401 decodes the target video file using a first decoding method, and the resulting decoded video file specifically includes:
[0131] The decoding module 401 is further configured to decode the video file of the M video segments of the target video using the first decoding method to obtain the decoded video file; the M video segments are video segments to be played.
[0132] The switching module is used to switch the processor of the electronic device to a low-power mode.
[0133] In some embodiments, the decoding module 401 is further configured to decode the video file of Q video segments of the target video using the first decoding method when the processor of the electronic device is in low-power mode for a target duration and the M video segments have not been played completely, thereby obtaining a decoded video file; the Q video segments are video segments after the M video segments in the target video.
[0134] In some embodiments, the decoding module 401 is further configured to, when the playback progress of the M video segments reaches the target progress, use the first decoding method to decode the video file of R video segments in the target video to obtain a decoded video file; the R video segments are the video segments after the M video segments in the target video.
[0135] In some embodiments, the video playback device further includes:
[0136] The processing module is used to stop decoding the video file of the target video when the playback state of the target video is the target state.
[0137] In some embodiments, the video file of the target video includes a video data stream; the target state is a background playback state;
[0138] The processing module stops decoding the video file of the target video when the playback state of the target video is the target state, specifically including:
[0139] The processing module is further configured to control the first decoding unit of the electronic device to be in a non-working state when the target video is in a background playback state, the first decoding unit being used to decode the video data stream.
[0140] In some embodiments, the video file of the target video includes an audio data stream; the target state is a silent playback state;
[0141] The processing module stops decoding the video file of the target video when the playback state of the target video is the target state, specifically including:
[0142] The processing module is further configured to control the second decoding unit of the electronic device to be in a non-working state when the playback state of the target video is a silent playback state, and the second decoding unit is used to decode the audio data stream.
[0143] The video playback device in this application embodiment can be an electronic device or a component within an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices besides a terminal. The device can be a mobile electronic device or a non-mobile electronic device. For example, mobile electronic devices can be mobile phones, tablets, laptops, handheld computers, in-vehicle electronic devices, mobile internet devices (MIDs), augmented reality (AR) / virtual reality (VR) devices, robots, wearable devices, ultra-mobile personal computers (UMPCs), netbooks, or personal digital assistants (PDAs), etc. Non-mobile electronic devices can also be servers, network attached storage (NAS), personal computers (PCs), televisions (TVs), ATMs, or self-service machines, etc. This application embodiment does not specifically limit the specific devices.
[0144] The video playback device in this application embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit the specific operating system used.
[0145] The video playback device provided in this application embodiment can implement all the processes implemented in the video playback method embodiment, and will not be described again here to avoid repetition.
[0146] Optionally, such as Figure 5 As shown, this application embodiment also provides an electronic device 500, including a processor 501 and a memory 502. The memory 502 stores a program or instructions that can be executed on the processor 501. When the program or instructions are executed by the processor 501, they implement the various process steps of the above-described video playback method embodiment and can achieve the same technical effect. To avoid repetition, they will not be described again here.
[0147] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.
[0148] Figure 6 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of this application.
[0149] The electronic device 600 includes, but is not limited to, components such as: radio frequency unit 601, network module 602, audio output unit 603, input unit 604, sensor 605, display unit 606, user input unit 607, interface unit 608, memory 609, and processor 610.
[0150] Those skilled in the art will understand that the electronic device 600 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 610 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 6 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.
[0151] The processor 610 is used to decode the video file of the target video using a first decoding method to obtain a decoded video file; the first decoding method is determined by decoding the video file of the first video segment of the target video using at least two decoding methods respectively.
[0152] Play the target video based on the decoded video file.
[0153] In some embodiments, the processor 610 is further configured to: extract the video file of the first video segment from the video file of the target video when the usage scenario of the electronic device is the target scenario;
[0154] The video file of the first video segment is decoded using the at least two decoding methods respectively, and the first power consumption corresponding to the at least two decoding methods is obtained respectively;
[0155] The target video file is decoded using the decoding method corresponding to the first target power consumption to obtain the decoded video file;
[0156] Wherein, the first target power consumption is the minimum power consumption among the first power consumptions corresponding to the at least two decoding methods.
[0157] In some embodiments, the video file of the target video includes a video data stream and an audio data stream; the processor 610 is further configured to: decode the video data stream of the first video segment using the at least two decoding methods respectively, and obtain the second power consumption corresponding to the at least two decoding methods respectively;
[0158] The audio data stream corresponding to the first video segment is decoded using the at least two decoding methods respectively, and the third power consumption corresponding to the at least two decoding methods is obtained.
[0159] In some embodiments, the processor 610 is further configured to: decode the video data stream of the target video using a decoding method corresponding to a second target power consumption, and decode the audio data stream of the target video using a decoding method corresponding to a third target power consumption, to obtain a decoded video file;
[0160] Wherein, the second target power consumption is the minimum power consumption among at least two second power consumptions, and the third target power consumption is the minimum power consumption among at least two third power consumptions.
[0161] In some embodiments, the processor 610 is further configured to: decode the video files of M video segments of the target video using the first decoding method to obtain a decoded video file; the M video segments are video segments to be played.
[0162] Switch the processor of the electronic device to a low-power mode.
[0163] In some embodiments, the processor 610 is further configured to: when the processor of the electronic device is in a low-power mode for a target duration and the M video segments have not been played completely, decode the video files of the Q video segments of the target video using the first decoding method to obtain a decoded video file; the Q video segments are the video segments after the M video segments in the target video.
[0164] In some embodiments, the processor 610 is further configured to: when the playback progress of the M video segments reaches the target progress, decode the video files of R video segments in the target video using the first decoding method to obtain a decoded video file; the R video segments are video segments after the M video segments in the target video.
[0165] In some embodiments, the processor 610 is further configured to: stop decoding the video file of the target video when the playback state of the target video is the target state.
[0166] In some embodiments, the video file of the target video includes a video data stream; the target state is a background playback state; the processor 610 is further configured to: when the playback state of the target video is a background playback state, control the first decoding unit of the electronic device to be in a non-working state, the first decoding unit being used to decode the video data stream.
[0167] In some embodiments, the video file of the target video includes an audio data stream; the target state is a silent playback state; the processor 610 is further configured to: when the playback state of the target video is a silent playback state, control the second decoding unit of the electronic device to be in a non-working state, the second decoding unit being used to decode the audio data stream.
[0168] It should be understood that, in this embodiment, the input unit 604 may include a graphics processing unit (GPU) 6041 and a microphone 6042. The GPU 6041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 606 may include a display panel 6061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, or the like. The user input unit 607 includes at least one of a touch panel 6071 and other input devices 6072. The touch panel 6071 is also called a touch screen. The touch panel 6071 may include two parts: a touch detection device and a touch controller. Other input devices 6072 may include, but are not limited to, a physical keyboard, function keys (such as volume control buttons, power buttons, etc.), a trackball, a mouse, and a joystick, which will not be described in detail here.
[0169] The memory 609 can be used to store software programs and various data, including but not limited to application programs and operating systems. The memory 609 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 609 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 609 in this embodiment includes, but is not limited to, these and any other suitable types of memory.
[0170] Processor 610 may include one or more processing units; optionally, processor 610 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may not be integrated into processor 610.
[0171] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described video playback method embodiments and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0172] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
[0173] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above video playback method embodiments and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0174] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.
[0175] This application provides a computer program product, which is stored in a storage medium and executed by at least one processor to implement the various processes of the video playback method embodiments described above, and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0176] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
[0177] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0178] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. A video playback method, applied to an electronic device, characterized in that, include: When the usage scenario of the electronic device is the target scenario, the video file of the first video segment is extracted from the video file of the target video. The video file of the first video segment is decoded using at least two decoding methods respectively, and the first power consumption corresponding to the at least two decoding methods is obtained respectively; The target video file is decoded using the decoding method corresponding to the first target power consumption to obtain the decoded video file; wherein, the first target power consumption is the minimum power consumption among the first power consumptions corresponding to the at least two decoding methods respectively; Play the target video based on the decoded video file.
2. The method according to claim 1, characterized in that, The target video file includes a video data stream and an audio data stream; The method further includes: The video data stream of the first video segment is decoded using the at least two decoding methods respectively, and the second power consumption corresponding to the at least two decoding methods is obtained respectively; The audio data stream corresponding to the first video segment is decoded using the at least two decoding methods respectively, to obtain the third power consumption corresponding to the at least two decoding methods respectively; The video data stream of the target video is decoded using the decoding method corresponding to the second target power consumption, and the audio data stream of the target video is decoded using the decoding method corresponding to the third target power consumption to obtain the decoded video file; Wherein, the second target power consumption is the minimum power consumption among at least two second power consumptions, and the third target power consumption is the minimum power consumption among at least two third power consumptions.
3. The method according to claim 1, characterized in that, The step of decoding the target video file using the decoding method corresponding to the first target power consumption to obtain the decoded video file includes: The video files of M video segments of the target video are decoded using a first decoding method to obtain a decoded video file; the M video segments are video segments to be played; the first decoding method is determined by decoding the video files of the first video segment of the target video using at least two decoding methods respectively; The method further includes: Switch the processor of the electronic device to a low-power mode.
4. The method according to claim 3, characterized in that, The method further includes: When the processor of the electronic device has been in low-power mode for the target duration and the M video segments have not been played completely, the first decoding method is used to decode the video files of the Q video segments of the target video to obtain the decoded video files; the Q video segments are the video segments after the M video segments in the target video.
5. The method according to claim 3, characterized in that, The method further includes: When the playback progress of the M video segments reaches the target progress, the video files of the R video segments in the target video are decoded using the first decoding method to obtain the decoded video files; the R video segments are the video segments after the M video segments in the target video.
6. The method according to any one of claims 1-5, characterized in that, The method further includes: If the target video is in the target playback state, stop decoding the video file of the target video.
7. The method according to claim 6, characterized in that, The target video file includes a video data stream; the target state is a background playback state. The step of stopping decoding the video file of the target video when the playback state of the target video is the target state includes: When the target video is playing in the background, the first decoding unit of the electronic device is controlled to be in a non-working state. The first decoding unit is used to decode the video data stream.
8. The method according to claim 6, characterized in that, The target video file includes an audio data stream; the target state is a silent playback state. The step of stopping decoding the video file of the target video when the playback state of the target video is the target state includes: When the target video is in a mute playback state, the second decoding unit of the electronic device is in a non-working state, and the second decoding unit is used to decode the audio data stream.
9. A video playback device, characterized in that, Applied to electronic devices, the device includes: The acquisition module is used to extract the video file of the first video segment from the video file of the target video when the usage scenario of the electronic device is the target scenario; The decoding module is used to decode the video file of the first video segment in real time using at least two decoding methods to obtain the first power consumption corresponding to the at least two decoding methods respectively; and to decode the video file of the target video using the decoding method corresponding to the first target power consumption to obtain the decoded video file; wherein, the first target power consumption is the minimum power consumption among the first power consumptions corresponding to the at least two decoding methods respectively; The playback module is used to play the target video based on the decoded video file.
10. The apparatus according to claim 9, characterized in that, The video file includes a video data stream and an audio data stream; The decoding module is further configured to decode the video data stream of the first video segment using the at least two decoding methods respectively, and obtain the second power consumption corresponding to the at least two decoding methods respectively; The decoding module is further configured to decode the audio data stream corresponding to the first video segment using the at least two decoding methods respectively, and obtain the third power consumption corresponding to the at least two decoding methods respectively; The decoding module is further configured to decode the video data stream of the target video using the decoding method corresponding to the second target power consumption, and to decode the audio data stream of the target video using the decoding method corresponding to the third target power consumption, to obtain the decoded video file; Wherein, the second target power consumption is the minimum power consumption among at least two second power consumptions, and the third target power consumption is the minimum power consumption among at least two third power consumptions.
11. The apparatus according to claim 9, characterized in that, The device also includes a switching module; The decoding module decodes the target video file using the decoding method corresponding to the first target power consumption, and the decoded video file specifically includes: The decoding module is further configured to decode the video files of M video segments of the target video using a first decoding method to obtain a decoded video file; the M video segments are video segments to be played; the first decoding method is determined by decoding the video files of the first video segment of the target video using at least two decoding methods respectively; The switching module is used to switch the processor of the electronic device to a low-power mode.
12. The apparatus according to claim 11, characterized in that, The decoding module is further configured to, when the processor of the electronic device is in low-power mode for a target duration and the M video segments have not been played completely, use the first decoding method to decode the video files of the Q video segments of the target video to obtain the decoded video file; the Q video segments are the video segments after the M video segments in the target video.
13. The apparatus according to claim 11, characterized in that, The decoding module is further configured to, when the playback progress of the M video segments reaches the target progress, use the first decoding method to decode the video files of R video segments in the target video to obtain the decoded video file; the R video segments are the video segments after the M video segments in the target video.
Citation Information
Patent Citations
Decoding method and apparatus, and device
CN109309879A
Video decoding method and device, electronic equipment and readable storage medium
CN114390336A