A method for playing video content and related devices
By cached the set of frames of adjacent keyframes, the video content is decoded and output, which solves the problem of black screen when switching the video player interface, and achieves seamless switching and smoothness.
Patent Information
- Application Number
- CN202111389755.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-22
- Publication Date
- 2025-07-22
- Estimated Expiration
- 2041-11-22
AI Technical Summary
When switching interfaces, existing video players need to restart the decoder for video rendering, which will take a long time and cause a long black screen, affecting the smoothness of the video content.
By cached the frame sets between adjacent keyframes to cooperate as an image group, respond to the interface update event, decode and output the target image to the target interface in turn, avoid restarting the decoder and achieving seamless switching.
Improve the smoothness of switching video content in multiple interfaces, avoid black screen phenomenon, and ensure rapid update of the picture.
Smart Images

Figure CN116156232B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular, to a method for playing video content and related devices. Background Art
[0002] With the rapid development of Internet technology, people have higher and higher requirements for controlling media content. Among them, controlling the playback of video content is a common form of interaction.
[0003] Generally, a video player uses a decoder-bound interface for hardware decoding and image rendering of videos. When executing a control instruction for switching interfaces, video rendering is performed by restarting the decoder to perform a playback operation on a new interface.
[0004] However, restarting the decoder for video rendering takes a certain amount of time, and in scenarios where interface switching is frequent, it will cause a long-time black screen, affecting the smoothness of video content playback. Summary of the Invention
[0005] In view of this, this application provides a method for playing video content, which can effectively improve the smoothness of video content playback.
[0006] The first aspect of this application provides a method for playing video content, which can be applied to a system or program with a video content playback function in a terminal device, and specifically includes:
[0007] In response to the initiation of an interface update event in a target video, determine the target interface indicated by the interface update event, where the interface update event is used to indicate that the target video switches from the current interface to the target interface for display;
[0008] Obtain an image group cached when the target video is played on the current interface, where the cache object corresponding to the image group is a frame set between adjacent key frames, and the played video frames in the image group are sequentially moved to the end of the queue of the frame set;
[0009] Perform a decoding operation on the video frames in the frame set from the head of the queue to the end of the queue until the last frame to obtain a target image;
[0010] Output the target image to the target interface for playback.
[0011] Optionally, in some possible implementation manners of this application, the performing a decoding operation on the video frames in the frame set from the head of the queue to the end of the queue until the last frame to obtain a target image includes:
[0012] Traverse the video frames in the frame set from the head of the queue to the second-to-last frame in sequence to determine non-reference frames, and discard the non-reference frames;
[0013] Decode and then discard the video frames in the frame set except the non-reference frames to determine the last frame;
[0014] Decode the last frame to obtain the target image.
[0015] Optionally, in some possible implementation manners of this application, the traversing the video frames in the frame set in sequence from the head of the queue to the penultimate frame to determine the non-reference frame includes:
[0016] Determine the encoding method adopted by the target video;
[0017] Determine the feature field for indicating the video frame type based on the encoding method;
[0018] Extract the value of the feature field to determine the non-reference frame based on the value.
[0019] Optionally, in some possible implementation manners of this application, before obtaining the image group cached when the target video is played on the current interface, the method further includes:
[0020] Determine the video packet corresponding to the target video when it is played on the current interface;
[0021] Identify the types of video frames included in the video packet;
[0022] If there is a key frame in the video packet, clear the cache queue and cache the video packet as the image group.
[0023] Optionally, in some possible implementation manners of this application, after determining the target interface corresponding to the interface update event acting on the target video, the method further includes:
[0024] Restart the decoder for decoding the target video so that the decoder establishes a binding relationship with the target interface;
[0025] The outputting the target image to the target interface for playing includes:
[0026] Output the target image to the target interface for playing based on the binding relationship.
[0027] Optionally, in some possible implementation manners of this application, the outputting the target image to the target interface for playing based on the binding relationship includes:
[0028] Extract the target interface parameters corresponding to the target interface and the current interface parameters corresponding to the current interface;
[0029] Compare the target interface parameters with the current interface parameters to obtain interface difference information;
[0030] Determine the image change ratio based on the interface difference information;
[0031] Process the target image according to the image change ratio, and output the processed target image to the target interface for display.
[0032] Optionally, in some possible implementation manners of this application, the method further includes:
[0033] Obtain the audio packet corresponding to the target video;
[0034] Decode the audio packet to obtain audio frames;
[0035] Synchronize the audio frames with the frame set, and display the synchronized audio frames and the frame set on the target interface.
[0036] A second aspect of this application provides a video content playing device, including:
[0037] A determination unit, configured to determine a target interface indicated by the interface update event in response to the initiation of an interface update event in a target video, where the interface update event is used to indicate that the target video switches from the current interface to the target interface for display;
[0038] An acquisition unit, configured to acquire an image group cached when the target video is played on the current interface, where the cache object corresponding to the image group is a frame set between adjacent key frames, and the played video frames in the image group are sequentially moved to the end of the queue of the frame set;
[0039] A decoding unit, configured to perform a decoding operation on the video frames in the frame set from the head of the queue to the end of the queue until the last frame to obtain a target image;
[0040] A playback unit, configured to output the target image to the target interface for playback.
[0041] Optionally, in some possible implementation manners of this application, the decoding unit is specifically configured to sequentially traverse the video frames in the frame set from the head of the queue to the second-to-last frame to determine non-reference frames, and discard the non-reference frames;
[0042] The decoding unit is specifically configured to decode and discard the video frames in the frame set except the non-reference frames to determine the last frame;
[0043] The decoding unit is specifically configured to decode the last frame to obtain the target image.
[0044] Optionally, in some possible implementation manners of the present application, the decoding unit is specifically configured to determine the encoding method adopted by the target video;
[0045] The decoding unit is specifically configured to determine a feature field for indicating the video frame type based on the encoding method;
[0046] The decoding unit is specifically configured to extract the value of the feature field to determine the non-reference frame based on the value.
[0047] Optionally, in some possible implementation manners of the present application, the obtaining unit is specifically configured to determine a video packet corresponding to the target video when it is played on the current interface;
[0048] The obtaining unit is specifically configured to identify the types of video frames included in the video packet;
[0049] The obtaining unit is specifically configured to, if there is a key frame in the video packet, empty the cache queue and cache the video packet as the picture group.
[0050] Optionally, in some possible implementation manners of the present application, the determining unit is specifically configured to restart a decoder for decoding the target video so that the decoder establishes a binding relationship with the target interface;
[0051] The playing unit is specifically configured to output the target image to the target interface for playing based on the binding relationship.
[0052] Optionally, in some possible implementation manners of the present application, the playing unit is specifically configured to extract target interface parameters corresponding to the target interface and current interface parameters corresponding to the current interface;
[0053] The playing unit is specifically configured to compare the target interface parameters with the current interface parameters to obtain interface difference information;
[0054] The playing unit is specifically configured to determine an image change ratio based on the interface difference information;
[0055] The playing unit is specifically configured to process the target image according to the image change ratio and output the processed target image to the target interface for display.
[0056] Optionally, in some possible implementation manners of the present application, the playing unit is specifically configured to obtain an audio packet corresponding to the target video;
[0057] The playing unit is specifically configured to decode the audio packet to obtain audio frames;
[0058] The playback unit is specifically configured to synchronize based on the audio frame and the frame set, and display the synchronized audio frame and the frame set on the target interface.
[0059] A third aspect of the present application provides a computer device, including: a memory, a processor, and a bus system; the memory is used to store program codes; the processor is used to execute the video content playback method described in the first aspect or any item of the first aspect according to the instructions in the program codes.
[0060] A fourth aspect of the present application provides a computer-readable storage medium, in which instructions are stored, and when the instructions run on a computer, the computer is caused to execute the video content playback method described in the first aspect or any item of the first aspect.
[0061] According to one aspect of the present application, there is provided a computer program product or a computer program, the computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the video content playback method provided in the first aspect or various optional implementation manners of the first aspect.
[0062] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:
[0063] By responding to the initiation of an interface update event in the target video, determining the target interface indicated by the interface update event, where the interface update event is used to indicate that the target video switches from the current interface to the target interface for display; then obtaining the image group cached when the target video is played on the current interface; wherein, the cached object corresponding to the image group is the frame set between adjacent key frames, and the played video frames in the image group are sequentially moved to the end of the frame set; further, performing a decoding operation on the video frames in the frame set from the head to the end until the last frame to obtain the target image; and then outputting the target image to the target interface for playback. Thus, the seamless switching process of video content among multiple interfaces is realized. Since the cached image group is used to indicate the target interface for decoding and display, the image switching process is rapid, avoiding the occurrence of a black screen, and improving the smoothness of video content playback across interfaces. Description of the Drawings
[0064] To more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the accompanying drawings required for the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only the embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can also be obtained based on the provided drawings.
[0065] Figure 1 It is a network architecture diagram for the operation of a video content playback system;
[0066] Figure 2 It is a process architecture diagram for the playback of a video content provided by an embodiment of the present application;
[0067] Figure 3 It is a flowchart of a method for playing a video content provided by an embodiment of the present application;
[0068] Figure 4 It is a scenario schematic diagram of a method for playing a video content provided by an embodiment of the present application;
[0069] Figure 5 It is a scenario schematic diagram of another method for playing a video content provided by an embodiment of the present application;
[0070] Figure 6 It is a flowchart of another method for playing a video content provided by an embodiment of the present application;
[0071] Figure 7 It is a scenario schematic diagram of another method for playing a video content provided by an embodiment of the present application;
[0072] Figure 8 It is a structural schematic diagram of a video content playback device provided by an embodiment of the present application;
[0073] Figure 9 It is a structural schematic diagram of a terminal device provided by an embodiment of the present application;
[0074] Figure 10 It is a structural schematic diagram of a server provided by an embodiment of the present application. Detailed implementation manners
[0075] The embodiments of the present application provide a method for playing video content and related devices, which can be applied to a system or program with a video content playing function in a terminal device. By responding to the initiation of an interface update event in a target video, the target interface indicated by the interface update event is determined. This interface update event is used to indicate that the target video switches from the current interface to the target interface for display; then, an image group cached when the target video is played on the current interface is obtained; wherein, the cached object corresponding to the image group is a set of frames between adjacent key frames, and the played video frames in the image group are sequentially moved to the end of the queue of the set of frames; further, the video frames in the set of frames are decoded from the head of the queue to the end until the last frame to obtain a target image; and then the target image is output to the target interface for playing. Thus, the seamless switching process of video content among multiple interfaces is realized. Since the cached image group is used to indicate the target interface for decoding and display, the image switching process is rapid, avoiding the occurrence of a black screen and improving the smoothness of video content playing across interfaces.
[0076] The terms "first", "second", "third", "fourth", etc. (if any) in the specification, claims and drawings of the present application are used to distinguish similar objects and do not necessarily describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "comprising" and "corresponding to" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device comprising a series of steps or units does not necessarily limit to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0077] First, some nouns that may appear in the embodiments of the present application are explained.
[0078] I-frame: Intra coded picture, also known as "key frame". This type of frame can be decoded independently; when seeking, it is necessary to locate to this type of frame for decoding.
[0079] P-frame: Predictive coded picture. This type of frame needs to refer to a forward reference frame for decoding.
[0080] B-frame: Bidirectionally predictive coded pictures. This type of frame needs to refer to forward and / or backward reference frames for decoding.
[0081] Reference frame: The frame referred to during encoding.
[0082] Non-reference frame: A frame that is not encoded and referenced by any other frame. These frames are discarded during the decoding process and do not affect the normal decoding of other frames.
[0083] Group Of Pictures (GOP): The group of all pictures from one I-frame (inclusive) to the next I-frame (exclusive).
[0084] MediaCodec: The decoder interface provided by the Android platform.
[0085] Surface: The destination for video rendering on the Android platform, which can be understood as a canvas or interface.
[0086] It should be understood that the method for playing video content provided in this application can be applied to a system or program with a video content playing function in a terminal device, such as a video player. Specifically, the video content playing system can run in a network architecture as shown in Figure 1 shown, as shown in Figure 1 shown, is the network architecture diagram for the operation of the video content playing system. As can be seen from the figure, the video content playing system can provide the playing process of video content from multiple information sources, that is, by the playing operation on the terminal side, a playing instruction for the video is sent to the server, so as to obtain video data for cross-interface playing; it can be understood that Figure 1 shows various terminal devices. The terminal device can be a computer device. In actual scenarios, more or fewer types of terminal devices may participate in the process of playing video content. The specific quantity and types depend on the actual scenario and are not limited here. Additionally, Figure 1 shows a server, but in actual scenarios, multiple servers may also participate. The specific number of servers depends on the actual scenario.
[0087] In this embodiment, the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The terminal can be a smart phone, tablet computer, laptop computer, desktop computer, smart speaker, smart watch, smart voice interaction device, smart home appliance, vehicle terminal, etc., but is not limited thereto. The terminal and the server can be directly or indirectly connected through wired or wireless communication methods. The terminal and the server can be connected to form a blockchain network, which is not limited in this application.
[0088] It can be understood that the above video content playing system can run on a personal mobile terminal, for example: as an application such as a video player, or it can also run on a server, and can also be run on a third-party device to provide video content playback to obtain the playback processing result of the video content of the information source; the specific video content playing system can run in the above device in the form of a program, or can also run as a system component in the above device, and can also be a type of cloud service program. This embodiment can be applied to scenarios such as cloud technology and autonomous driving, and the specific operation mode depends on the actual scenario and is not limited here.
[0089] With the rapid development of Internet technology, people's requirements for controlling media content are getting higher and higher. Among them, controlling the playback of video content is a common form of interaction.
[0090] Generally, a video player uses a decoder-bound interface for hardware decoding and image rendering of videos. When executing a control instruction to switch the interface, it restarts the decoder for video rendering to perform playback operations on the new interface.
[0091] However, restarting the decoder for video rendering takes a certain amount of time, and in scenarios where the interface is switched frequently, it will cause a long black screen, affecting the smoothness of video content playback.
[0092] To solve the above problems, this application proposes a method for playing video content, which is applied to Figure 2 the shown process framework for playing video content, as Figure 2 shown, which is a process architecture diagram for playing video content provided by an embodiment of this application. It can be used in scenarios where an Android video client needs to update the Surface. The user determines the target interface to switch to through a terminal operation for playing, then calls the image set cached during the video playback, and extracts the target image from the image set, so as to display the playback interface based on the target image. Whether in a paused state or not, after updating the playback interface, this application renders the picture to the new playback interface at the fastest speed to achieve seamless update of the playback interface.
[0093] It can be understood that the method provided in this application can be a program writing to serve as a processing logic in a hardware system, or can also be a video content playback device, which implements the above-mentioned processing logic in an integrated or external connection manner. As an implementation method, the video content playback device determines the target interface indicated by the interface update event by responding to the initiation of the interface update event in the target video. The interface update event is used to indicate that the target video switches from the current interface to the target interface for display; then, it acquires the image group cached when the target video is played on the current interface; wherein, the cached object corresponding to the image group is the frame set between adjacent key frames, and the played video frames in the image group are sequentially moved to the end of the frame set; further, it performs decoding operations on the video frames in the frame set from the head to the end until the last frame to obtain the target image; and then outputs the target image to the target interface for playback. Thus, the seamless switching process of video content among multiple interfaces is realized. Since the cached image group is used to indicate the target interface for decoding and display, the image switching process is rapid, avoiding the generation of black screens and improving the smoothness of cross-interface video content playback.
[0094] Combined with the above process architecture, the video content playback method in this application will be introduced below. Please refer to Figure 3 , Figure 3 which is a flowchart of a video content playback method provided by an embodiment of this application. This management method can be executed by a terminal. The embodiment of this application at least includes the following steps:
[0095] 301. Respond to the initiation of the interface update event in the target video and determine the target interface indicated by the interface update event.
[0096] In this embodiment, the interface update event is used to indicate that the target video switches from the current interface to the target interface for display, that is, the cross-interface video content playback process, such as foreground / background switching, or floating window playback, etc.; specifically, the interface update event can be an external event, that is, an event initiated by an externally input program or operation instruction, such as a user manually operating to switch to the background; in addition, the interface update event can also be an internal event, that is, an event automatically executed by the software system, such as automatically playing in a floating window when the video plays to the end. The specific switching and updating form depends on the actual scenario and is not limited here.
[0097] Specifically, the interface ranges of the current interface and the target interface can be different. As Figure 4 shown, Figure 4 which is a scenario schematic diagram of a video content playback method provided by an embodiment of this application; it shows that by updating the interface A1 (current interface) of the player to the floating window interface A2 (target interface), the floating window playback function is realized without interrupting the playback.
[0098] In addition, the interface ranges of the current interface and the target interface can be the same. For example, Figure 5 as shown Figure 5 FIG. Figure 5 is a schematic diagram of a scenario of another video content playing method provided by an embodiment of the present application; the figure shows a scenario where the video player interface B1 is paused. The user clicks the pause button B2 (interface update event), so that the video in the video player is paused, and the video needs to be continued to play on the updated video player interface B3.
[0099] 302. Obtain the image group cached when the target video is played on the current interface.
[0100] In this embodiment, the cache object corresponding to the image group (GOP) is the frame set between adjacent key frames, that is, the image group contains a group of all images between one I frame (inclusive) and the next I frame (exclusive); in addition, the played video frames in the image group will be sequentially moved to the end of the frame set, so that the played picture can be accurately restored during the cache reading process.
[0101] Specifically, for the video playing process, a GOP cache module is newly added to the decoding module. The head of the queue in the GOP cache module is the I frame. When a new I frame comes, the queue data in the GOP cache module is cleared and re-stored, so as to ensure that the queue can store at most one GOP of data; that is, first determine the video packet corresponding to the target video when it is played on the current interface; then identify the type of video frame included in the video packet; if there is a key frame in the video packet, clear the cache queue and cache the video packet as an image group to ensure the accuracy of restoring the played image based on the cache.
[0102] In a possible scenario, the video decoding process of the present application is as Figure 6 shown Figure 6 FIG. Figure 6 is a flowchart of another video content playing method provided by an embodiment of the present application; first, corresponding processing is performed in response to an interface update event (including pausing, continuing, etc. If a pause event is received, wait); then read the video packet from the parser queue; and query the GOP cache queue. If the current video packet is an I frame, clear the GOP cache queue; further, put the current video packet at the end of the GOP cache queue; decode the subsequent video packets by MediaCodec; and perform audio-video synchronization, that is, first obtain the audio packet corresponding to the target video, then decode the audio packet to obtain the audio frame, and synchronize based on the audio frame and the frame set; finally, play on the screen.
[0103] 303. Perform a decoding operation on the video frames in the frame set from the head to the end of the queue until the last frame to obtain the target image.
[0104] In this embodiment, the interface update event indicates the progress of the interface switching operation. When an interface switching operation is required (i.e., when the external updates the Surface), specifically, MediaCodec can be restarted first, and a new Surface can be configured and bound to it; then, decode from the head to the tail of the GOP cache in sequence, and render the last frame to the new Surface.
[0105] Specifically, to accelerate the decoding process, non-reference frames except the last frame can be skipped without decoding, that is, first traverse the video frames in the frame set from the head to the second-to-last frame in sequence to determine the non-reference frames, and discard the non-reference frames; then decode and discard the video frames except the non-reference frames in the frame set to determine the last frame; and then decode the last frame to obtain the target image, thus saving the decoding time.
[0106] In a possible scenario, this embodiment can adopt the process shown in Figure 7 for decoding, Figure 7 which is a schematic diagram of the scenario of another video content playback method provided by the embodiments of the present application; that is, first respond to the interface update event to process the event of receiving the updated Surface. Then restart MediaCodec and configure and bind a new Surface. Further, traverse from the head to the second-to-last frame of the GOP cache. If the current packet is a non-reference frame, it is not sent to the decoder; otherwise, it is sent to the decoder for decoding. Then decode the video frame at the tail of the queue and render it to the new Surface, thus completing the processing of the event of updating the Surface, that is, the operation of updating the Surface is completed.
[0107] Specifically, for the above decoding process, it can be implemented using the following pseudocode:
[0108]
[0109]
[0110] Specifically, for the recognition process of non-reference frames, different coding methods can adopt different recognition methods. Therefore, the coding method adopted by the target video can be determined first; then, based on the coding method, the feature field used to indicate the video frame type can be determined; and then the value of the feature field can be extracted to determine the non-reference frame based on the value.
[0111] For example, for the H264 coding method, it can be determined whether it is a non-reference frame through nal_ref_idc, which is used to indicate the priority of the current NAL. The value range is 0-3, and the higher the value, the more important the current NAL is and needs to be protected first, that is, nal_ref_idc being 0 is a non-reference frame.
[0112] In addition, for the HEVC encoding method, it is possible to determine whether it is a non-reference frame according to nal_unit_type. That is, when the nal_unit_type is TRAIL_N(0), TSA_N(2), STSA_N(4), RADL_N(6), RASL_N(8), RSV_VCL_N10(10), RSV_VCL_N12(12), RSV_VCL_N14(14), it is a non-reference frame.
[0113] Specifically, the above method for identifying non-reference frames can be implemented through the IsNonRef function (to determine whether the current video packet is a non-reference frame), and its corresponding logic (pseudo code) is as follows:
[0114]
[0115]
[0116] 304. Output the target image to the target interface for playback.
[0117] In this embodiment, since the size range of the target interface may be different from that of the current interface, the target image can be adjusted before playback to make it adapt to the target interface.
[0118] Specifically, for the use of the decoder, after determining the target interface corresponding to the interface update event acting on the target video, the decoder for decoding the target video can be restarted to establish a binding relationship between the decoder and the target interface; and then based on the binding relationship, the target image is output to the target interface for playback. During the output process, the target interface parameters corresponding to the target interface and the current interface parameters corresponding to the current interface can be extracted, such as endpoint coordinates, scaling ratio, etc.; then the target interface parameters are compared with the current interface parameters to obtain interface difference information, such as the range change amount; and based on the interface difference information, the image change ratio is determined; and then the target image is processed according to the image change ratio, and the processed target image is output to the target interface for display. For example, if the target interface is half the size range of the current interface, then the target image is correspondingly reduced to half and then output to the target interface for playback, so as to adapt to the target interface for playback.
[0119] As can be seen from the above embodiments, regardless of whether it is in a paused state, after updating the Surface, the screen is rendered onto the new Surface at the fastest speed to achieve seamless Surface update. Specifically, in response to the initiation of an interface update event in the target video, the target interface indicated by the interface update event is determined. This interface update event is used to indicate that the target video switches from the current interface to the target interface for display; then, the image group cached when the target video is played on the current interface is obtained; among them, the cached object corresponding to the image group is the frame set between adjacent key frames, and the played video frames in the image group are sequentially moved to the end of the frame set queue; further, the video frames in the frame set are decoded from the head to the end of the queue until the last frame to obtain the target image; and then the target image is output to the target interface for playback. Thus, the process of seamless switching of video content among multiple interfaces is realized. Since the cached image group is used to indicate the target interface for decoding and display, the image switching process is rapid, avoiding the occurrence of a black screen and improving the smoothness of video content playback across interfaces.
[0120] To better implement the above solutions of the embodiments of the present application, the following also provides related devices for implementing the above solutions. Please refer to Figure 8 , Figure 8 FIG. is a schematic structural diagram of a video content playback device provided by an embodiment of the present application. The video content playback device 800 includes:
[0121] A determination unit 801, configured to determine the target interface indicated by the interface update event in response to the initiation of an interface update event in the target video, where the interface update event is used to indicate that the target video switches from the current interface to the target interface for display;
[0122] An acquisition unit 802, configured to acquire the image group cached when the target video is played on the current interface, where the cached object corresponding to the image group is the frame set between adjacent key frames, and the played video frames in the image group are sequentially moved to the end of the frame set queue;
[0123] A decoding unit 803, configured to perform a decoding operation on the video frames in the frame set from the head to the end of the queue until the last frame to obtain a target image;
[0124] A playback unit 804, configured to output the target image to the target interface for playback.
[0125] Optionally, in some possible implementation manners of the present application, the decoding unit 803 is specifically configured to sequentially traverse the video frames in the frame set from the head to the second-to-last frame to determine non-reference frames, and discard the non-reference frames;
[0126] The decoding unit 803 is specifically configured to decode and then discard the video frames in the frame set except the non-reference frames to determine the last frame;
[0127] The decoding unit 803 is specifically configured to decode the last frame to obtain the target image.
[0128] Optionally, in some possible implementation manners of the present application, the decoding unit 803 is specifically configured to determine the encoding method adopted by the target video;
[0129] The decoding unit 803 is specifically configured to determine the feature field for indicating the video frame type based on the encoding method;
[0130] The decoding unit 803 is specifically configured to extract the value of the feature field to determine the non-reference frame based on the value.
[0131] Optionally, in some possible implementation manners of the present application, the obtaining unit 802 is specifically configured to determine the video packet corresponding to the target video when it is played on the current interface;
[0132] The obtaining unit 802 is specifically configured to identify the types of video frames included in the video packet;
[0133] The obtaining unit 802 is specifically configured to, if there is a key frame in the video packet, clear the cache queue and cache the video packet as the picture group.
[0134] Optionally, in some possible implementation manners of the present application, the determining unit 801 is specifically configured to restart the decoder for decoding the target video so that the decoder establishes a binding relationship with the target interface;
[0135] The playing unit 804 is specifically configured to output the target image to the target interface for playing based on the binding relationship.
[0136] Optionally, in some possible implementation manners of the present application, the playing unit 804 is specifically configured to extract the target interface parameters corresponding to the target interface and the current interface parameters corresponding to the current interface;
[0137] The playing unit 804 is specifically configured to compare the target interface parameters with the current interface parameters to obtain interface difference information;
[0138] The playing unit 804 is specifically configured to determine the image change ratio based on the interface difference information;
[0139] The playback unit 804 is specifically configured to process the target image according to the image change ratio, and output the processed target image to the target interface for display.
[0140] Optionally, in some possible implementation manners of the present application, the playback unit 804 is specifically configured to obtain an audio packet corresponding to the target video;
[0141] The playback unit 804 is specifically configured to decode the audio packet to obtain audio frames;
[0142] The playback unit 804 is specifically configured to synchronize the audio frames with the frame set, and display the synchronized audio frames and the frame set on the target interface.
[0143] By responding to the initiation of an interface update event in the target video, the target interface indicated by the interface update event is determined. This interface update event is used to indicate that the target video is switched from the current interface to the target interface for display; then, the image group cached when the target video is played on the current interface is obtained; wherein, the cached object corresponding to the image group is the frame set between adjacent key frames, and the video frames played in the image group are sequentially moved to the end of the frame set; further, the video frames in the frame set are decoded from the head to the end of the queue to the last frame to obtain the target image; and then the target image is output to the target interface for playback. Thus, the seamless switching process of video content among multiple interfaces is realized. Since the cached image group is used to indicate the target interface for decoding and display, the image switching process is rapid, the black screen is avoided, and the smoothness of video content playback across interfaces is improved.
[0144] The embodiment of the present application further provides a terminal device, such as Figure 9 shown, which is a schematic structural diagram of another terminal device provided by the embodiment of the present application. For the sake of convenience of description, only the parts related to the embodiment of the present application are shown. For the specific technical details not disclosed, please refer to the method part of the embodiment of the present application. This terminal can be any terminal device including a mobile phone, a tablet computer, a personal digital assistant (PDA), a point of sales (POS), an in-vehicle computer, etc. Taking the terminal as a mobile phone as an example:
[0145] Figure 9 Shown is a block diagram of a part of the structure of the mobile phone related to the terminal provided by the embodiment of the present application. Refer to Figure 9, The mobile phone includes components such as a radio frequency (RF) circuit 910, a memory 920, an input unit 930, a display unit 940, sensors 950, an audio circuit 960, a wireless fidelity (WiFi) module 970, a processor 980, and a power supply 990. Those skilled in the art can understand that Figure 9 the mobile phone structure shown in
[0146] does not limit the mobile phone and may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements. Figure 9 The following specifically introduces each component of the mobile phone:
[0147] The RF circuit 910 can be used for receiving and sending signals during information reception or call processes. Specifically, after receiving the downlink information from the base station, it is given to the processor 980 for processing; in addition, the designed uplink data is sent to the base station. Generally, the RF circuit 910 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (LNA), a duplexer, etc. In addition, the RF circuit 910 can also communicate with the network and other devices through wireless communication. The above wireless communication can use any communication standard or protocol, including but not limited to the Global System of Mobile Communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Messaging Service (SMS), etc.
[0148] The memory 920 can be used to store software programs and modules. The processor 980 executes various functional applications and data processing of the mobile phone by running the software programs and modules stored in the memory 920. The memory 920 mainly includes a program storage area and a data storage area. Among them, the program storage area can store the operating system, application programs required for at least one function (such as the sound playback function, the image playback function, etc.); the data storage area can store data created according to the use of the mobile phone (such as audio data, phone book, etc.). In addition, the memory 920 can include high-speed random access memory and can also include non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0149] The input unit 930 can be used to receive input digital or character information and generate key signal inputs related to the user settings and function controls of the mobile phone. Specifically, the input unit 930 can include a touch panel 931 and other input devices 932. The touch panel 931, also known as a touch screen, can collect touch operations of the user on or near it (such as operations of the user using a finger, a stylus, or any suitable object or accessory on or near the touch panel 931, as well as air-touch operations within a certain range on the touch panel 931), and drive the corresponding connection device according to a pre-set program. Optionally, the touch panel 931 can include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the touch position of the user and detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact coordinates, and then sends it to the processor 980, and can receive and execute commands sent by the processor 980. In addition, various types such as resistive, capacitive, infrared, and surface acoustic wave can be used to implement the touch panel 931. In addition to the touch panel 931, the input unit 930 can also include other input devices 932. Specifically, the other input devices 932 can include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, power on / off keys, etc.), a trackball, a mouse, a joystick, etc.
[0150] The display unit 940 can be used to display information input by the user or information provided to the user, as well as various menus of the mobile phone. The display unit 940 may include a display panel 941. Optionally, the display panel 941 can be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc. Further, the touch panel 931 can cover the display panel 941. When the touch panel 931 detects a touch operation on or near it, it is transmitted to the processor 980 to determine the type of touch event. Subsequently, the processor 980 provides a corresponding visual output on the display panel 941 according to the type of touch event. Although in Figure 9 , the touch panel 931 and the display panel 941 are implemented as two independent components to realize the input and input functions of the mobile phone, but in some embodiments, the touch panel 931 and the display panel 941 can be integrated to realize the input and output functions of the mobile phone.
[0151] The mobile phone may further include at least one sensor 950, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor. Among them, the ambient light sensor can adjust the brightness of the display panel 941 according to the brightness of the ambient light, and the proximity sensor can turn off the display panel 941 and / or the backlight when the mobile phone is moved to the ear. As a kind of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in all directions (generally three axes). When stationary, it can detect the magnitude and direction of gravity, and can be used for applications that identify the posture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors that the mobile phone can also be configured with, they will not be elaborated here.
[0152] The audio circuit 960, the speaker 961, and the microphone 962 can provide an audio interface between the user and the mobile phone. The audio circuit 960 can transmit the electrical signal converted from the received audio data to the speaker 961, and the speaker 961 converts it into a sound signal for output; on the other hand, the microphone 962 converts the collected sound signal into an electrical signal, which is received by the audio circuit 960 and then converted into audio data. After the audio data is output to the processor 980 for processing, it is sent through the RF circuit 910 to, for example, another mobile phone, or the audio data is output to the memory 920 for further processing.
[0153] WiFi belongs to short-range wireless transmission technology. The mobile phone can help users send and receive emails, browse the web, and access streaming media through the WiFi module 970. It provides users with wireless broadband Internet access. Although Figure 9The WiFi module 970 is shown, but it can be understood that it does not belong to the essential components of the mobile phone and can be completely omitted within the scope of not changing the essence of the invention according to needs.
[0154] The processor 980 is the control center of the mobile phone, connecting various parts of the entire mobile phone through various interfaces and circuits. By running or executing software programs and / or modules stored in the memory 920, and by calling data stored in the memory 920, it executes various functions of the mobile phone and processes data. Optionally, the processor 980 may include one or more processing units; optionally, the processor 980 may integrate an application processor and a modem processor. Among them, the application processor mainly processes the operating system, user interface, application programs, etc., and the modem processor mainly processes wireless communication. It can be understood that the above-mentioned modem processor may not be integrated into the processor 980 either.
[0155] The mobile phone also includes a power supply 990 (such as a battery) for supplying power to each component. Optionally, the power supply can be logically connected to the processor 980 through a power management system, so as to realize functions such as management of charging, discharging, and power consumption management through the power management system.
[0156] Although not shown, the mobile phone may also include a camera, a Bluetooth module, etc., which will not be elaborated here.
[0157] In the embodiment of the present application, the processor 980 included in the terminal also has the function of executing each step of the above-mentioned page processing method.
[0158] The embodiment of the present application also provides a server. Please refer to Figure 10 , Figure 10 is a schematic structural diagram of a server provided by the embodiment of the present application. The server 1000 may vary greatly due to different configurations or performances, and may include one or more central processing units (CPUs) 1022 (for example, one or more processors) and a memory 1032, and one or more storage media 1030 (for example, one or more mass storage devices) for storing application programs 1042 or data 1044. Among them, the memory 1032 and the storage media 1030 may be transient storage or persistent storage. The program stored in the storage media 1030 may include one or more modules (not marked in the figure), and each module may include a series of instruction operations on the server. Further, the central processor 1022 may be set to communicate with the storage media 1030 and execute a series of instruction operations in the storage media 1030 on the server 1000.
[0159] Server 1000 may also include one or more power supplies 1026, one or more wired or wireless network interfaces 1050, one or more input / output interfaces 1058, and / or one or more operating systems 1041, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
[0160] In the above embodiments, the steps performed by the management device may be based on the Figure 10 server structure shown.
[0161] An embodiment of the present application also provides a computer-readable storage medium storing instructions for playing video content. When running on a computer, the computer is caused to execute the steps performed by the video content playing device in the method described in the foregoing Figures 3 to 7 embodiment shown.
[0162] An embodiment of the present application also provides a computer program product including instructions for playing video content. When running on a computer, the computer is caused to execute the steps performed by the video content playing device in the method described in the foregoing Figures 3 to 7 embodiment shown.
[0163] An embodiment of the present application also provides a video content playing system, which may include Figure 8 the video content playing device in the embodiment described, or Figure 9 the terminal device in the embodiment described, or Figure 10 the server described.
[0164] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the systems, devices, and units described above can refer to the corresponding processes in the foregoing method embodiments and will not be described herein again.
[0165] In several embodiments provided by the present application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point, the displayed or discussed couplings or direct couplings or communication connections between each other can be through some interfaces, and the indirect couplings or communication connections of devices or units can be in electrical, mechanical, or other forms.
[0166] The unit described as a separation component may or may not be physically separated. The component shown as a unit may or may not be a physical unit, that is, it may be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0167] In addition, each functional unit in various embodiments of the present application can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
[0168] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a video content playback device, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present application. The foregoing storage medium includes: USB flash drives, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs, etc., all kinds of media that can store program codes.
[0169] As mentioned above, the above embodiments are only used to illustrate the technical solution of the present application, rather than to limit it; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements on some of the technical features; 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 various embodiments of the present application.
Claims
1. A method for playing video content, characterized in that Including: In response to the initiation of an interface update event in the target video, determining the target interface indicated by the interface update event, where the interface update event is used to indicate that the target video switches from the current interface to the target interface for display; Restarting the decoder for decoding the target video so that the decoder establishes a binding relationship with the target interface; Obtaining an image group cached when the target video is played on the current interface, where the cached object corresponding to the image group is a frame set between adjacent key frames, one of the adjacent key frames is the latest key frame, and the video frames played in the image group are sequentially moved to the end of the queue of the frame set; Performing a decoding operation on the video frames in the frame set from the head of the queue to the end of the queue until the last frame to obtain a target image; Based on the binding relationship, outputting the target image to the target interface for playback; Among them, the outputting the target image to the target interface for playback based on the binding relationship includes: Extracting the target interface parameters corresponding to the target interface and the current interface parameters corresponding to the current interface; Comparing the target interface parameters with the current interface parameters to obtain interface difference information; Determining an image change ratio based on the interface difference information; Processing the target image according to the image change ratio and outputting the processed target image to the target interface for display.
2. The method according to claim 1, wherein The performing a decoding operation on the video frames in the frame set from the head of the queue to the end of the queue until the last frame to obtain a target image includes: Sequentially traversing the video frames in the frame set from the head of the queue to the second-to-last frame to determine non-reference frames and discarding the non-reference frames; Decoding and discarding the video frames in the frame set except the non-reference frames to determine the last frame; Decoding the last frame to obtain the target image.
3. The method according to claim 2, wherein The sequentially traversing the video frames in the frame set from the head of the queue to the second-to-last frame to determine non-reference frames includes: Determining the coding method adopted by the target video; Based on the coding method, determining a feature field for indicating the video frame type; Extracting the value of the feature field to determine the non-reference frame based on the value.
4. The method according to claim 1, wherein Before the obtaining the image group cached when the target video is played on the current interface, the method further includes: Determining the video packet corresponding to the target video when it is played on the current interface; Identifying the types of video frames included in the video packet; If there is a key frame in the video packet, clearing the cache queue and caching the video packet as the image group.
5. The method according to any one of claims 1 to 4, characterized in that, The method further includes: Obtaining the audio packet corresponding to the target video; Decoding the audio packet to obtain audio frames; Synchronizing based on the audio frames and the frame set, and displaying based on the synchronized audio frames and the frame set on the target interface.
6. A playback device for video content, characterized in that, Including: A determining unit, configured to, in response to the initiation of an interface update event in the target video, determine the target interface indicated by the interface update event, where the interface update event is used to indicate that the target video switches from the current interface to the target interface for display; An acquisition unit, configured to acquire an image group cached when the target video is played on the current interface, where the cached object corresponding to the image group is a frame set between adjacent key frames, one of the adjacent key frames is the latest key frame, and the played video frames in the image group are sequentially moved to the end of the queue of the frame set; A decoding unit, configured to perform a decoding operation on the video frames in the frame set from the head to the end of the queue until the last frame to obtain a target image; A playing unit, configured to output the target image to the target interface for playing; The determining unit is specifically configured to restart a decoder for decoding the target video, so that the decoder establishes a binding relationship with the target interface; The playing unit is specifically configured to output the target image to the target interface for playing based on the binding relationship; The playing unit is specifically configured to extract target interface parameters corresponding to the target interface and current interface parameters corresponding to the current interface; The playing unit is specifically configured to compare the target interface parameters with the current interface parameters to obtain interface difference information; The playing unit is specifically configured to determine an image change ratio based on the interface difference information; The playing unit is specifically configured to process the target image according to the image change ratio, and output the processed target image to the target interface for display.
7. The device according to claim 6, characterized in that, The decoding unit is specifically configured to sequentially traverse the video frames in the frame set from the head to the second-to-last frame to determine non-reference frames, and discard the non-reference frames; The decoding unit is specifically configured to decode and discard the video frames in the frame set except the non-reference frames to determine the last frame; The decoding unit is specifically configured to decode the last frame to obtain the target image.
8. The device according to claim 7, characterized in that, The decoding unit is specifically configured to determine the encoding method adopted by the target video; The decoding unit is specifically configured to determine a feature field for indicating the type of video frame based on the encoding method; The decoding unit is specifically configured to extract the value of the feature field to determine the non-reference frame based on the value; 9. The device according to claim 6, characterized in that The acquisition unit is specifically configured to determine a video packet corresponding to the target video when it is played on the current interface; The acquisition unit is specifically configured to identify the type of video frames included in the video packet; The acquisition unit is specifically configured to, if there is a key frame in the video packet, clear the cache queue and cache the video packet as the image group.
10. The device according to any one of claims 6-9, characterized in that The playing unit is specifically configured to acquire an audio packet corresponding to the target video; The playing unit is specifically configured to decode the audio packet to obtain audio frames; The playing unit is specifically configured to synchronize the audio frames with the frame set, and display the synchronized audio frames and the frame set on the target interface.
11. A computer device, characterized in that, The computer device includes a processor and a memory: The memory is used to store program codes; the processor is used to execute the video content playing method according to any one of claims 1 to 5 based on the instructions in the program codes.
12. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by a processor, the steps of the video content playing method according to any one of the above claims 1 to 5 are implemented.
Citation Information
Patent Citations
Video breakpoint playing method and device, storage medium and electronic device
CN110213642A
Video playing method and device, electronic equipment and storage medium
CN110267096A