Video decoding playing method, system, storage medium and video decoding playing device
By acquiring new bitstream parameters and user needs, determining device resources and decoding capabilities, and switching playback modes to adapt to user needs, the issues of video playback stability and speed personalization are resolved, thus improving the user experience.
Patent Information
- Application Number
- CN202211633475.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-19
- Publication Date
- 2026-02-27
- Estimated Expiration
- 2042-12-19
AI Technical Summary
Existing technologies struggle to ensure stable video playback while simultaneously meeting users' personalized playback speed preferences, such as slowing down or speeding up playback.
By acquiring the bitstream parameters of the new bitstream and the user's playback requirements, the target resource value and decoding capability are determined. It is then determined whether the remaining resources and decoding capability of the device meet the target requirements. If they do, decoding and playback are performed, and the playback mode is switched according to the playback requirements to adapt to the device's capabilities.
It achieves stable video playback while meeting users' personalized playback speed needs, improving the effectiveness of decoding and playback and the user experience.
Smart Images

Figure CN115914751B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of video decoding and playing, and particularly relates to a video decoding and playing method, a video decoding and playing system, a storage medium and a video decoding and playing device. BACKGROUND
[0002] With the continuous development of multimedia technology, video recording services are becoming more and more mature. Users have higher and higher functional requirements for video recording, and typical application scenarios include previewing and playing back videos. The demand for decoding resources is similar in the playback scenario and the preview scenario, for example, to ensure the playing effect, there should be no obvious lag delay, etc., but there are also special features, for example, the user demand is to slow down the speed of playing or to speed up the speed of playing.
[0003] At present, the playing speed of a video is generally determined according to the specific platform capability, and when a user wants to play at a certain speed, how to effectively ensure stable video playing while meeting the user demand and achieving the user's expected playing effect is a problem to be considered at present. SUMMARY
[0004] Therefore, the embodiments of the present application provide a video decoding and playing method, a video decoding and playing system, a storage medium and a video decoding and playing device, which can effectively ensure stable video playing while meeting the user demand and achieving the user's expected playing effect.
[0005] A first aspect of the embodiments of the present application provides a video decoding and playing method, comprising:
[0006] obtaining a code stream parameter of a new code stream and a playing demand of a user, the new code stream being a code stream of a to-be-played channel;
[0007] determining a target resource value and a target decoding capability required for decoding the new code stream according to the code stream parameter of the new code stream and the playing demand;
[0008] judging whether the current residual resource value and the current decoding capability of the video decoding and playing device meet the target resource value and the target decoding capability;
[0009] if both meet, decoding and playing the new code stream.
[0010] In a possible implementation manner of the first aspect, the code stream parameter comprises a resolution, and original start and end times of a video frame in a video picture group and a frame number, and the playing demand comprises a playback speed.
[0011] The determining of the target resource value and the target decoding capability required for decoding the new code stream according to the code stream parameter of the new code stream and the playing demand comprises:
[0012] determine a target resource value required for decoding the new code stream according to the resolution and a preset resource value requirement table, wherein the preset resource value requirement table comprises a mapping relationship between resolutions and required resource values;
[0013] determine a target decoding capability required for decoding the new code stream according to the original start and end time, the frame number, and the playback speed.
[0014] In a possible implementation manner of the first aspect, the determining the target decoding capability required for decoding the new code stream according to the original start and end time, the frame number, and the playback speed comprises:
[0015] determine an original frame rate of the new code stream according to the original start and end time and the frame number;
[0016] determine a target frame rate of the new code stream according to the playback speed and the original frame rate;
[0017] determine the target decoding capability required for decoding the new code stream according to the target resource value and the target frame rate.
[0018] In a possible implementation manner of the first aspect, the playback requirement comprises a playback speed, the target resource value comprises a first target resource value and a second target resource value, and the target decoding capability comprises a first target decoding capability and a second target decoding capability;
[0019] when the first target resource value and the first target decoding capability are met, decode and play the new code stream, comprising:
[0020] determine whether decoding and playing the new code stream at the playback speed meets a preset playing condition when a remaining resource value and a decoding capability of the video decoding and playing device currently reach the first target resource value and the first target decoding capability;
[0021] when it is determined that the preset playing condition is met, decode and play the new code stream in a first playing mode, wherein the preset playing condition comprises that a playing rate of decoding and playing the new code stream at the playback speed is less than or equal to a preset maximum frame rate, and a number of playing channels required for decoding and playing the new code stream at the playback speed is less than or equal to a preset maximum channel number corresponding to the playback speed;
[0022] when it is determined that the preset playing condition is not met, decode and play the new code stream in a second playing mode;
[0023] when the current remaining resource value and decoding capability of the video decoding playback device do not reach the first target resource value and the first target decoding capability, but the current remaining resource value and decoding capability of the video decoding playback device reach the second target resource value and the second target decoding capability, decoding and playing the new code stream in a second playback mode.
[0024] In a possible implementation of the first aspect, the video decoding playback method further includes:
[0025] when the new code stream is decoded and played in the second playback mode, determining whether the updated remaining resource value and decoding capability reach the first target resource value and the first target decoding capability upon detecting that the current remaining resource value of the video decoding playback device is updated;
[0026] when it is determined that the updated remaining resource value and decoding capability reach the first target resource value and the first target decoding capability, re-determining whether the preset playback condition is met when the new code stream is decoded and played at the playback speed;
[0027] if the preset playback condition is met, switching the playback mode of the new code stream to the first playback mode.
[0028] In a possible implementation of the first aspect, the video decoding playback method further includes:
[0029] when the video decoding playback device has multiple screens, obtaining a resource allocation mode of the video decoding playback device;
[0030] if the resource allocation mode is an adaptive mode, obtaining historical usage information of the video decoding playback device;
[0031] allocating decoding resources to the multiple screens based on the historical usage information.
[0032] In a possible implementation of the first aspect, the historical usage information includes a historical decoding resource occupation value, and the allocating decoding resources to the multiple screens based on the historical usage information includes:
[0033] obtaining a total number of screens, allocated resource values of the screens before this resource allocation, and a total resource value in a resource pool;
[0034] respectively counting historical decoding resource occupation values accumulated by the screens in a preset time length;
[0035] determining allocable resource values of the screens according to the total number of screens, the allocated resource values of the screens, the total resource value, and the historical decoding resource occupation values.
[0036] The second aspect of the embodiment of the application provides a video decoding and playing device, which is applied to a first device, and the statistical analysis device comprises:
[0037] a code stream parameter acquisition unit, configured to acquire code stream parameters of a new code stream and a playing demand of a user, wherein the new code stream refers to a code stream of a to-be-played channel;
[0038] a resource capability determination unit, configured to determine a target resource value and a target decoding capability required for decoding the new code stream according to the code stream parameters of the new code stream and the playing demand;
[0039] a resource capability judgment unit, configured to judge whether the current residual resource value and the current decoding capability of the video decoding and playing device meet the target resource value and the target decoding capability;
[0040] a decoding and playing unit, configured to perform decoding and playing on the new code stream if both meet.
[0041] The third aspect of the embodiment of the application provides a video decoding and playing device, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the video decoding and playing method provided in the first aspect of the embodiment of the application when executing the computer program.
[0042] The fourth aspect of the embodiment of the application provides a computer readable storage medium, which stores a computer program, and the computer program implements the steps of the video decoding and playing method provided in the first aspect of the embodiment of the application when executed by a processor.
[0043] The fifth aspect of the embodiment of the application provides a computer program product, which, when executed on a terminal device, causes the terminal device to perform the steps of the video decoding and playing method provided in the first aspect of the embodiment of the application.
[0044] In the embodiment of the application, the code stream parameters of a new code stream and a playing demand of a user are acquired first, then a target resource value and a target decoding capability required for decoding the new code stream are determined according to the code stream parameters of the new code stream and the playing demand, whether the current residual resource value and the current decoding capability of the video decoding and playing device meet the target resource value and the target decoding capability are judged, and the new code stream is decoded and played if both meet. The application can decode and play according to the playing demand of a user, effectively guarantee stable video playing, meet user demand, achieve the expected playing effect of a user, improve the effectiveness of decoding and playing, and enhance user experience. BRIEF DESCRIPTION OF DRAWINGS
[0045] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or prior art description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without any creative effort based on these drawings.
[0046] Figure 1 is an implementation flowchart of the video decoding and playing method provided by the embodiments of the present application;
[0047] Figure 2 is an implementation flowchart of step S1012 in the video decoding and playing method provided by the embodiments of the present application;
[0048] Figure 3 is an implementation flowchart of determining the target decoding capability required for decoding the new code stream in the video decoding and playing method provided by the embodiments of the present application;
[0049] Figure 4 is an implementation flowchart of step S1014 in the video decoding and playing method provided by the embodiments of the present application;
[0050] Figure 5 is an implementation flowchart of switching the second playing mode to the first playing mode in the video decoding and playing method provided by the embodiments of the present application;
[0051] Figure 6 is an implementation flowchart of allocating decoding resources to the multi-screen video decoding device in the video decoding and playing method provided by the embodiments of the present application;
[0052] Figure 7 is an implementation flowchart of allocating decoding resources to the multi-screen based on the historical use information in the video decoding and playing method provided by the embodiments of the present application;
[0053] Figure 8 is a structural block diagram of the video decoding and playing system provided by the embodiments of the present application;
[0054] Figure 9 is a schematic diagram of a video decoding and playing device provided by the embodiments of the present application. DETAILED DESCRIPTION
[0055] In the following description, for purposes of explanation and not limitation, specific details are set forth such as particular architectures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. However, it will be apparent to those skilled in the art that the present application can be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known methods, processes, systems, etc. are omitted so as not to obscure the description of the present application.
[0056] In addition, in the description of the present application and the appended claims, the terms "first", "second", "third", etc. are used merely to distinguish descriptions and can not be understood as indicating or implying relative importance.
[0057] In the present application, the reference "one embodiment" or "some embodiments" means that the specific features, structures or characteristics described in connection with the embodiment are included in one or more embodiments of the present application. Therefore, the statements "in one embodiment", "in some embodiments", "in other some embodiments", "in further some embodiments" etc. appearing in different places in the specification are not necessarily all referring to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized. The terms "include", "contain", "have" and their variants mean "including but not limited to", unless otherwise specifically emphasized.
[0058] It should be understood that the various method embodiments of the present application provide a video decoding and playing method applicable to various types of video decoding and playing devices that need to perform video decoding and playing. The video decoding and playing devices can be various types of terminals with decoding, playing and storage capabilities, such as personal computers, notebook computers, smart phones, tablet computers and other computing devices, and can also be digital video recorders (DVR) or network video recorders and other video recorder devices.
[0059] The video decoding and playing method provided by the present application will be described below in conjunction with specific embodiments.
[0060] Figure 1 The implementation flow of the video decoding and playing method provided by the embodiments of the present application is shown, and the execution end of the embodiments of the present application can be a video decoding and playing device, and the video decoding and playing device has multiple channels for processing a code stream. The method flow can include the following steps S101 to S104.
[0061] Step S101: Obtain the code stream parameters of a new code stream and the playing requirements of a user, wherein the new code stream refers to the code stream of a to-be-played channel.
[0062] The play requirement of the user includes a scene type, which specifically includes preview and playback. Based on the difference of the scene type, the code stream channel includes a preview channel and a playback channel. For example, when the scene type is preview, the new code stream belongs to the preview channel, and when the scene type is playback, the new code stream belongs to the playback channel. From the perspective of resource allocation, the preview scene can be considered the same as the one-time speed playback scene. The video decoding and playing method provided in the embodiments of the present application is for the playback scene.
[0063] In the embodiments of the present application, the way of obtaining the code stream parameter of the new code stream can be to obtain the parameter frame of the new code stream in the channel, and read the parameter frame to obtain the code stream parameter of the new code stream. The code stream parameter includes the resolution of the code stream, the code stream type, and the like.
[0064] In the embodiments of the present application, the video decoding and playing device can access one or more IPCs (IP cameras).
[0065] In some embodiments, when the video decoding and playing device accesses multiple IPCs, after the access of the channels is completed, the video decoding and playing device obtains the code stream parameters of the code streams of the channels corresponding to the IPCs in a specified order. The specified order can be the number order of the channels.
[0066] Step S102: determining the target resource value and the target decoding capability required for decoding the new code stream according to the code stream parameter of the new code stream and the play requirement.
[0067] Decoding and playing the code stream requires sufficient resource value and decoding capability. In the embodiments of the present application, the target resource value and the target decoding capability required for decoding and playing the new code stream are determined according to the code stream parameter of the new code stream and the play requirement of the user.
[0068] As a possible implementation manner of the present application, the code stream parameter includes the resolution, the original start time and the frame number of the video frames in a video picture group GOP, and the play requirement includes the playback speed.
[0069] Figure 2 A specific implementation process of step S102 in the method provided in the embodiments of the present application is shown, and the details are as follows:
[0070] A1: determining the target resource value required for decoding the new code stream according to the resolution and a preset resource value requirement table, wherein the preset resource value requirement table includes a mapping relationship between the resolution and the required resource value.
[0071] In this embodiment, the video decoding and playing device is preconfigured with a preset resource value requirement table containing a mapping relationship between resolution and required resource value, the resolution and the required resource value in the preset resource value requirement table correspond to each other, and the required resource value is the minimum resource value required for decoding a code stream of the corresponding resolution. The target resource value required for decoding a new code stream can be directly determined based on the preset resource value requirement table.
[0072] A2: determining a target decoding capability required for decoding the new code stream based on the original start and end time, the frame number, and the playback speed.
[0073] In this embodiment, the decoding capability required for code streams of different playback speeds is different. The original start and end time and the frame number of a GOP can be obtained by reading the GOP header data, and then the target decoding capability required for decoding the new code stream can be determined based on the original start and end time, the frame number, and the playback speed.
[0074] As a possible implementation of the present application, Figure 3 The specific implementation process of determining the target decoding capability required for decoding the new code stream based on the original start and end time, the frame number, and the playback speed in the method embodiment provided by the embodiment of the present application is shown, and is described in detail as follows:
[0075] B1: determining the original frame rate of the new code stream based on the original start and end time and the frame number.
[0076] The video code stream is composed of a plurality of video picture groups (GOPs), each video picture group (GOP) includes I, P, and B video frames, I is an internal encoding frame and also a key frame, P is a forward prediction frame, and B is a bidirectional interpolation frame. The first key frame of each video picture group (GOP) is an I frame.
[0077] The frame numbers of the plurality of GOPs in the same video code stream are the same, and in this embodiment, the original frame rate of the new code stream can be determined based on the frame number in a GOP and the original start and end time of the GOP. Specifically, the original frame rate = frame number / (end time-start time), wherein the frame number refers to the frame number in a video picture group (GOP) in the new code stream, the start time is the timestamp of the first frame in the GOP, the end time is the timestamp of the last frame in the GOP, and the end time-start time is the original interval time between the first frame and the last frame in the GOP, that is, the original frame rate = frame number / original interval time.
[0078] B2: determining the target frame rate of the new code stream based on the playback speed and the original frame rate.
[0079] In the embodiment of the present application, the target frame rate of the new code stream is related to the original frame rate and the playback speed. The playback speed is greater than 1.
[0080] In a possible implementation, the target frame rate = frame number / (target end time - target start time), where the target end time - target start time is specifically a target interval time between a first frame and a last frame in a GOP when playing back at a playback speed in the user demand, and the target interval time = original interval time / N, where N represents the playback speed. Therefore, the target frame rate = frame number / (original interval time / N) = N * original frame rate.
[0081] In a possible implementation, a mapping relationship among the original frame rate, the playback speed, and the target frame rate is constructed in advance, and based on the mapping relationship, the target frame rate can be determined according to the original frame rate and the playback speed.
[0082] B3: determining a target decoding capability required for decoding the new code stream according to the target resource value and the target frame rate. Specifically, the target decoding capability = target resource value * target frame rate.
[0083] Speed playback has a higher requirement on the decoding capability of a device, especially when multi-channel playback is performed, the actual frame rate of a code stream will increase according to the playback speed, thereby generating a greater pressure on the decoding capability of the device. In the embodiment of the present application, after the target frame rate of the new code stream is determined based on the playback speed and the original frame rate, the target decoding capability required for decoding the new code stream is determined in combination with the target resource value and the target frame rate, which can improve the accuracy of determining the required decoding capability, and thereby effectively guarantee the effectiveness and stability of video playback.
[0084] In the embodiment of the present application, in the key frame playback mode, the target frame rate of the new code stream is a preset standard frame rate. For normal original-speed playback and slow-speed playback, that is, the playback speed is greater than 0 and less than or equal to 1, when the decoding resource is sufficient, the decoding capability is necessarily sufficient.
[0085] In a possible implementation, when the new code stream is processed by multiple channels simultaneously, the target decoding capability required for decoding the new code stream is determined according to the number of channels, the target resource value, and the target frame rate.
[0086] Step S103: determining whether the current remaining resource value and the current decoding capability of the video decoding and playing device satisfy the target resource value and the target decoding capability.
[0087] In the embodiment of the present application, whether the performance of the video decoding and playing device is sufficient to support the decoding and playing of the new code stream is determined by the comparison result of the target resource value, the target decoding capability, and the current remaining resource value and the current decoding capability of the video decoding and playing device.
[0088] Specifically, it is determined whether the current remaining resource value of the video decoding and playing device is greater than or equal to the target resource value, and if yes, it is determined that the remaining resource value is sufficient; it is determined whether the current decoding capability of the video decoding and playing device is greater than or equal to the target decoding capability, and if yes, it is determined that the current decoding capability is sufficient.
[0089] Step S104: If both are satisfied, the new code stream is decoded and played.
[0090] In the embodiments of the present application, when the remaining resource value is sufficient and the current decoding capability is sufficient, it is determined that the new code stream can be decoded and played.
[0091] When it is determined that the new code stream can be decoded and played, the remaining resource value and the current decoding capability are updated, specifically, the target resource value is deducted from the remaining resource value, and the target decoding capability is deducted from the current decoding capability.
[0092] As a possible implementation manner of the present application, the playing requirement includes a playback speed, the target resource value includes a first target resource value and a second target resource value, and the target decoding capability includes a first target decoding capability and a second target decoding capability. Figure 4 A specific implementation process of step S104 in the method provided by the embodiments of the present application is shown, and details are as follows:
[0093] C1: When the current remaining resource value and the decoding capability of the video decoding and playing device reach the first target resource value and the first target decoding capability, it is determined whether decoding and playing the new code stream at the playback speed satisfies a preset playing condition.
[0094] C2: When it is determined that the preset playing condition is satisfied, the new code stream is decoded and played in a first playing mode, wherein the preset playing condition includes that a playing rate of decoding and playing the new code stream at the playback speed is less than or equal to a preset maximum frame rate, and a number of playing channels required for decoding and playing the new code stream at the playback speed is less than or equal to a preset maximum number of channels corresponding to the playback speed.
[0095] The first playing mode is a full-frame playing mode. The first target resource value and the first decoding capability are resource values and decoding capabilities required by the full-frame playing mode.
[0096] C3: When it is determined that the preset playing condition is not satisfied, or when the current remaining resource value and the decoding capability of the video decoding and playing device do not reach the first target resource value and the first target decoding capability, but the current remaining resource value and the decoding capability of the video decoding and playing device reach the second target resource value and the second target decoding capability, the new code stream is decoded and played in a second playing mode.
[0097] The second playing mode is a key frame playing mode. The second target resource value and the second decoding capability are resource values and decoding capabilities required for the full frame playing mode.
[0098] In the embodiments of the present application, when the remaining resource value is sufficient and the current decoding capability is sufficient to meet the full frame playing mode, it is further determined whether the decoding and playing of the new code stream at the playback speed meets the preset playing condition. If yes, the decoding and playing of the new code stream at the full frame playing mode is started. When the decoding and playing of the new code stream at the playback speed does not meet the preset playing condition, or the current remaining resource value and decoding capability do not reach the first target resource value and the first target decoding capability required for the full frame playing mode, but the current remaining resource value and decoding capability of the video decoding and playing device reach the second target resource value and the second target decoding capability required for the key frame playing mode, the decoding and playing of the new code stream is performed at the key frame playing mode.
[0099] The case that the decoding and playing of the new code stream at the playback speed does not meet the preset playing condition specifically includes that the playing rate of the decoding and playing of the new code stream at the playback speed is greater than a preset maximum frame rate, and / or the number of playing channels required for the decoding and playing of the new code stream at the playback speed is greater than a preset maximum number of channels corresponding to the playback speed.
[0100] In the embodiments of the present application, when the current remaining resource value and decoding capability of the video decoding and playing device do not reach the first target resource value and the first target decoding capability, and also do not reach the second target resource value and the second target decoding capability, it is prompted that the resource is insufficient and the playing cannot be performed.
[0101] In the embodiments of the present application, the decoding and playing of the new code stream is preferentially performed at the full frame playing mode. When the current remaining resource value and decoding capability of the video decoding and playing device are insufficient to support the full frame playing mode, it is determined whether the current remaining resource value and decoding capability meet the key frame playing mode, so as to guarantee the effective playing of the video.
[0102] In a possible implementation, when the playback rate is less than the preset maximum frame rate supported and the number of channels does not reach the maximum number of channels supported at the playback speed, if it is found through calculation that the target resource value or target decoding capability required by the newly added channel in the full-frame playback mode is greater than the remaining decoding resource or decoding capability, it is further determined whether all channels (including the played channels and the newly played channels) can be switched to the key-frame playback mode, and whether the decoding resource and decoding capability are sufficient, that is, whether the sum of the decoding capability required by the key-frame playback of all playback channels is less than the total decoding capability, and if yes, the key-frame playback is switched, and if not, the current newly played channel is set to a resource insufficient state, and the user is prompted that the current playback channel is too many, the channel cannot be played, and the other played channels maintain the full-frame playback. That is, the channel cannot maintain the full-frame playback, nor can it be played by switching all channels to the key-frame playback mode, and the channel does not perform decoding and playback.
[0103] As a possible implementation of the present application, Figure 5 A specific implementation process of switching the second playback mode to the first playback mode in the method embodiment provided by the embodiment of the present application is shown, and is described in detail as follows:
[0104] D1: When the new code stream is decoded and played according to the second playback mode, when it is detected that the current remaining resource value of the video decoding and playing device is updated, it is determined whether the updated remaining resource value and decoding capability reach the first target resource value and the first target decoding capability.
[0105] D2: When it is determined that the updated remaining resource value and decoding capability reach the first target resource value and the first target decoding capability, it is determined again whether the preset playback condition is met when the new code stream is decoded and played according to the playback speed.
[0106] D3: If the preset playback condition is met, the playback mode of the new code stream is switched to the first playback mode.
[0107] When a channel ends the playing of the channel, the channel releases the resources it has applied for, at which time the current remaining resource value of the video decoding and playing device is updated, and obviously, the current decoding capability of the video decoding and playing device is also updated. When the new code stream is in the second playing mode, upon detecting the update of the current remaining resource value of the video decoding and playing device, it is determined whether the updated remaining resource value and decoding capability reach the first target resource value and the first target decoding capability, and when it is determined that the updated remaining resource value and decoding capability reach the first target resource value and the first target decoding capability, it is determined again whether the decoding and playing of the new code stream at the playback speed satisfies the preset playing condition, i.e., whether it is possible to switch to the first playing mode. Specifically, it is determined again whether the playing rate of the decoding and playing of the new code stream at the playback speed is less than or equal to the preset maximum frame rate, and whether the number of playing channels required by the decoding and playing of the new code stream at the playback speed is less than or equal to the preset maximum number of channels corresponding to the playback speed.
[0108] In some embodiments, when a channel does not record at the current time (the reasons for not recording include but are not limited to device failure, network anomaly, or restart, etc.), the resources initially applied for by the channel are also released.
[0109] In some embodiments, when the parameters of a code stream in a channel change, for example, when the resolution or type of the code stream changes, the resources are not immediately released and re-applied, but the new target resource value and the new target decoding capability are determined again according to the new code stream parameters and the playing requirements. If the current remaining resource value and the current decoding capability can satisfy the new target resource value and the new target decoding capability, there is no need to re-apply for resources, but the existing resources are kept to decode and play the code stream with the changed parameters. This prevents the resources from being grabbed by other channels that are short of resources or channels that want to switch from the second playing mode (key frame playing mode) to the first playing mode (full frame playing mode), and thus prevents the current channel from being unable to continue decoding and playing due to the change of the code stream parameters.
[0110] As a possible implementation form of the present application, Figure 6 A specific implementation process of allocating decoding resources to a multi-screen video decoding device in the method embodiment provided by the embodiments of the present application is shown, and is described in detail as follows:
[0111] E1: When the video decoding and playing device has multiple screens, the resource allocation mode of the video decoding and playing device is obtained.
[0112] In this embodiment, the resource allocation mode includes a preset allocation mode and an adaptive mode. The preset allocation mode allocates resources according to a preset allocation strategy. The adaptive mode allocates resources based on the user's usage habits.
[0113] In some embodiments, the preview effect is given priority. The preset allocation strategy includes allocation by scene type, which divides the total resource pool into two parts: a first resource pool and a second resource pool. The resources in the first resource pool are used for previewing the scene, and the resources in the second resource pool are used for replaying the scene. The resources for previewing and replaying do not affect each other.
[0114] In other implementations, the default resource allocation strategy is first-come, first-served. Different scenarios, such as preview or playback, are in competition with each other. Each screen and channel can apply for resources from the total resource pool according to the first-come, first-served principle, and resources are also released uniformly to the total resource pool.
[0115] E2: If the resource allocation mode is adaptive, then obtain the historical usage information of the video decoding and playback device. The historical usage information includes the decoding resource usage information of each screen within a preset time period.
[0116] E3: Based on the historical usage information, allocate decoding resources for the multiple screens.
[0117] In one possible implementation, the historical usage information includes historical decoding resource usage values, such as... Figure 7 As shown, the allocation of decoding resources for the multiple screens based on the historical usage information specifically includes:
[0118] E31: Get the number of screens, the resource value allocated to each screen before this resource allocation, and the total resource value in the resource pool.
[0119] E32: Calculate the cumulative historical decoding resource usage value of each screen within the preset time period.
[0120] For example, in adaptive mode, the user's decoding resource usage information for each screen over the past D days is recorded. Specifically, every hour, the decoding resource usage value of screen i for each hour is obtained, and the cumulative decoding resource usage value W of screen i on day j is calculated. j,i The weights corresponding to each day are obtained, and the weights are determined according to the time distance, that is, the longer the time has passed, the smaller the influence of historical behavior, and the smaller the weight corresponding to the day. According to the above formula (1), the resource value occupied by screen i in the most recent D days is calculated. According to the following formula (1), the cumulative decoding resource value V of screen i in the past D days is determined. i :
[0121]
[0122] Vi, j, 1≤i≤N, 1≤j≤D, N is the total number of screens, D represents a preset time, unit is day, j is the serial number of days, for example, j represents the jth day, the Dth day, 1≤j≤D, ρ i represents the decoding resource occupation value of screen i, 1≤i≤N, N is the total number of screens, D represents a preset time, unit is day, j is the serial number of days, for example, j represents the jth day, the Dth day, 1≤j≤D, ρ j represents the weight value corresponding to the jth day, 0<ρ j ≤1, ρ1is the minimum, ρ D is the maximum, W j,i represents the historical decoding resource occupation value accumulated in a day of screen i.
[0123] E33: determining the resource value that can be allocated to each screen according to the total number of screens, the resource value allocated to each screen, the total resource value and the historical decoding resource occupation value.
[0124] Exemplarily, the resource value that can be allocated to each screen in the adaptive mode is determined according to the following formula (2):
[0125]
[0126] wherein, R i represents the resource value that can be allocated to screen i in the adaptive mode, V i represents the historical decoding resource occupation value of screen i, 1≤i≤N, N is the total number of screens, R all represents the total resource value in the resource pool, Q i represents the resource value allocated to screen i before this resource allocation. If it is the first time of resource update in the adaptive mode, it is the initial allocated resource value before the adaptive mode.
[0127] In the embodiment of the application, in the adaptive mode, the resource of each screen is allocated based on the historical decoding resource of each screen considering the use habit of the user, so that the resource allocation of the multi-screen is more reasonable and efficient, the waste of the allocated resource is avoided, and the speed and effectiveness of the video decoding and playing are improved.
[0128] In a possible implementation, in the system initialization stage, the decoding resource is allocated to each screen according to a preset resource allocation strategy, and after a preset time length and / or when the accumulated historical use information of the user to the video decoding and playing device meets a preset requirement, the resource allocation mode can be automatically switched to the adaptive mode.
[0129] In a possible implementation, when the system is previewing or playing back a channel, the video decoding and playing device needs to be restarted when switching to the adaptive mode to allocate resource values to the screens, so that the screens take effect according to the resource values allocated in the adaptive mode. In some embodiments, the user can manually set the resource values allocated in the adaptive mode to take effect. In other embodiments, the video decoding and playing device can be restarted to allocate resource values to each screen.
[0130] In a possible implementation, when a user rarely uses or does not use a screen, the screen can be allocated with few resources. If the user wants to improve the use of the screen, the user can manually restore the initial settings, switch the resource allocation mode from the adaptive mode to the preset allocation mode, and restart the video decoding and playing device, so that the resources of the screens are allocated according to the preset resource allocation strategy.
[0131] In the embodiments of the present application, the code stream parameters of a new code stream and the playing requirements of a user are first acquired, and then the target resource values and the target decoding capability required for decoding the new code stream are determined according to the code stream parameters of the new code stream and the playing requirements. It is further determined whether the current remaining resource values and the current decoding capability of the video decoding and playing device meet the target resource values and the target decoding capability. If both meet, the new code stream is decoded and played. The present application can decode and play according to the playing requirements of the user, effectively guarantee the stable playing of the video, meet the user requirements, achieve the expected playing effect of the user, improve the effectiveness of the decoding and playing, and enhance the user experience.
[0132] It should be understood that the sequence numbers of the steps in each of the above embodiments do not mean the order of execution, and the execution order of each process should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0133] Corresponding to the video decoding and playing method described in the above embodiments, Figure 6 The structure block diagram of the video decoding and playing system provided by the embodiments of the present application is shown. For ease of illustration, only the parts related to the embodiments of the present application are shown.
[0134] With reference to Figure 8 The system is applied to a video decoding and playing device, and the system comprises a code stream parameter acquisition unit 81, a resource capability determination unit 82, a resource capability judgment unit 83, and a decoding and playing unit 84, wherein:
[0135] The code stream parameter acquisition unit 81 is configured to acquire the code stream parameters of a new code stream and the playing requirements of a user, wherein the new code stream refers to the code stream of a channel to be played.
[0136] The resource capability determining unit 82 is configured to determine a target resource value and a target decoding capability required for decoding the new bitstream according to the bitstream parameter of the new bitstream and the playback requirement.
[0137] The resource capability judging unit 83 is configured to judge whether the current residual resource value and the current decoding capability of the video decoding and playing device meet the target resource value and the target decoding capability.
[0138] The decoding and playing unit 84 is configured to decode and play the new bitstream if both the target resource value and the target decoding capability are met.
[0139] As a possible implementation of the present application, the bitstream parameter comprises a resolution, original start and end time of a video frame in a video picture group and a frame number, and the playback requirement comprises a playback speed; and the resource capability determining unit 82 comprises:
[0140] A target resource value determining module is configured to determine a target resource value required for decoding the new bitstream according to the resolution and a preset resource value requirement table, wherein the preset resource value requirement table comprises a mapping relationship between a resolution and a required resource value.
[0141] A target decoding capability determining module is configured to determine a target decoding capability required for decoding the new bitstream according to the original start and end time, the frame number and the playback speed.
[0142] As a possible implementation of the present application, the target decoding capability determining module specifically comprises:
[0143] An original frame rate determining sub-module is configured to determine an original frame rate of the new bitstream according to the original start and end time and the frame number.
[0144] A target frame rate determining sub-module is configured to determine a target frame rate of the new bitstream according to the playback speed and the original frame rate.
[0145] A target decoding capability determining sub-module is configured to determine a target decoding capability required for decoding the new bitstream according to the target resource value and the target frame rate.
[0146] As a possible implementation of the present application, the playback requirement comprises a playback speed, and the decoding and playing unit 84 comprises:
[0147] A first judging module is configured to determine whether decoding and playing the new bitstream at the playback speed meets a preset playing condition when the current residual resource value and the decoding capability of the video decoding and playing device reach the first target resource value and the first target decoding capability.
[0148] The first mode playing module is configured to decode and play the new code stream in a first playing mode when it is determined that the preset playing condition is met, wherein the preset playing condition comprises that a playing rate of decoding and playing the new code stream in the playback speed is less than or equal to a preset maximum frame rate, and a number of playing channels required for decoding and playing the new code stream in the playback speed is less than or equal to a preset maximum number of channels corresponding to the playback speed.
[0149] The second mode playing module is configured to decode and play the new code stream in a second playing mode when it is determined that the preset playing condition is not met, or when the current residual resource value and decoding capability of the video decoding and playing device do not reach the first target resource value and the first target decoding capability, but the current residual resource value and decoding capability of the video decoding and playing device reach the second target resource value and the second target decoding capability.
[0150] The user prompting module is configured to prompt that there is insufficient resource and the new code stream cannot be played when the current residual resource value and decoding capability of the video decoding and playing device do not reach the first target resource value and the first target decoding capability, and also do not reach the second target resource value and the second target decoding capability.
[0151] As a possible implementation of the present application, the video decoding and playing system further comprises:
[0152] The playing mode switching unit is configured to determine whether the updated residual resource value and decoding capability reach the first target resource value and the first target decoding capability when it is detected that the current residual resource value of the video decoding and playing device is updated while the new code stream is decoded and played in the second playing mode, and to re-determine whether the preset playing condition is met when the new code stream is decoded and played in the playback speed when it is determined that the updated residual resource value and decoding capability reach the first target resource value and the first target decoding capability, and to switch the playing mode of the new code stream to the first playing mode if the preset playing condition is met.
[0153] As a possible implementation of the present application, the video decoding and playing system further comprises:
[0154] The allocation mode obtaining unit is configured to obtain a resource allocation mode of the video decoding and playing device when the video decoding and playing device has multiple screens.
[0155] The history information obtaining unit is configured to obtain historical usage information of the video decoding and playing device if the resource allocation mode is an adaptive mode.
[0156] The decoding resource allocation unit is configured to allocate decoding resources to the multiple screens based on the historical usage information.
[0157] As a possible implementation of the present application, the historical usage information comprises historical decoding resource occupation values, and the decoding resource allocation unit comprises:
[0158] A screen and resource information acquisition module is configured to acquire a total number of screens, resource values allocated to each screen before the current resource allocation, and a total resource value in a resource pool.
[0159] A resource value statistics module is configured to respectively count historical decoding resource occupation values accumulated by each screen within a preset time length.
[0160] A resource value allocation module is configured to determine resource values allocable to each screen according to the total number of screens, the resource values allocated to each screen, the total resource value, and the historical decoding resource occupation values.
[0161] In the embodiments of the present application, the stream parameters of a new stream and the playing requirements of a user are acquired first, and then the target resource value and the target decoding capability required for decoding the new stream are determined according to the stream parameters of the new stream and the playing requirements, and it is determined whether the current residual resource value and the current decoding capability of the video decoding and playing device meet the target resource value and the target decoding capability, and if so, the new stream is decoded and played. The present application can decode and play according to the playing requirements of the user, effectively guarantee the stable playing of a video, meet the requirements of the user, achieve the expected playing effect of the user, improve the effectiveness of decoding and playing, and enhance the user experience.
[0162] The embodiments of the present application also provide a computer readable storage medium storing a computer program, and the computer program is executed by a processor to implement the steps of any one of the video decoding and playing methods shown in Figures 1 to 7
[0163] The embodiments of the present application also provide an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of any one of the video decoding and playing methods shown in Figures 1 to 7
[0164] The embodiments of the present application also provide a computer program product, which, when executed on a terminal device, causes the terminal device to implement the steps of any one of the video decoding and playing methods shown in Figures 1 to 7
[0165] Figure 9 This is a schematic diagram of a video decoding and playback device provided in one embodiment of this application. Figure 9 As shown, the video decoding and playback device 9 of this embodiment includes: a processor 90, a memory 91, and a computer program 92 stored in the memory 91 and executable on the processor 90. When the processor 90 executes the computer program 92, it implements the steps in the embodiments of the various video decoding and playback methods described above, for example... Figure 1 Steps S101 to S104 are shown. Alternatively, when the processor 90 executes the computer program 92, it implements the functions of each module / unit in the above system embodiments, for example... Figure 8 The functions of units 81 to 84 are shown.
[0166] The computer program 92 can be divided into one or more modules / units, which are stored in the memory 91 and executed by the processor 90 to complete this application. The one or more modules / units can be a series of computer program instruction segments capable of performing specific functions, which describe the execution process of the computer program 92 in the video decoding and playback device 9.
[0167] The processor 90 may be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.
[0168] The memory 91 can be an internal storage unit of the video decoding and playing device 9, for example, a hard disk or a memory of the video decoding and playing device 9. The memory 91 can also be an external storage device of the video decoding and playing device 9, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the video decoding and playing device 9. Further, the memory 91 can also include both the internal storage unit and the external storage device of the video decoding and playing device 9. The memory 91 is used to store the computer program and other programs and data required by the video decoding and playing device. The memory 91 can also be used to temporarily store the data that has been output or is about to be output.
[0169] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above functional units and modules is exemplified, and in actual application, the above functions can be completed by different functional units and modules according to needs, that is, the internal structure of the system is divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiment can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or software. In addition, the specific names of each functional unit and module are only for easy distinction, and do not limit the protection scope of the present application. The specific working process of the units and modules in the system can refer to the corresponding process in the foregoing method embodiments, which will not be described here.
[0170] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system and the units described above can refer to the corresponding process in the foregoing method embodiments, which will not be described here.
[0171] In the above embodiments, the description of each embodiment has its own emphasis, and the parts not described or recorded in detail in a certain embodiment can refer to the relevant description of other embodiments.
[0172] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be realized by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. A person skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0173] In the embodiments of the present application, it should be understood that the disclosed system and method can be implemented in other manners. For example, the described system embodiments are merely schematic. For example, the division of the modules or units is merely logical function division. There can be another division manner for actual implementation. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections between different units, can be indirect couplings or communication connections through some interfaces, and can be in electrical, mechanical or other forms.
[0174] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e., can be located in one place, or can be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiments.
[0175] In addition, each functional unit in the various embodiments of the present application can be integrated in one processing unit, or each unit can be a physically independent unit, or two or more units can be integrated in one unit. The integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
[0176] The integrated unit, if implemented in the form of a software functional unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, all or part of the flow of the method in the above-described embodiments can also be implemented by a computer program instructing relevant hardware to complete, and the computer program can be stored in a computer readable storage medium. When the processor executes the computer program, the steps of the above-described various method embodiments can be implemented. The computer program includes computer program code, which can be in the form of source code, object code, executable file or some intermediate form. The computer readable medium can include any entity or system capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the computer readable medium can include appropriate contents according to the requirements of legislation and patent practice in the jurisdiction, for example, in some jurisdictions, according to legislation and patent practice, the computer readable medium does not include electrical carrier signals and telecommunication signals.
[0177] The above-described embodiments are only used to illustrate the technical solutions of the present application, but not limit the present application; although the present application has been described in detail with reference to the foregoing embodiments, those ordinarily skilled in the art should understand: the technical solutions recorded in the foregoing embodiments can still be modified, or some technical features can be replaced equivalently; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.
Claims
1. A video decoding and playing method, characterized in that, The application discloses a method for playing a video decoding playing device, and the method comprises the following steps: obtaining a code stream parameter of a new code stream and a playing demand of a user, wherein the new code stream refers to a code stream of a channel to be played; determining a target resource value and a target decoding capability required for decoding the new code stream according to the code stream parameter of the new code stream and the playing demand, wherein the code stream parameter comprises a resolution, original start and end time of a video frame in a video picture group and a frame number, and the playing demand comprises a playback speed; the determination of the target resource value and the target decoding capability required for decoding the new code stream according to the code stream parameter of the new code stream and the playing demand comprises the following steps: determining the target resource value required for decoding the new code stream according to the resolution and a preset resource value demand table, wherein the preset resource value demand table comprises a mapping relationship between a resolution and a required resource value; determining the target decoding capability required for decoding the new code stream according to the original start and end time, the frame number and the playback speed, which comprises the following steps: determining an original frame rate of the new code stream according to the original start and end time and the frame number; determining a target frame rate of the new code stream according to the playback speed and the original frame rate; and determining the target decoding capability required for decoding the new code stream according to the target resource value and the target frame rate; judging whether the current residual resource value and the current decoding capability of the video decoding playing device meet the target resource value and the target decoding capability; if both meet, decoding and playing the new code stream; when the video decoding playing device has multiple screens, obtaining a resource allocation mode of the video decoding playing device, wherein the resource allocation mode comprises a preset allocation mode and an adaptive mode, the preset allocation mode is resource allocation according to a preset allocation strategy, and the adaptive mode is resource allocation according to a user's usage habit; if the resource allocation mode is the adaptive mode, obtaining historical usage information of the video decoding playing device; based on the historical usage information, allocating decoding resources to the multiple screens.
2. The method of claim 1, wherein, the target resource value comprises a first target resource value and a second target resource value, and the target decoding capability comprises a first target decoding capability and a second target decoding capability; if both meet, decoding and playing the new code stream, which comprises the following steps: when the current residual resource value and the decoding capability of the video decoding playing device meet the first target resource value and the first target decoding capability, determining whether decoding and playing the new code stream at the playback speed meets a preset playing condition; when it is determined that the preset playing condition is met, decoding and playing the new code stream in a first playing mode, wherein the preset playing condition comprises that a playing speed of decoding and playing the new code stream at the playback speed is less than or equal to a preset maximum frame rate, and a number of playing channels required for decoding and playing the new code stream at the playback speed is less than or equal to a preset maximum channel number corresponding to the playback speed. When it is determined that the preset playing condition is not met, or when the current remaining resource value and decoding capability of the video decoding and playing device do not reach the first target resource value and the first target decoding capability, but the current remaining resource value and decoding capability of the video decoding and playing device reach the second target resource value and the second target decoding capability, the new code stream is decoded and played in a second playing mode.
3. The method of claim 2, wherein, The video decoding and playing method further comprises: When the new code stream is decoded and played in the second playing mode, it is determined whether the updated remaining resource value and decoding capability reach the first target resource value and the first target decoding capability when it is detected that the current remaining resource value of the video decoding and playing device is updated; When it is determined that the updated remaining resource value and decoding capability reach the first target resource value and the first target decoding capability, it is determined again whether the new code stream decoded and played at the playback speed meets the preset playing condition; If the preset playing condition is met, the playing mode of the new code stream is switched to the first playing mode.
4. The method of claim 1, wherein, The historical usage information comprises a historical decoding resource occupation value, and the allocation of decoding resources to the multiple screens based on the historical usage information comprises: obtaining a total number of screens, resource values allocated to each screen before this resource allocation, and a total resource value in a resource pool; respectively counting historical decoding resource occupation values accumulated by each screen within a preset time length; determining resource values allocable to each screen according to the total number of screens, the resource values allocated to each screen, the total resource value, and the historical decoding resource occupation values.
5. A video decoding and playing system, characterized by comprising: The system comprises: a code stream parameter acquisition unit configured to acquire code stream parameters of a new code stream and playing requirements of a user, the new code stream being a code stream of a channel to be played; a resource capability determination unit configured to determine target resource values and target decoding capabilities required for decoding the new code stream according to the code stream parameters of the new code stream and the playing requirements, the code stream parameters comprising a resolution and original start and end times and a frame number of video frames in a video picture group, and the playing requirements comprising a playback speed; the resource capability determination unit comprises: a target resource value determination module configured to determine the target resource values required for decoding the new code stream according to the resolution and a preset resource value requirement table, wherein the preset resource value requirement table comprises a mapping relationship between resolutions and required resource values; a target decoding capability determination module configured to determine the target decoding capabilities required for decoding the new code stream according to the original start and end times, the frame number, and the playback speed; the target decoding capability determination module comprises: an original frame rate determination submodule configured to determine an original frame rate of the new code stream according to the original start and end times and the frame number; a target frame rate determination submodule configured to determine a target frame rate of the new code stream according to the playback speed and the original frame rate; and a target decoding capability determination submodule configured to determine the target decoding capabilities required for decoding the new code stream according to the target resource values and the target frame rate. The resource capability judging unit is configured to judge whether the current residual resource value and the current decoding capability of the video decoding and playing device satisfy the target resource value and the target decoding capability. The decoding and playing unit is configured to decode and play the new code stream if both conditions are satisfied. The allocation mode obtaining unit is configured to obtain a resource allocation mode of the video decoding and playing device when the video decoding and playing device has multiple screens. The resource allocation mode includes a preset allocation mode and an adaptive mode. The preset allocation mode is to allocate resources according to a preset allocation strategy, and the adaptive mode is to allocate resources according to user habits. The history information obtaining unit is configured to obtain historical use information of the video decoding and playing device if the resource allocation mode is the adaptive mode. The decoding resource allocation unit is configured to allocate decoding resources to the multiple screens based on the historical use information.
6. A video decoding playback device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein, The computer program is executed by the processor to implement the steps of the video decoding and playing method according to any one of claims 1 to 4.
7. A computer-readable storage medium storing a computer program, wherein the computer program comprises the following steps of: receiving a request for a resource from a client; determining whether the client is authorized to access the resource; and if the client is authorized to access the resource, providing the resource to the client. The computer program is executed by the processor to implement the steps of the video decoding and playing method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Decoding method, decoding equipment and computer readable storage medium
CN112714320A