Method and apparatus for accessing video data
By acquiring and sending access information for video segments, and only acquiring access information for segments that do not require downstream services, the network overhead problem when multiple video segments and multiple images are mixed together is solved, and efficient use of network resources is achieved.
Patent Information
- Application Number
- CN202311329601.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-13
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2043-10-13
AI Technical Summary
When video creation supports multiple video clips and multiple mixed images, the network overhead between the server and downstream services is too large, resulting in a waste of network resources.
By receiving video requests from client devices, the server obtains segment information of the target video, determines which segment access information needs to be obtained through downstream services, and only sends access information for segments that do not need to be obtained through downstream services, as well as access information for segments within the target segment range that need to be obtained, thereby reducing network interaction between the server and downstream services.
It effectively reduces network overhead between the server and downstream services, and optimizes the utilization of network resources.
Smart Images

Figure CN119835464B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of video transmission, and particularly relates to a video data access method and device. BACKGROUND
[0002] In order to improve the video creation experience of users, related technologies can support a video creation mode in which multiple videos and multiple pictures are mixed. That is, the video can include multiple original videos and multiple pictures at the same time, each video or each picture corresponds to a segment of video content, and when the video including the multiple original videos and the multiple pictures is played, the multiple segments are played in turn from front to back. However, the video creation supporting the mixing of the multiple videos and the multiple pictures can cause the network overhead between a server and downstream services to be very large. SUMMARY
[0003] Therefore, embodiments of the present application provide a video sending method and device for reducing the network overhead between a server and downstream services.
[0004] To achieve the above object, the embodiments of the present application provide the technical solutions as follows.
[0005] In a first aspect, the embodiments of the present application provide a video data access method, comprising:
[0006] receiving a first video request sent by a client device;
[0007] obtaining segment information of a target video in response to the first video request, the target video being any video to be sent to the client device with access information, the segment information of the target video including labels of each segment of the target video, and the label of any segment being used to indicate whether the access information of the segment needs to be obtained through a downstream service;
[0008] determining whether to send access information of all segments of the target video to the client device according to the segment information;
[0009] determining not to send the access information of all segments of the target video to the client device, obtaining access information of each first-type segment and access information of each second-type segment in a target segment interval, and sending the access information of each first-type segment and the access information of each second-type segment in the target segment interval to the client device, the first-type segment being a segment whose access information does not need to be obtained through the downstream service, and the second-type segment being a segment whose access information needs to be obtained through the downstream service.
[0010] As an optional implementation of the embodiment of the present application, the determining whether to send the access information of all segments of the target video to the client device according to the segment information of the target video comprises:
[0011] obtaining the total segment quantity of the target video according to the segment information of the target video;
[0012] determining whether the total segment quantity of the target video is greater than a preset segment quantity;
[0013] if not, determining to send the access information of all segments of the target video to the client device; if yes, determining whether the second type of segment is included in the remaining segments except the segments in the target segment interval; if the second type of segment is not included in the remaining segments, determining to send the access information of all segments of the target video to the client device; if the second type of segment is included in the remaining segments, determining not to send the access information of all segments of the target video to the client device.
[0014] As an optional implementation of the embodiment of the present application, before obtaining the access information of each first type of segment and the access information of each second type of segment in the target segment interval, the method further comprises:
[0015] determining the paging direction of the target video;
[0016] determining the target segment interval according to the paging direction of the target video and a preset interval length.
[0017] As an optional implementation of the embodiment of the present application, the determining the paging direction of the target video comprises:
[0018] determining whether the direction indication information is carried in the first video request;
[0019] if not, determining the paging direction of the target video as a forward direction;
[0020] if yes, determining the paging direction of the target video as a reverse direction.
[0021] As an optional implementation of the embodiment of the present application, before obtaining the segment information of the target video in response to the first video request, the method further comprises:
[0022] determining the content of each segment of the target video;
[0023] if the content of the first segment of the target video is a picture, determining that the access information of the first segment does not need to be obtained through a downstream service;
[0024] If the content of the second segment of the target video is a picture or a video with a sticker or a video with a sticker, it is determined that the access information of the second segment needs to be acquired through a downstream service;
[0025] According to whether the access information of each segment of the target video needs to be acquired through a downstream service, segment information of the target video is generated and saved.
[0026] As an optional implementation of the embodiment of the present application, the segment information of the target video is generated and saved according to whether the access information of each segment of the target video needs to be acquired through a downstream service, including:
[0027] Each segment of the target video is traversed, if the access information of the current segment does not need to be acquired through a downstream service, the label corresponding to the current segment is set to a first preset value, if the access information of the current segment needs to be acquired through a downstream service, the label corresponding to the segment is set to a second preset value, so as to acquire a label sequence of the target video;
[0028] According to the label sequence, the segment information of the target video is acquired.
[0029] The segment information of the target video is saved into a preset storage space.
[0030] As an optional implementation of the embodiment of the present application, the method further includes:
[0031] The paging information of the target video is generated, the paging information includes at least one of first indication information, second indication information and third indication information, the first indication information is used to indicate that the target video further includes remaining segments in addition to the target segment interval, the second indication information is used to indicate the starting position of the remaining segments, and the third indication information is used to indicate the paging direction of the target video.
[0032] The paging information of the target video is sent to the client device.
[0033] As an optional implementation of the embodiment of the present application, the method further includes:
[0034] The second video request sent by the client device is received, the second video request carries the paging information of the target video.
[0035] The access information of each remaining second type segment is acquired in response to the second video request, the remaining second type segment is the second type segment in the remaining segments in addition to the target segment interval.
[0036] The access information of each remaining second type segment is sent to the client device.
[0037] In a second aspect, the embodiments of the present application provide a method for accessing video data, comprising:
[0038] sending a first video request to a server;
[0039] receiving access information of each first type segment of a target video and access information of each second type segment in a target segment interval sent by the server, the first type segment being a segment whose access information does not need to be acquired through a downstream service, and the second type segment being a segment whose access information needs to be acquired through the downstream service;
[0040] acquiring play data of each first type segment of the target video and play data of each second type segment in the target segment interval according to the access information of each first type segment of the target video and the access information of each second type segment in the target segment interval.
[0041] As an optional implementation of the embodiments of the present application, the method further comprises:
[0042] receiving paging information of the target video sent by the server, the paging information comprising at least one of first indication information, second indication information and third indication information, the first indication information being used to indicate that the target video further comprises remaining segments other than the target segment interval, the second indication information being used to indicate a starting position of the remaining segments, and the third indication information being used to indicate a paging direction of the target video;
[0043] determining whether a cache play duration of the target video is less than a threshold duration in real time during a process of playing the target video;
[0044] when the cache play duration is less than the threshold duration, sending a second video request to the server, the second video request carrying the paging information of the target video;
[0045] receiving access information of each remaining second type segment of the target video sent by the server, the remaining second type segment being the second type segment in the remaining segments other than the target segment interval;
[0046] acquiring play data of each remaining second type segment of the target video according to the access information of each remaining second type segment of the target video.
[0047] In a third aspect, the embodiments of the present application provide a server, comprising:
[0048] a receiving unit, configured to receive a first video request sent by a client device;
[0049] acquire, in response to the first video request, segment information of a target video, the target video being any video to which the client device is to be sent access information, the segment information of the target video comprising labels of respective segments of the target video, a label of any segment being used to indicate whether access information of the segment needs to be acquired through a downstream service;
[0050] determine, according to the segment information of the target video, whether to send, to the client device, access information of all segments of the target video, and in a case where it is determined not to send, to the client device, access information of all segments of the target video, acquire access information of respective first-type segments and access information of respective second-type segments within a target segment interval; the first-type segments being segments of which access information does not need to be acquired through a downstream service, and the second-type segments being segments of which access information needs to be acquired through a downstream service;
[0051] send, to the client device, the access information of respective first-type segments and the access information of respective second-type segments within the target segment interval.
[0052] As an optional implementation of the embodiment of the present application, the processing unit is specifically configured to acquire a total number of segments of the target video according to the segment information of the target video; determine whether the total number of segments of the target video is greater than a preset number of segments; if not, determine to send, to the client device, access information of all segments of the target video; if yes, determine whether the second-type segments are included in remaining segments other than segments in the target segment interval; if the second-type segments are not included in the remaining segments, determine to send, to the client device, access information of all segments of the target video; if the second-type segments are included in the remaining segments, determine not to send, to the client device, access information of all segments of the target video.
[0053] As an optional implementation of the embodiment of the present application, the processing unit is further configured to, before acquiring the access information of respective first-type segments and the access information of respective second-type segments within the target segment interval, determine a paging direction of the target video; and determine the target segment interval according to the paging direction of the target video and a preset interval length.
[0054] As an optional implementation of the embodiment of the present application, the processing unit is specifically configured to determine whether direction indication information is carried in the first video request; if not, determine a forward direction as the paging direction of the target video; if yes, determine a reverse direction as the paging direction of the target video.
[0055] As an optional implementation of the embodiment of the present application, the processing unit is further configured to determine the content of each segment of the target video before acquiring the segment information of the target video in response to the first video request; if the content of a first segment of the target video is a picture, it is determined that the access information of the first segment does not need to be acquired through the downstream service; if the content of a second segment of the target video is a picture with a sticker or a video with a sticker or a video with a sticker, it is determined that the access information of the second segment needs to be acquired through the downstream service; and generate and save the segment information of the target video according to whether the access information of each segment of the target video needs to be acquired through the downstream service.
[0056] As an optional implementation of the embodiment of the present application, the processing unit is specifically configured to traverse each segment of the target video, set a label corresponding to a current segment to a first preset value if the access information of the current segment does not need to be acquired through the downstream service, set the label corresponding to the segment to a second preset value if the access information of the current segment needs to be acquired through the downstream service, so as to acquire a label sequence of the target video; acquire the segment information of the target video according to the label sequence; and save the segment information of the target video into a preset storage space.
[0057] As an optional implementation of the embodiment of the present application, the processing unit is further configured to generate paging information of the target video, the paging information comprising at least one of first indication information, second indication information and third indication information, the first indication information being used to indicate that the target video further comprises remaining segments in addition to the target segment interval, the second indication information being used to indicate a starting position of the remaining segments, and the third indication information being used to indicate a paging direction of the target video.
[0058] The sending unit is further configured to send the paging information of the target video to the client device.
[0059] As an optional implementation of the embodiment of the present application,
[0060] The receiving unit is further configured to receive a second video request sent by the client device, the second video request carrying the paging information of the target video.
[0061] The processing unit is further configured to acquire the access information of each remaining second type segment in response to the second video request; the remaining second type segment being the second type segment in the remaining segments in addition to the target segment interval.
[0062] The sending unit is further configured to send the access information of each remaining second type segment to the client device.
[0063] In a fourth aspect, an embodiment of the present application provides a client device, comprising:
[0064] a sending unit configured to send a first video request to a server;
[0065] a receiving unit configured to receive access information of each first type segment of a target video and access information of each second type segment in a target segment interval sent by the server, the first type segment being a segment whose access information does not need to be acquired through a downstream service, and the second type segment being a segment whose access information needs to be acquired through the downstream service;
[0066] an accessing unit configured to acquire playing data of each first type segment of the target video and playing data of each second type segment in the target segment interval according to the access information of each first type segment of the target video and the access information of each second type segment in the target segment interval.
[0067] As an optional embodiment of the present application,
[0068] the sending unit is further configured to receive paging information of the target video sent by the server, the paging information comprising at least one of first indication information, second indication information and third indication information, the first indication information being used to indicate that the target video further comprises remaining segments other than the target segment interval, the second indication information being used to indicate a starting position of the remaining segments, and the third indication information being used to indicate a paging direction of the target video;
[0069] the sending unit is further configured to determine whether a cache playing duration of the target video is less than a threshold duration in real time during playing of the target video, and send a second video request to the server when the cache playing duration is less than the threshold duration, the second video request carrying the paging information of the target video;
[0070] the receiving unit is further configured to receive access information of each remaining second type segment of the target video sent by the server, the remaining second type segment being the second type segment in the remaining segments other than the target segment interval;
[0071] the accessing unit is further configured to acquire playing data of each remaining second type segment of the target video according to the access information of each remaining second type segment of the target video.
[0072] In a fifth aspect, an embodiment of the present application provides an electronic device, comprising a memory and a processor, the memory is configured to store a computer program, and the processor is configured to execute the computer program, so that the electronic device implements the video data access method in any of the above embodiments.
[0073] In a sixth aspect, the embodiments of the present application provide a computer readable storage medium, which, when executed by a computing device, causes the computing device to implement any of the above video data access methods.
[0074] In a seventh aspect, the embodiments of the present application provide a computer program product, which, when executed on a computer, causes the computer to implement any of the above video data access methods.
[0075] The video data access method provided by the embodiments of the present application, when receiving a first video request sent by a client device, first acquires segment information of a target video in response to the first video request, then determines whether to send access information of all segments of the target video to the client device according to the segment information of the target video, and in the case of determining not to send the access information of all segments of the target video to the client device, acquires access information of each first type of segment and access information of each second type of segment in a target segment interval, and sends the access information of each first type of segment and the access information of each second type of segment in the target segment interval to the client device. Since the embodiments of the present application only need to acquire the access information of the first type of segment which does not need to be acquired through a downstream service and the access information of the second type of segment in the target segment interval which needs to be acquired through a downstream service in the case of determining not to send the access information of all segments of the target video to the client device, compared with acquiring the access information of all segments in the target video, the embodiments of the present application can reduce the network overhead between the server and the downstream service. BRIEF DESCRIPTION OF DRAWINGS
[0076] The accompanying drawings, which are incorporated herein and form part of the specification, illustrate embodiments consistent with the present application and, together with the description, further serve to explain the principles of the application.
[0077] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings required to be invoked in the embodiments or prior art description will be briefly introduced as follows, and obviously, other drawings can also be obtained by those skilled in the art without any creative labor.
[0078] Figure 1 A step path diagram for a client to access video data in a paging type data interaction system provided by the embodiments of the present application;
[0079] Figure 2 One of the interactive flowcharts of the video data access method provided by the embodiments of the present application;
[0080] Figure 3The second interactive flowchart of the video data access method provided in the embodiments of the present application is as follows:
[0081] Figure 4 The third interactive flowchart of the video data access method provided in the embodiments of the present application is as follows:
[0082] Figure 5 The structural schematic diagram of the server provided in the embodiments of the present application is as follows:
[0083] Figure 6 The structural schematic diagram of the client device provided in the embodiments of the present application is as follows:
[0084] Figure 7 The hardware structural schematic diagram of the electronic device provided in the embodiments of the present application is as follows. DETAILED DESCRIPTION
[0085] In order to enable the above and other objectives of the present application to be more clearly understood and to be realized, a more detailed description of the present application will be rendered by reference to the following scheme. It is to be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.
[0086] In the following description, a large number of specific details are set forth in order to provide a thorough understanding of the present application. However, the present application can be practiced in other manners different from those described herein. It is apparent that the embodiments described in the specification are only a part of the embodiments of the present application, and not all the embodiments.
[0087] In the embodiments of the present application, the words such as "exemplary" or "for example" are used to mean serving as an example, instance, or illustration. Any embodiment or design scheme described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or advantageous than other embodiments or design schemes. Rather, the words "exemplary" or "for example" are used to present relevant concepts in a concrete manner. In addition, in the description of the embodiments of the present application, the meaning of "plurality" is two or more, unless otherwise specified.
[0088] In the consumption scenario of a video, the core interface is generally designed for data interaction in a paging mode. The client initiates a request each time, the server obtains full access information of a specified number of videos, and returns the information to the client. In this way, the client can obtain full playback data of the videos in advance, and the user can immediately play the switched video without additional network requests when switching videos. For details, refer to Figure 1As shown, under the paging data interaction system, the process of video data access by the client includes: 1. The client device sends a request to the server. 2. The server determines at least one video to be accessed according to a video recommendation algorithm, a video aggregation algorithm, etc. 3. The server obtains access information of each video to be accessed. The access information of the video to be accessed includes: access address of a native video segment in the video to be accessed, access address of a picture in the video to be accessed, and access address of metadata of a sticker in the video to be accessed, etc. The access address of the native video segment in the video to be accessed needs to rely on the downstream service of the server, specifically: sending the ID of the native video segment to the microservice of the video architecture, and receiving the access address of the native video segment returned by the microservice of the video architecture. The access address of the picture in the video to be accessed does not need to rely on the downstream service of the server, and can be directly read through the core storage service. The access address of the metadata of the sticker in the video to be accessed also needs to rely on the downstream service of the server. 4. The server sends the access information of each video to be accessed to the client device. 5. The client device obtains the playback data of each video to be accessed according to the access information of each video to be accessed. Since the server needs to interact with the downstream service in the process of obtaining the access information of the native video in the video to be accessed, the network overhead between the server and the downstream service will be generated in the process of the server obtaining the access information of the video to be accessed.
[0089] In the business scenario where video creation only supports one video or multiple pictures, when obtaining the access information of a video, at most only the access address of one native video needs to be obtained, so the network overhead between the server and the downstream service in the process of obtaining the access information of the video to be accessed is still within the bearing range, but after video creation supports multiple videos and multiple pictures mixed arrangement, the paging mode of sending full access information is still used for designing data interaction. Since the server needs to obtain the access information of each segment in each video after receiving the request of the client, and obtaining the access information of a video may need to obtain the access addresses of multiple native videos, the network overhead between the server and the downstream service will be inflated to a very large value. For example: the server receives a request sent by the client device each time, determines 10 videos to be accessed, each video to be accessed includes 100 native video segments, then for one request sent by the client device, the server needs to obtain the access addresses of 10*100 native video segments through the downstream service. Even if a single call to the downstream service can obtain the access addresses of 20 native video segments, 50 calls to the downstream service are still needed. Compared with the business scenario where video creation only supports one video or multiple pictures, the network overhead between the server and the downstream service is inflated by 50 times.
[0090] The video watching behavior of a user can cause part of network overhead between a server and a downstream service to be invalid. For example, the server obtains access information of all segments of a certain video and sends the access information to a client device. When the user watches the video, the user can only watch the first few segments of the video and then switch to watch other videos because the user is not interested in the video, thereby causing network overhead between the server and the downstream service caused by obtaining access information of segments that are not watched to be invalid. Based on the foregoing, in order to reduce network overhead between the server and the downstream service, an embodiment of the present application provides the following technical solutions.
[0091] Referring to Figure 2 FIG. 1, an embodiment of the present application provides a video data access method. Referring to Figure 2 FIG. 2, the video data access method includes the following steps.
[0092] S201, a client device sends a first video request to a server.
[0093] Correspondingly, the server receives the first video request sent by the client device.
[0094] In some embodiments, the first video request can be a video recommendation request. For example, the terminal device displays videos based on a waterfall view. The terminal device monitors whether the number of cached videos is less than a threshold number in real time during switching of videos by the user through up and down sliding, and triggers the client device to send a video recommendation request to the server when the number of cached videos is less than the threshold number.
[0095] In some embodiments, the first video request can also be a video search request. For example, when the user searches for videos based on a keyword, the client device sends a search video request carrying the keyword to the server. For example, in a daily aggregation scene in which videos published within a preset time period are aggregated into one video, the first video request can be to obtain videos published by the current user within the preset time period.
[0096] S202, the server obtains segment information of a target video in response to the first video request.
[0097] The target video is any video for which access information is to be sent to the client device. The segment information of the target video includes labels of each segment of the target video. The label of any segment is used to indicate whether access information of the segment needs to be obtained through a downstream service.
[0098] The target video can include multiple original videos and multiple pictures at the same time. Video content corresponding to each video or each picture is referred to as a segment of the target video.
[0099] In some embodiments, the implementation of the server obtaining the segment information of the target video can include: obtaining identification information of the target video, and reading the segment information of the target video from a preset storage space according to the identification information of the target video and a corresponding relationship between the identification information and the segment information of the target video.
[0100] In some embodiments, the label of the segment can be 0 or 1, when the label of the segment is 0, it means that the access information of the segment does not need to be obtained through the downstream service, and when the label of the segment is 1, it means that the access information of the segment needs to be obtained through the downstream service.
[0101] S203, the server determines whether to send the access information of all segments of the target video to the client device according to the segment information of the target video.
[0102] That is, according to the segment information of the target video, it is determined whether to page the target video, and only the access information of a segment of the target video is sent to the client device.
[0103] In the above step S203, if it is determined to send the access information of all segments of the target video to the client device, the access information of all segments of the target video is obtained, and the access information of all segments of the target video is sent to the client device; and if it is determined not to send the access information of all segments of the target video to the client device, the following step S204 is performed:
[0104] S204, the server obtains the access information of each first type segment and the access information of each second type segment in the target segment interval.
[0105] The first type segment is a segment whose access information does not need to be obtained through the downstream service, and the second type segment is a segment whose access information needs to be obtained through the downstream service.
[0106] In some embodiments, the access information of the picture does not need to be obtained through the downstream service, and the access information of the video and the sticker needs to be obtained through the downstream service, so the first type segment can be the video content corresponding to the picture, and the second type segment can be the video content corresponding to the picture with the sticker, the video content corresponding to the video, and the video content corresponding to the video with the sticker.
[0107] Since the first type of segment is a segment whose access information does not need to be acquired through the downstream service, the server acquiring the access information of the first type of segment does not bring network overhead between the server and the downstream service, and for the second type of segment whose access information needs to be acquired through the downstream service, only the access information of a part of the second type of segment (the second type of segment in the target segment interval) is acquired, and subsequently, the access information of the remaining other segments is acquired only when needed and is not acquired when not needed, so that the present embodiment can reduce the network overhead between the server and the downstream service.
[0108] S205, the server sends, to the client device, the access information of each first type of segment and the access information of each second type of segment in the target segment interval.
[0109] Correspondingly, the client device receives the access information of each first type of segment and the access information of each second type of segment in the target segment interval sent by the server.
[0110] S206, the client device acquires the playback data of each first type of segment of the target video and the playback data of each second type of segment in the target segment interval according to the access information of each first type of segment of the target video and the access information of each second type of segment in the target segment interval.
[0111] The video data access method provided by the present embodiment, when receiving the first video request sent by the client device, first acquires the segment information of the target video in response to the first video request, then determines whether to send the access information of all segments of the target video to the client device according to the segment information of the target video, and in the case of determining not to send the access information of all segments of the target video to the client device, acquires the access information of each first type of segment and the access information of each second type of segment in the target segment interval, and sends the access information of each first type of segment and the access information of each second type of segment in the target segment interval to the client device. Since the present embodiment only needs to acquire the access information of the first type of segment whose access information does not need to be acquired through the downstream service and the access information of each second type of segment in the target segment interval whose access information needs to be acquired through the downstream service in the case of determining not to send the access information of all segments of the target video to the client device, compared with acquiring the access information of all segments in the target video, the present embodiment can reduce the network overhead between the server and the downstream service.
[0112] As an extension and refinement of the above-mentioned embodiments, the present embodiment also provides another video data access method, which, as shown in Figure 3 The video data access method comprises the following steps:
[0113] S301, the client device sends a first video request to the server.
[0114] Correspondingly, the server receives the first video request sent by the client device.
[0115] S302, the server acquires segment information of a target video in response to the first video request.
[0116] The target video is any video for which access information is to be sent to the client device, and the segment information of the target video includes labels of each segment of the target video, where a label of any segment is used to indicate whether access information of the segment needs to be acquired through a downstream service.
[0117] In some embodiments, the segment information of the target video is pre-generated by the server and saved in a preset storage space, and when the segment information of the target video needs to be acquired, it can be directly read from the preset storage space.
[0118] In some embodiments, the implementation manner in which the server generates and saves the segment information of the target video can include the following steps: determining the content of each segment of the target video; if the content of a first segment of the target video is a picture, determining that access information of the first segment does not need to be acquired through a downstream service; if the content of a second segment of the target video is a picture with a sticker or a video with a sticker or a video with a sticker, determining that access information of the second segment needs to be acquired through a downstream service; and generating and saving the segment information of the target video according to whether access information of each segment of the target video needs to be acquired through a downstream service.
[0119] In the embodiments of the present application, the labels (segment information of the target video) of each segment of the target video can be recorded or saved by bitmap idea with one or more label sequences. In some embodiments, generating and saving the segment information of the target video according to whether access information of each segment of the target video needs to be acquired through a downstream service includes: traversing each segment of the target video, if access information of a current segment does not need to be acquired through a downstream service, setting a label corresponding to the current segment to a first preset value, if access information of the current segment needs to be acquired through a downstream service, setting the label corresponding to the segment to a second preset value, to acquire a label sequence of the target video; acquiring the segment information of the target video according to the label sequence; and saving the segment information of the target video into a preset storage space.
[0120] For example, when the first preset value is 0, the second preset value is 1, the target video includes 30 segments, and the first, fourth, fifth, seventh, eleventh, fifteenth, seventeenth, eighteenth, twenty-fourth, twenty-sixth, and twenty-ninth segments of the target video are segments that need to be acquired through the downstream service, and the remaining segments are segments that do not need to be acquired through the downstream service, the tag sequence of the target video can be as follows:
[0121] 100110100010001011000001010010.
[0122] Further, when saving the segment information of the target video, the tag sequence of the target video can be directly saved as the segment information of the target video, the tag sequence of the target video can be compressed to reduce the storage space occupied by the segment information of the target video. For example, the tag sequence of the target video can be first converted into a decimal number, and then converted into a hexadecimal number, and the large hexadecimal number can be saved as a string attribute.
[0123] It should be noted that, although the bitmap idea can be used to record or save the tags of the segments of the target video (the segment information of the target video) in the embodiments of the present application, the form of saving the segment information of the target video is not limited in the embodiments of the present application, and the tags of the segments of the target video can be acquired according to the segment information of the target video. For example, the segment information of the target video can be saved in the form of a mapping relationship table of tags and segment indexes, and for another example, the segment information of the target video can be saved in the form of a string composed of tag values of the segments.
[0124] S303, the server acquires the total segment quantity of the target video according to the segment information of the target video.
[0125] In some embodiments, the total segment quantity of the target video can be determined according to the tag data in the segment information of the target video.
[0126] S304, the server determines whether the total segment quantity of the target video is greater than a preset segment quantity.
[0127] In some embodiments, the preset segment quantity can be the quantity of the segments in the target segment range.
[0128] In the above embodiments, if the total segment quantity of the target video is less than or equal to the preset segment quantity, the following step S305 is performed:
[0129] S305, the server determines to send the access information of all the segments of the target video to the client device.
[0130] For example, if the total number of segments of the target video is 15, and the first 20 segments of the target video are required to be sent to the client device, it is not necessary to page the target video.
[0131] In step S304, if the total number of segments of the target video is greater than the preset number of segments, step S306 is performed.
[0132] In step S306, the server determines whether the second type of segments is included in the remaining segments other than the segments in the target segment interval.
[0133] In step S306, if the second type of segments is not included in the remaining segments, obtaining the access information of the remaining segments does not cause network overhead between the server and the downstream service, and therefore it is not necessary to page the target video, and step S305 is returned to determine whether to send the access information of all segments of the target video to the client device.
[0134] In step S306, if the second type of segments is included in the remaining segments, obtaining the access information of the remaining segments causes network overhead between the server and the downstream service, and therefore step S307 is performed.
[0135] In step S307, the server determines not to send the access information of all segments of the target video to the client device.
[0136] After determining not to send the access information of all segments of the target video to the client device, the embodiment of the application continues to perform the following steps.
[0137] In step S308, the paging direction of the target video is determined.
[0138] In general, video watching starts from the first segment and plays in sequence, but in some special scenarios, there is a demand to play in reverse order from the tail of the video. For example, in a daily aggregation scenario, a user jumps to the earliest unread work when starting to play a video, and at this time, the user may need to play in reverse order from the back to the front. Therefore, in the embodiment of the application, the paging direction of the target video can be a sequence direction or a reverse direction.
[0139] In step S309, the target segment interval is determined according to the paging direction of the target video and the preset interval length.
[0140] In some embodiments, the paging direction of the target video is a sequence direction, and the target segment interval includes the preset interval length of video segments at the head of the target video. For example, if the preset interval length is 20, the target segment interval includes the first 20 segments of the target video.
[0141] In some embodiments, the target video has a reverse direction of the paging direction, and the target segment interval includes a preset interval length of video segments at a tail of the target video. For example, the preset interval length is 15, and the target segment interval includes the last 15 segments of the target video.
[0142] In some embodiments, determining the paging direction of the target video includes: determining whether the first video request carries direction indication information, and if the first video request does not carry the indication information, using a default order direction as the paging direction of the target video, and if the first video request carries the indication information, determining the paging direction of the target video as a reverse direction.
[0143] S310, the server acquires access information of each first type segment and access information of each second type segment in the target segment interval.
[0144] S311, the server sends the access information of each first type segment and the access information of each second type segment in the target segment interval to the client device.
[0145] Correspondingly, the client device receives the access information of each first type segment and the access information of each second type segment in the target segment interval sent by the server.
[0146] S312, the client device acquires the play data of each first type segment of the target video and the play data of each second type segment in the target segment interval according to the access information of each first type segment of the target video and the access information of each second type segment in the target segment interval.
[0147] In Figure 2 the embodiments shown in the specification or Figure 3 the embodiments shown in the specification, the method provided by the embodiments of the present application further includes the following steps: Figure 4
[0148] S401, the server generates paging information of the target video.
[0149] The paging information includes at least one of first indication information, second indication information and third indication information, the first indication information is used to indicate that the target video further includes remaining segments other than the target segment interval, the second indication information is used to indicate a starting position of the remaining segments, and the third indication information is used to indicate a paging direction of the target video.
[0150] S402, the server sends the paging information of the target video to the client device.
[0151] Correspondingly, the client device receives the paging information of the target video sent by the server.
[0152] It should be noted that the paging information of the target video can be sent to the client device independently, or can be sent to the client device together with the access information of each first type segment and the access information of each second type segment in the target segment interval.
[0153] S403, the client device determines whether the cache playing duration of the target video is less than the threshold duration in real time during playing the target video.
[0154] That is, the client device determines whether the cache playing duration of the target video is less than the threshold duration in real time during playing the target video based on the playing data of each first type segment of the target video and the playing data of each second type segment in the target segment interval.
[0155] In the above step S403, if the cache playing duration of the target video is less than the threshold duration, the following step S404 is performed:
[0156] S404, the client device sends a second video request to the server.
[0157] Correspondingly, the server receives the second video request sent by the client device.
[0158] The second video request carries the paging information of the target video.
[0159] S405, the server acquires the access information of each remaining second type segment in response to the second video request.
[0160] The remaining second type segment is the second type segment in the remaining segment except the target segment interval.
[0161] S406, the server sends the access information of each remaining second type segment to the client device.
[0162] Correspondingly, the client device receives the access information of each remaining second type segment of the target video sent by the server.
[0163] After sending the access information of each first type segment and the access information of each second type segment in the target segment interval to the client device, only the access information of the remaining second type segment is not sent to the client device. Therefore, after the server sends the access information of each remaining second type segment to the client device, the client device can acquire the full playing data of the target video, thereby supporting complete playing of the target video.
[0164] S407, the client device acquires the playing data of each remaining second type segment of the target video according to the access information of each remaining second type segment of the target video.
[0165] Based on the same inventive concept, as an implementation of the above method, the embodiments of the present application also provide a server and a client device, which correspond to the above method embodiments. For the convenience of reading, the details of the above method embodiments will not be repeated in the embodiments, but it should be clear that the server and the client device in the embodiments can correspondingly implement all the contents in the above method embodiments.
[0166] The embodiments of the present application provide a server, Figure 5 The structural diagram of the server is shown in the figure, Figure 5 The server 500 comprises:
[0167] The receiving unit 51 is configured to receive the first video request sent by the client device.
[0168] The obtaining unit 52 is configured to obtain the segment information of a target video in response to the first video request, the target video being any video to be sent to the client device with access information, the segment information of the target video comprising the labels of each segment of the target video, the label of any segment being used to indicate whether the access information of the segment needs to be obtained through a downstream service.
[0169] The processing unit 53 is configured to determine whether to send the access information of all segments of the target video to the client device according to the segment information of the target video, and in the case of determining not to send the access information of all segments of the target video to the client device, obtain the access information of each first type segment and the access information of each second type segment in the target segment interval; the first type segment is a segment whose access information does not need to be obtained through a downstream service, and the second type segment is a segment whose access information needs to be obtained through a downstream service.
[0170] The sending unit 54 is configured to send the access information of each first type segment and the access information of each second type segment in the target segment interval to the client device.
[0171] As an optional implementation of the embodiment of the present application, the processing unit 53 is specifically configured to determine whether the total number of segments of the target video is greater than a preset segment number; if not, determine to send access information of all segments of the target video to the client device; if yes, determine whether the second type of segment is included in the remaining segments except the segments in the target segment interval; if the second type of segment is not included in the remaining segments, determine to send the access information of all segments of the target video to the client device; if the second type of segment is included in the remaining segments, determine not to send the access information of all segments of the target video to the client device.
[0172] As an optional implementation of the embodiment of the present application, the processing unit 53 is further configured to determine a paging direction of the target video before obtaining the access information of each first type of segment and the access information of each second type of segment in the target segment interval; and determine the target segment interval according to the paging direction of the target video and a preset interval length.
[0173] As an optional implementation of the embodiment of the present application, the processing unit 53 is specifically configured to determine whether the direction indication information is carried in the first video request; if not, determine a forward direction as the paging direction of the target video; if yes, determine a reverse direction as the paging direction of the target video.
[0174] As an optional implementation of the embodiment of the present application, the processing unit 53 is further configured to determine the content of each segment of the target video before obtaining the segment information of the target video in response to the first video request; if the content of a first segment of the target video is a picture, determine that the access information of the first segment does not need to be obtained through a downstream service; if the content of a second segment of the target video is a picture with a sticker or a video or a video with a sticker, determine that the access information of the second segment needs to be obtained through a downstream service; and generate and save the segment information of the target video according to whether the access information of each segment of the target video needs to be obtained through a downstream service.
[0175] As an optional implementation of the embodiment of the present application, the processing unit 53 is specifically configured to traverse each segment of the target video; if the access information of a current segment does not need to be obtained through a downstream service, set a label corresponding to the current segment to a first preset value; if the access information of the current segment needs to be obtained through a downstream service, set the label corresponding to the segment to a second preset value, so as to obtain a label sequence of the target video; obtain the segment information of the target video according to the label sequence; and save the segment information of the target video into a preset storage space.
[0176] As an optional implementation of the embodiment of the present application, the processing unit 53 is further configured to generate the paging information of the target video, the paging information comprising at least one of the first indication information, the second indication information and the third indication information, the first indication information being used to indicate that the target video further comprises a remaining segment other than the target segment interval, the second indication information being used to indicate a starting position of the remaining segment, and the third indication information being used to indicate a paging direction of the target video.
[0177] The sending unit 54 is further configured to send the paging information of the target video to the client device.
[0178] As an optional implementation of the embodiment of the present application,
[0179] The receiving unit 51 is further configured to receive a second video request sent by the client device, the second video request carrying the paging information of the target video.
[0180] The processing unit 53 is further configured to acquire access information of each remaining second type segment in response to the second video request, the remaining second type segment being the second type segment in the remaining segment other than the target segment interval.
[0181] The sending unit 54 is further configured to send the access information of each remaining second type segment to the client device.
[0182] The embodiment of the present application provides a client device, Figure 6 A structural schematic diagram of the client device is shown in Figure 6 The client device 600 comprises:
[0183] A sending unit 61 configured to send a first video request to a server.
[0184] A receiving unit 62 configured to receive access information of each first type segment of a target video and access information of each second type segment in a target segment interval sent by the server, the first type segment being a segment whose access information does not need to be acquired through a downstream service, and the second type segment being a segment whose access information needs to be acquired through the downstream service.
[0185] An accessing unit 63 configured to acquire playing data of each first type segment of the target video and playing data of each second type segment in the target segment interval according to the access information of each first type segment of the target video and the access information of each second type segment in the target segment interval.
[0186] As an optional implementation of the embodiment of the present application,
[0187] The sending unit 61 is further configured to receive the paging information of the target video sent by the server, the paging information comprising at least one of first indication information, second indication information and third indication information, the first indication information being used to indicate that the target video further comprises remaining segments other than the target segment interval, the second indication information being used to indicate the starting position of the remaining segments, and the third indication information being used to indicate the paging direction of the target video.
[0188] The sending unit 61 is further configured to, in the process of playing the target video, determine whether the cache playing duration of the target video is less than a threshold duration in real time, and send a second video request to the server when the cache playing duration is less than the threshold duration, the second video request carrying the paging information of the target video.
[0189] The receiving unit 62 is further configured to receive the access information of each remaining second type segment of the target video sent by the server, the remaining second type segment being the second type segment in the remaining segments other than the target segment interval.
[0190] The access unit 63 is further configured to acquire the playing data of each remaining second type segment of the target video according to the access information of each remaining second type segment of the target video.
[0191] Based on the same inventive concept, the embodiment of the present application further provides an electronic device. Figure 7 As shown in the structural schematic diagram of the electronic device provided by the embodiment of the present application, Figure 7 The electronic device provided by the embodiment of the present application comprises a memory 701 and a processor 702, the memory 701 is used to store a computer program, and the processor 702 is used to execute the computer program to execute the video data access method provided by the above-mentioned embodiment when executing the computer program.
[0192] Based on the same inventive concept, the embodiment of the present application further provides a computer readable storage medium, the computer readable storage medium stores a computer program, when the computer program is executed by a processor, the computer program causes the computing device to implement the video data access method provided by the above-mentioned embodiment.
[0193] Based on the same inventive concept, the embodiment of the present application further provides a computer program product, when the computer program product runs on a computer, the computer program product causes the computing device to implement the video data access method provided by the above-mentioned embodiment.
[0194] Those skilled in the art will appreciate that embodiments of the present application can be devised for a method, a system, or a computer program product. Accordingly, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application can take the form of a computer program product on one or more computer readable storage media having computer readable program code embodied in the medium.
[0195] The processor can be a Central Processing Unit (CPU), a general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or the like. The general purpose processor can be a microprocessor, or the processor can be any conventional processor, etc.
[0196] The memory can include non-persistent memory and / or volatile memory, e.g., random access memory (RAM) and / or non-volatile memory, e.g., read only memory (ROM), electrically erasable programmable read only memory (EEPROM), flash memory, or the like. The memory is an example of computer readable media.
[0197] Computer readable media includes permanent and non-permanent, movable and non-movable storage media. The storage media can be implemented by any method or technology to store information, which can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), electrically erasable programmable read only memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette, magnetic disk storage or other magnetic storage device, or any other non-transmission medium that can be used to store information accessible by a computing device. According to the definition herein, computer readable media does not include transitory media, such as modulated data signals and carriers.
[0198] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, and are not intended to limit the present application. Although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacements for part or all of the technical features, and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for accessing video data, characterized in that, include: Receive the first video request sent by the client device; In response to the first video request to obtain segment information of the target video, the target video is any video to be sent access information to the client device, and the segment information of the target video includes the tags of each segment of the target video, and the tag of any segment is used to indicate whether the access information of the segment needs to be obtained through a downstream service; Based on the segment information of the target video, determine whether to send access information for all segments of the target video to the client device; The system determines not to send access information for all segments of the target video to the client device, obtains access information for each first-type segment and access information for each second-type segment within the target segment interval, and sends access information for each first-type segment and access information for each second-type segment within the target segment interval to the client device; the first-type segments are segments whose access information does not need to be obtained through downstream services, and the second-type segments are segments whose access information needs to be obtained through downstream services.
2. The method according to claim 1, characterized in that, The step of determining whether to send access information for all segments of the target video to the client device based on the segment information of the target video includes: The total number of segments in the target video is obtained based on the segment information of the target video; Determine whether the total number of segments in the target video is greater than the preset number of segments; If not, then determine to send access information for all segments of the target video to the client device; if yes, then determine whether the remaining segments other than those in the target segment interval include the second type of segments; if the remaining segments do not include the second type of segments, then determine to send access information for all segments of the target video to the client device; if the remaining segments include the second type of segments, then determine not to send access information for all segments of the target video to the client device.
3. The method according to claim 1, characterized in that, Before obtaining the access information of each first-type segment and the access information of each second-type segment within the target segment interval, the method further includes: Determine the pagination direction of the target video; The target segment interval is determined based on the pagination direction of the target video and the preset interval length.
4. The method according to claim 3, characterized in that, Determining the pagination direction of the target video includes: Determine whether the first video request carries directional indication information; If not, then determine the pagination direction of the target video; If so, then determine the reverse order of the pagination direction of the target video.
5. The method according to claim 1, characterized in that, Before obtaining segment information of the target video in response to the first video request, the method further includes: Determine the content of each segment of the target video; If the content of the first segment of the target video is an image, then it is determined that the access information of the first segment does not need to be obtained through downstream services; If the content of the second segment of the target video is an image or video with stickers, or a video with stickers, then it is determined that the access information of the second segment needs to be obtained through a downstream service. Based on whether the access information of each segment of the target video needs to be obtained through downstream services, the segment information of the target video is generated and saved.
6. The method according to claim 5, characterized in that, The step of generating and saving segment information of the target video based on whether the access information of each segment of the target video needs to be obtained through downstream services includes: Traverse each segment of the target video. If the access information of the current segment does not need to be obtained through downstream services, set the tag corresponding to the current segment to a first preset value. If the access information of the current segment needs to be obtained through downstream services, set the tag corresponding to the segment to a second preset value to obtain the tag sequence of the target video. Obtain segment information of the target video based on the tag sequence; Save the segment information of the target video to a preset storage space.
7. The method according to any one of claims 1-6, characterized in that, The method further includes: Generate pagination information for the target video, the pagination information including at least one of a first indication information, a second indication information, and a third indication information, wherein the first indication information is used to indicate that the target video also includes remaining segments other than the target segment interval; the second indication information is used to indicate the starting position of the remaining segments; and the third indication information is used to indicate the pagination direction of the target video. The pagination information of the target video is sent to the client device.
8. The method according to claim 7, characterized in that, The method further includes: Receive a second video request sent by the client device, the second video request carrying pagination information of the target video; In response to the second video request, access information for each remaining second-type segment is obtained; the remaining second-type segments are the second-type segments among the remaining segments excluding the target segment interval; Access information for each remaining second-class fragment is sent to the client device.
9. A method for accessing video data, characterized in that, include: Send the first video request to the server; The system receives access information for each first-type segment of the target video and access information for each second-type segment within the target segment range sent by the server. The first-type segments are segments whose access information does not need to be obtained through downstream services, and the second-type segments are segments whose access information needs to be obtained through downstream services. Based on the access information of each first type segment of the target video and the access information of each second type segment within the target segment interval, the playback data of each first type segment of the target video and the playback data of each second type segment within the target segment interval are obtained.
10. The method according to claim 9, characterized in that, The method further includes: The system receives pagination information of the target video sent by the server. The pagination information includes at least one of a first indication information, a second indication information, and a third indication information. The first indication information is used to indicate that the target video also includes remaining segments other than the target segment interval. The second indication information is used to indicate the starting position of the remaining segments. The third indication information is used to indicate the pagination direction of the target video. During the playback of the target video, it is determined in real time whether the cached playback duration of the target video is less than the threshold duration; When the cached playback duration is less than the threshold duration, a second video request is sent to the server, the second video request carrying the pagination information of the target video; The server receives access information for each remaining second-type segment of the target video, wherein the remaining second-type segments are the second-type segments among the remaining segments excluding the target segment interval. Based on the access information of each remaining second-type segment of the target video, the playback data of each remaining second-type segment of the target video is obtained.
11. A server, characterized in that, include: The receiving unit is used to receive the first video request sent by the client device; The acquisition unit is configured to acquire segment information of a target video in response to the first video request. The target video is any video to be sent access information to the client device. The segment information of the target video includes tags of each segment of the target video. The tag of any segment is used to indicate whether the access information of that segment needs to be acquired through a downstream service. The processing unit is configured to determine whether to send access information for all segments of the target video to the client device based on the segment information of the target video, and, if it is determined that access information for all segments of the target video should not be sent to the client device, to obtain access information for each first type of segment and access information for each second type of segment within the target segment interval; the first type of segment refers to segments whose access information does not need to be obtained through downstream services, and the second type of segment refers to segments whose access information needs to be obtained through downstream services. The sending unit is used to send access information of each first type of segment and access information of each second type of segment within the target segment interval to the client device.
12. A client device, characterized in that, include: The sending unit is used to send the first video request to the server; The receiving unit is used to receive access information of each first type of segment of the target video and access information of each second type of segment within the target segment range sent by the server. The first type of segment is the segment whose access information does not need to be obtained through the downstream service, and the second type of segment is the segment whose access information needs to be obtained through the downstream service. The access unit is configured to obtain playback data of each first-type segment of the target video and playback data of each second-type segment within the target segment interval based on the access information of each first-type segment of the target video and the access information of each second-type segment within the target segment interval.
13. An electronic device, characterized in that, include: A memory and a processor, the memory being used to store a computer program and the processor being used to cause the electronic device to implement the video data access method according to any one of claims 1-10 when executing the computer program.
14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a computing device, causes the computing device to implement the video data access method according to any one of claims 1-10.
Citation Information
Patent Citations
Video processing method and device
CN108156528A
Video service processing method and device
CN114374860A