Video transmission method and device, server and storage medium
By obtaining the shooting time of video frames to be played back from multiple video channels, and transmitting them in chronological order based on a transmission link, the problem of synchronous transmission of video channels in the existing technology is solved, and the quality of video playback is improved.
Patent Information
- Application Number
- CN202410674413.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-27
- Publication Date
- 2024-09-17
AI Technical Summary
Existing video transmission methods are difficult to achieve synchronous transmission of multiple video channels in vehicle historical video playback scenarios, resulting in low video playback quality.
By obtaining the shooting time of video frames to be played back from multiple video channels, a set of video frames is transmitted to the user terminal in time order based on a transmission link to achieve synchronous transmission of video frames.
It realizes the synchronous transmission of video channels, improves the quality of video playback, and avoids the problem of successful response of some channels and failure of other channels.
Smart Images

Figure CN118660191A
Abstract
Description
Technical Field
[0001] The present application belongs to the field of communication technology, and in particular, relates to a video transmission method, device, server and storage medium. Background Art
[0002] At present, for the historical video playback scenario of a vehicle, since the vehicle is equipped with multiple cameras at different angles, the vehicle-mounted device used to play the video corresponds to multiple video channels (one camera corresponds to one video channel). In order to facilitate users to fully understand the situation inside and outside the vehicle, it is necessary to play historical videos of multiple video channels at the same time. Therefore, the server needs to transmit the historical videos of multiple video channels to the client for playback.
[0003] However, when existing video transmission methods detect a user's playback request, they usually directly transmit historical videos of multiple channels to the client through their own independent transmission links. This is not comprehensive enough to meet actual needs, thereby reducing the quality of video playback. Summary of the invention
[0004] The embodiments of the present application provide a video transmission method, device, server and storage medium, which improve the video playback quality.
[0005] In a first aspect, an embodiment of the present application provides a video transmission method, including:
[0006] Obtaining videos to be played back corresponding to each of the multiple video channels, and determining the shooting time of each of the multiple video frames in each of the videos to be played back;
[0007] Based on a transmission link, video frame sets at different times are transmitted to a user terminal in chronological order; wherein the video frame sets include video frames corresponding to each of the videos to be played back at the same shooting time.
[0008] Optionally, obtaining the to-be-played videos corresponding to each of the multiple video channels includes:
[0009] For any video channel, when it is detected that any playback time point has been reached, video information of the any video channel is obtained; the video information is used to describe whether a server video cache library has a first video of the any video channel at the playback time point; the server video cache library is located in the server;
[0010] If the first video exists in the server video cache library, the first video is obtained from the server video cache library, and the first video is determined as the video to be played back corresponding to any one of the video channels;
[0011] If the first video does not exist in the server video cache library, the second video is obtained from the device video library provided in the shooting device corresponding to the any one video channel, and the second video is determined as the video to be played back corresponding to the any one video channel.
[0012] Optionally, the acquiring the video information of any one of the video channels includes:
[0013] Generate target video file information according to the server video cache library and the device video libraries corresponding to the multiple video channels; wherein the target video file information includes the target start time, target video duration and target video source at each time of the target video corresponding to the multiple video channels;
[0014] The video information of any one video channel is determined according to the target video file information.
[0015] Optionally, any one of the playback time points is determined according to the following method:
[0016] Determine, according to the target video file information, a cached video corresponding to any one of the video channels in the server video cache library;
[0017] The arbitrary playback time point is set according to the start time and the end time of the cached video.
[0018] Optionally, generating target video file information according to the server video cache library and the device video libraries corresponding to the multiple video channels respectively includes:
[0019] Determine a playback time period according to the received video playback request;
[0020] If the playback time period is within the cache time of the server video cache library, obtaining first video file information of each of the multiple video channels from the server video cache library;
[0021] If the server video cache library contains the first video file information of each of the plurality of video channels, the target video file information is generated according to each of the first video file information.
[0022] Optionally, after obtaining the first video file information of each of the plurality of video channels from the server video cache library, the method further includes:
[0023] If the first video file information of the first video channel does not exist in the video cache library of the server, obtaining the second video file information of the first video channel from the device video library corresponding to the first video channel;
[0024] The target video file information is generated according to each of the first video file information and the second video file information.
[0025] Optionally, each of the first video file information includes a first start time and a first video duration of each first sub-video, and the second video file information includes a second start time and a second video duration of a second sub-video; and generating the target video file information according to each of the first video file information and the second video file information includes:
[0026] According to the processing strategy, each of the first start times, each of the first video durations, the second start time and the second video duration, each of the first video file information and the second video file information is deduplicated and merged to obtain the target video file information.
[0027] In a second aspect, an embodiment of the present application provides a video transmission device, including:
[0028] A first acquisition unit is used to acquire the to-be-played videos corresponding to the multiple video channels, and determine the shooting time of the multiple video frames in each of the to-be-played videos;
[0029] A transmission unit is used to transmit video frame sets at different times to a user terminal in chronological order based on a transmission link; wherein the video frame set includes video frames corresponding to each of the videos to be played back at the same shooting time.
[0030] In a third aspect, an embodiment of the present application provides a server, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the video transmission method as described in any one of the first aspects above is implemented.
[0031] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the video transmission method as described in any one of the above-mentioned first aspects is implemented.
[0032] In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program product runs on a server, the server can execute the video transmission method described in any one of the first aspects above.
[0033] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:
[0034] The embodiment of the present application provides a video transmission method, which obtains the to-be-played videos corresponding to each of the multiple video channels, and determines the shooting time of each of the multiple video frames in each of the to-be-played videos; based on a transmission link, the video frame sets at different times are transmitted to the user terminal in chronological order; wherein the video frame set includes the video frames corresponding to each of the to-be-played videos at the same shooting time. Compared with the prior art, the method can transmit the video frame sets at different times to the user terminal in chronological order based on a transmission link, which not only realizes the multiplexing of the transmission link, but also enables the video frames of the to-be-played videos corresponding to all the video channels at the same shooting time to arrive at the user terminal at the same time, that is, synchronous transmission is realized, thereby ensuring that the video screen can respond synchronously, and there will be no problem that some video channels respond successfully and some video channels fail to respond, thereby improving the video playback quality. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0036] Figure 1 is a structural diagram of a video transmission system provided by an embodiment of the present application;
[0037] Figure 2 is a flow chart of an implementation of a video transmission method provided by an embodiment of the present application;
[0038] Figure 3 is a flow chart of an implementation of a video transmission method provided by another embodiment of the present application;
[0039] Figure 4 is a flow chart of an implementation of a video transmission method provided in yet another embodiment of the present application;
[0040] Figure 5 is a flow chart of an implementation of a video transmission method provided by another embodiment of the present application;
[0041] Figure 6 is a flow chart of an implementation of a video transmission method provided by another embodiment of the present application;
[0042] Figure 7 It is a schematic diagram of the principle of deduplication processing and merging processing provided by an embodiment of the present application;
[0043] Figure 8 is a structural schematic diagram of a video transmission device provided by an embodiment of the present application;
[0044] Fig. 9 It is a schematic diagram of the structure of a server provided in one embodiment of the present application. DETAILED DESCRIPTION
[0045] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0046] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0047] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0048] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0049] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0050] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0051] In actual applications, for the historical video playback scenario of a vehicle, since the vehicle is equipped with multiple cameras at different angles, the vehicle-mounted device used to play the video corresponds to multiple video channels (one camera corresponds to one video channel). In order to facilitate users to fully understand the situation inside and outside the vehicle, it is necessary to play historical videos of multiple video channels at the same time. Therefore, the server needs to transmit the historical videos of multiple video channels to the client for playback.
[0052] However, when the existing video transmission method detects the user's playback request, when the server has the historical video of a certain shooting device, the client requests the platform to play the video file; when the server does not have the historical video of a certain shooting device, the server needs to first obtain the corresponding historical video from the shooting device. Then forward it to the client for playback. At the same time, the server usually directly transmits the historical videos of multiple video channels to the client through their own independent transmission links, which is not comprehensive enough and difficult to meet actual needs, thereby reducing the quality of video playback.
[0053] Therefore, in order to achieve the synchronous transmission of historical videos of each video channel and improve the quality of video playback, in all embodiments of the present application, the server in the video transmission system can specifically realize accurate identification of multiple parts through the various method embodiments corresponding to the following figure, which will not be elaborated here.
[0054] See also Figure 1 , Figure 1 Schematic diagram of the structure of a video transmission system provided by an embodiment of the present application. Figure 1 As shown, the video transmission system 1 provided in the embodiment of the present application includes: a server 10, a user terminal 20 and at least one shooting device 30. The server 10 is respectively connected to the user terminal 20 and at least one shooting device 30 (only one is shown in the figure). The above communication connection mode can be a wireless communication connection or a wired communication connection.
[0055] It should be noted that one shooting device 30 corresponds to one video channel.
[0056] In the embodiment of the present application, the server 10 plays the role of accessing the shooting device 30 and forwarding audio and video. After the shooting device 30 uploads the audio and video stream captured by itself to the server 10, the server 10 needs to decapsulate the above audio and video stream, and then encapsulate and forward it according to streaming media protocols such as HTTP-FLV and RTMP.
[0057] The user terminal 20 is an audio and video playback client, which can be a laptop, smart phone, desktop computer, etc. When the user clicks on the preset control for playing the device audio and video on the user terminal 20, the user terminal 20 pulls the audio and video data from the server 10, and then demultiplexes the audio and video data, synchronizes the audio and video, and then decodes and plays the audio and video through the browser's Media Source Extensions (MSE).
[0058] In one embodiment of the present application, in order to achieve synchronous audio and video playback of multiple video channels on the user terminal 20 without plug-ins, the user terminal 20 will implement the mediaSdk library, which does not require the installation of any plug-ins and can be directly called by the web program.
[0059] Among them, the mediaSdk library contains two components:
[0060] 1) MediaPlayer.wasm module, using WebAssembly technology to compile C / C++ programs including audio and video decapsulation submodule, FFmpeg submodule, and FMP4 encapsulation template into mediaPlayer.wasm module, to implement core business logic such as audio and video frame decapsulation, synchronization, and FMP4 file encapsulation. WebAssembly technology is used to compile C / C++ programs into LLVM bytecode, which has the characteristics of high security and fast running speed.
[0061] 2) The mediaPlayer.js module uses JavaScript language to implement the audio and video streaming module and the MSE playback module. When a user requests a video, the audio and video data is pulled from the server 10 through the audio and video streaming module and input into the mediaPlayer.wasm for data processing. The output FMP4 data block is then input into the MSE playback module. Finally, the user terminal 20 can decode and play the audio and video data normally, and the user can hear the sound and see the video.
[0062] In the embodiment of the present application, the shooting device 30 is an audio and video content producer. After the shooting device 30 is powered on, it will collect audio and video data in real time through the microphone and camera, and then perform H264 or H265 video encoding compression, and then store the recorded audio and video files in the hard disk or SD card of the device. When the user requests historical video playback of multiple video channels, the shooting device 30 corresponding to each of the multiple video channels will search for audio and video from its own hard disk or SD card, and then composite the audio and video streams of each of the multiple video channels into the same TCP media link for transmission.
[0063] It should be noted that after the shooting device 30 is started, a signaling link is established with the server 10 through the configured server address, and then a registration package is sent to the server 10 .
[0064] The server 10 verifies the legitimacy of the photographing device 30 according to the registration package by placing the photographing device 30 into an online state.
[0065] After the camera 30 goes online, the server will immediately query the video file information of the camera 30 within the set time period, and cache the video file information transmitted by the camera 30 in the server 10. The server 10 will then update the cache regularly every day to ensure that the video file information cached by the server includes the video file information actually stored by the camera 30. The set time period can be set according to actual needs and is not limited here. For example, the set time period can be from one week ago to the present.
[0066] It should be noted that after the shooting device 30 successfully uploads the video file information to the server 10, the server 10 can generate index information of the video key frame (I frame) and the file location, and then store the video file information and index information in the server video cache library (ie, file management service) of the server, and synchronously record the basic information of the video file, such as the video channel number, start time, and end time.
[0067] See also Figure 2 , Figure 2 1 is a flowchart of a video transmission method provided in an embodiment of the present application. In the embodiment of the present application, the execution subject of the video transmission method is a server. The server can be a desktop computer, a computer or other device, or a cloud server.
[0068] like Figure 2 As shown, the video transmission method provided in an embodiment of the present application may include S101 to S102, which are described in detail as follows:
[0069] In S101, the to-be-played videos corresponding to the respective multiple video channels are obtained, and the shooting time of the respective multiple video frames in each of the to-be-played videos is determined.
[0070] In actual applications, when a user needs to fully understand the conditions inside and outside the vehicle during a historical period, a video playback instruction can be sent to the user terminal.
[0071] In the embodiment of the present application, the user terminal detecting the video playback instruction may include: detecting that the user performs a preset operation. The preset operation may be determined according to actual needs and is not limited here. Exemplarily, the preset operation may include: a preset control in the user terminal is triggered. Based on this, when the user terminal detects that its own preset control is triggered, it indicates that the preset operation is detected, that is, the video playback instruction is detected.
[0072] Afterwards, the user terminal may send a video playback request to the server based on the above video playback instruction.
[0073] In the embodiment of the present application, after receiving the video playback request sent by the user terminal, the server can obtain the to-be-played videos corresponding to each of the multiple video channels, and determine the shooting time of each of the multiple video frames in each of the to-be-played videos.
[0074] It should be noted that one video channel corresponds to one video to be played back.
[0075] In one embodiment of the present application, since the server itself is provided with a server video cache library for caching videos recently shot and uploaded by various shooting devices and video file information corresponding to the videos, the server can specifically perform the following steps: Figure 3 Steps S201 to S203 shown in the figure obtain the to-be-played videos corresponding to the respective multiple video channels, as detailed as follows:
[0076] In S201, for any video channel, when it is detected that any playback time point has been reached, the video information of the any video channel is obtained; the video information is used to describe whether the server video cache library has the first video of the any video channel at the playback time point; the server video cache library is located in the server.
[0077] In this embodiment, in order to achieve synchronous transmission of multiple video channels, the server is set with multiple playback time points.
[0078] For any video channel, when the server detects that any playback time point has been reached, that is, when the video frame at the set time needs to be played, the server can obtain the video information of the any video channel. The video information is used to describe whether the server video cache library has the first video of the any video channel at the playback time point. The set time can be set according to actual needs and is not limited here.
[0079] In one embodiment of the present application, the server can specifically Figure 4 The steps S301 to S302 shown implement step S201, which are described in detail as follows:
[0080] In S301, target video file information is generated according to the server video cache library and the device video library corresponding to each of the multiple video channels; wherein the target video file information includes the target start time, target video duration and target video source at each moment of the target video corresponding to each of the multiple video channels.
[0081] In this embodiment, since the server itself is provided with a device for caching videos recently shot and uploaded by various shooting devices and the video file information corresponding to the videos, and each shooting device itself is also provided with a device video library for storing the shot videos and the video file information corresponding to the videos, the server can generate the target video file information based on the server video cache library and the device video libraries corresponding to each of the multiple video channels.
[0082] The video file information includes but is not limited to the start time, video length, and end time of the corresponding video.
[0083] The target video file information includes the target start time, target video duration, and target video source at each time of the target videos corresponding to the multiple video channels.
[0084] In one embodiment of the present application, in order to save the transmission traffic generated by the shooting device during the transmission process, the server can specifically Figure 5 Steps S401 to S403 shown generate target video file information, which is described in detail as follows:
[0085] In S401, a playback time period is determined according to the received video playback request.
[0086] In this embodiment, since the video playback request carries the playback time period, after receiving the video playback request sent by the user terminal, the server can determine the playback time period according to the video playback request.
[0087] Afterwards, the server may detect whether the playback time period is within the cache time of the server's own server video cache library.
[0088] In one embodiment of the present application, when the server detects that the playback time period is within the cache time of the server's own server video cache library, the server may execute steps S402 to S403.
[0089] In another embodiment of the present application, when the server detects that the playback time period is not within the cache time of the server's own server video cache library, it indicates that the video file information within the playback time period is not cached in the server's server video cache library. In other words, the server cannot obtain the video file information corresponding to the historical videos of each video channel within the playback time period from its own server video cache library. Therefore, the server can directly obtain the video file information corresponding to the historical videos of each video channel from the device video library provided in each shooting device.
[0090] Afterwards, the terminal device may directly determine the video file information corresponding to the historical video of each video channel obtained from the device video library provided by each of the above-mentioned shooting devices as the target video file information.
[0091] In S402, if the playback time period is within the cache time of the server video cache library, first video file information of each of the multiple video channels is obtained from the server video cache library.
[0092] In this embodiment, when the server detects that the playback time period is within the cache time of the server's own server video cache library, it indicates that the server's server video cache library may have cached video file information for the playback time period, that is, the server may be able to obtain the video file information corresponding to the historical videos of each video channel in the playback time period from its own server video cache library. Therefore, the server can obtain the first video file information of each of the multiple video channels from the server video cache library.
[0093] It should be noted that, since the server video cache library does not necessarily cache the video file information of all video channels in the playback time period, the server needs to detect whether the first video file information corresponding to all video channels exists in the server video cache library.
[0094] In one embodiment of the present application, when the server detects that there is first video file information of respective multiple video channels in the server video cache library, step S403 may be executed.
[0095] In another embodiment of the present application, when the server detects that the first video file information of the first video channel does not exist in the server video cache library, the server may execute the following steps: Figure 6 Steps S501 to S502 are shown.
[0096] In S403, if the server video cache library contains the first video file information of each of the plurality of video channels, the target video file information is generated according to each of the first video file information.
[0097] When the server detects that there are first video file information of multiple video channels in the server video cache, it means that there are first video file information corresponding to all video channels in the server video cache. Therefore, the server can directly generate target video file information according to each first video file information.
[0098] In some possible embodiments, since the target video file information includes the target start time, target video duration, and target video source at each moment of the target video corresponding to each of the multiple video channels, and the target video source is used to describe whether the target video corresponding to each of the multiple video channels is from the server video cache library of the server itself or from the device video library of the shooting device, in order to promptly clarify whether it is necessary to obtain a certain video to be played back from the device video library corresponding to a certain video channel, the server can set any playback time point according to the following steps, as described in detail below:
[0099] Determine, according to the target video file information, a cached video corresponding to any one of the video channels in the server video cache library;
[0100] The arbitrary playback time point is set according to the start time and the end time of the cached video.
[0101] In this embodiment, the server can determine the cached video corresponding to any video channel in the server video cache of the server itself according to the target video sources of the target videos corresponding to the multiple video channels included in the target video file information at each moment.
[0102] Afterwards, the server may determine the start time of each of the remaining videos corresponding to the arbitrary video channel except the cached video that needs to be obtained from the device video library according to the start time and end time of the cached video corresponding to the arbitrary video channel.
[0103] The server can directly set the start time of each of the remaining videos corresponding to any video channel and required to be obtained from the device video library to any playback time point.
[0104] In S302, video information of any one video channel is determined according to the target video file information.
[0105] In this embodiment, since the target video file information includes the target start time, target video duration and target video source at each moment of the target videos corresponding to each of the multiple video channels, the server can obtain the video information of any video channel based on the target video source at each moment of the target videos corresponding to each of the multiple video channels contained in the target video file information.
[0106] Since the video information is used to describe whether the server video cache library has the first video of any video channel at the playback time point, in one embodiment of the present application, when the server detects that the first video exists in the server video cache library, it can execute step S202.
[0107] In another embodiment of the present application, when the server detects that the first video does not exist in the server video cache library, the server may execute step S203.
[0108] It should be noted that in actual applications, user terminals can usually only choose to play video files in the device video library or the server video cache library separately, resulting in the absence of video files in the server video cache library, and in overseas application scenarios, it is easy to have problems such as high device traffic cost and slow video playback response in weak network scenarios. Therefore, in order to realize the fusion processing of the device video library and the server video cache library, reduce the traffic consumption of the device, and save system operating costs, the server can perform the following steps S202 to S203 after obtaining the video information.
[0109] In S202, if the first video exists in the server video cache library, the first video is obtained from the server video cache library, and the first video is determined as the to-be-played video corresponding to any one of the video channels.
[0110] In this embodiment, for any video channel, when the server detects that the first video of any video channel exists in the server video cache, it means that the server can obtain the above-mentioned first video from its own server video cache. Therefore, the server obtains the above-mentioned first video from its own server video cache and determines the above-mentioned first video as the video to be played back corresponding to any video channel.
[0111] In one embodiment of the present application, since the server can obtain the above-mentioned first video from its own server video cache library at this time, that is, the server does not need to obtain the corresponding video from the device video library corresponding to any of the above-mentioned video channels, in order to save transmission traffic, the server can send a stop uploading instruction to the shooting device corresponding to any of the above-mentioned video channels. The stop uploading instruction is used to instruct the shooting device corresponding to any of the above-mentioned video channels to stop sending the second video that is the same as the above-mentioned first video.
[0112] In S203, if the first video does not exist in the server video cache library, a second video is obtained from a device video library provided for a shooting device corresponding to any one of the video channels, and the second video is determined as the video to be played back corresponding to any one of the video channels.
[0113] In this embodiment, for any video channel, when the server detects that the first video of any video channel does not exist in the server video cache, it means that the server cannot obtain the first video from its own server video cache, so the server can send a video upload instruction to the shooting device corresponding to any video channel. The video upload instruction is used to instruct the shooting device corresponding to any video channel to send the second video corresponding to any video channel.
[0114] Based on this, after receiving the second video corresponding to any one of the video channels sent by the shooting device corresponding to any one of the video channels, the server can directly determine the second video as the video to be played back corresponding to any one of the video channels.
[0115] It should be noted that, in combination with steps S201 to S203, since the server adaptively fuses the first videos in the server video cache library and the second videos in the device video library, subsequent user terminals do not need to worry about whether the audio and video data stream comes from the shooting device or the server when playing the video to be played back, thereby reducing the number of interactions between the user terminal and the server, reducing the delay in video screen loading time, and improving the user's video playback experience.
[0116] At the same time, combined with S201 to S203, by giving priority to the use of the server video cache library, the client does not need to use the device video library every time it needs to play a video, thereby saving the traffic consumption of the shooting device and reducing the system operating costs. In addition, the entire adaptive switching multiplexing operation (i.e., selecting the server video cache library or selecting the device video library provided by the shooting device to obtain the video to be played back) is implemented in the server, without the user terminal performing any operation, so that the user corresponding to the user terminal will not perceive the above adaptive switching multiplexing operation, thereby improving the user experience.
[0117] In S102, based on a transmission link, video frame sets at different times are transmitted to a user terminal in chronological order; wherein the video frame sets include video frames corresponding to each of the videos to be played back at the same shooting time.
[0118] In the embodiment of the present application, after the server determines the shooting time of multiple video frames corresponding to the videos to be played back corresponding to the multiple video channels, the server can transmit the video frame sets at different times to the user terminal in chronological order based on a transmission link. The video frame set includes the video frames corresponding to each video to be played back at the same shooting time.
[0119] It should be noted that the server needs to first perform demultiplexing, multi-channel synchronization, and multiplexing encapsulation on the video frame sets at different times, and then forward the encapsulated video frame sets to the user terminal through the above transmission link.
[0120] Afterwards, the user terminal can decapsulate the above-encapsulated video frame set through its own mediaSdk, and store and synchronize the video frames according to the video channel.
[0121] Afterwards, mediaSdk detects whether the user terminal supports H264 / H265 hard decoding. When the user terminal supports hard decoding, the FMP4 format can be used to encapsulate the above-mentioned decapsulated video frames, and the audio and video frames can be decoded and played through the MSE mode; when the user terminal does not support hard decoding, FFmpeg soft decoding and WebGL can be used to play the above-mentioned video frames.
[0122] It can be seen from the above that a video transmission method provided by an embodiment of the present application obtains the to-be-played videos corresponding to each of the multiple video channels, and determines the respective shooting time of the multiple video frames in each of the to-be-played videos; based on a transmission link, the video frame sets at different times are transmitted to the user terminal in chronological order; wherein the video frame set includes the video frames corresponding to each of the to-be-played videos at the same shooting time. Compared with the prior art, the present method can transmit the video frame sets at different times to the user terminal in chronological order based on a transmission link, which not only realizes the multiplexing of the transmission link, but also enables the video frames of the to-be-played videos corresponding to all the video channels at the same shooting time to arrive at the user terminal at the same time, that is, synchronous transmission is realized, thereby ensuring that the video screen can respond synchronously, and there will be no problem of some video channels responding successfully and some video channels failing to respond, thereby improving the quality of video playback.
[0123] See also Figure 6 , Figure 6 This is a flow chart of an implementation of a video transmission method provided in another embodiment of the present application.
[0124] In this embodiment, after step S402, steps S501 to S502 may be further included, which are described in detail as follows:
[0125] In S501, if the first video file information of the first video channel does not exist in the server video cache library, the second video file information of the first video channel is obtained from the device video library corresponding to the first video channel.
[0126] When the server detects that the first video file information of the first video channel does not exist in the server video cache library, it means that the server video cache library does not cache the video file information of the first video channel in the playback time period, so the server needs to obtain the second video file information of the first video channel from the device video library corresponding to the first video channel. The first video channel refers to any one of the multiple video channels.
[0127] In S502, the target video file information is generated according to each of the first video file information and the second video file information.
[0128] In this embodiment, after obtaining the first video file information of at least one video channel cached in the server video cache library and the second video file information of the first video channel, the server can generate target video file information based on the first video file information and the second video file information.
[0129] In one embodiment of the present application, since each first video file information includes the first start time and the first video duration of each first sub-video, and the second video file information includes the second start time and the second video duration of the second sub-video, the server can specifically generate the target video file information according to the following steps, which are described in detail as follows:
[0130] According to the processing strategy, each of the first start times, each of the first video durations, the second start time and the second video duration, each of the first video file information and the second video file information is deduplicated and merged to obtain the target video file information.
[0131] It should be noted that the processing strategy specifically includes: sorting by start time and video length; after sorting, merging repeated time points by start time and end time.
[0132] In this embodiment, the server may perform deduplication processing and merging processing on each of the first video file information and the second video file information based on the above processing strategy, so as to obtain the target video file information.
[0133] Deduplication processing specifically refers to deleting duplicate videos of multiple identical video channels at certain times and retaining only one copy, that is, the same video channel has only one copy of the video at each time.
[0134] For example, see Figure 7 , Figure 7 It is a schematic diagram of the principles of deduplication processing and merging processing provided by an embodiment of the present application.
[0135] It can be seen from the above that the video transmission method provided in this embodiment ensures the success rate of obtaining the video to be played back, thereby improving the subsequent user's playback experience.
[0136] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0137] Corresponding to a video transmission method described in the above embodiment, Figure 8 The structure diagram of a video transmission device provided by an embodiment of the present application is shown. For the convenience of description, only the part related to the embodiment of the present application is shown. Figure 8 The video transmission device 800 includes: a first acquisition unit 81 and a transmission unit 82. Wherein:
[0138] The first acquisition unit 81 is used to acquire the to-be-played videos corresponding to each of the multiple video channels, and determine the shooting time of each of the multiple video frames in each of the to-be-played videos.
[0139] The transmission unit 82 is used to transmit the video frame sets at different times to the user terminal in chronological order based on a transmission link; wherein the video frame sets include video frames corresponding to each of the videos to be played back at the same shooting time.
[0140] In one embodiment of the present application, the first acquisition unit 81 specifically includes: a second acquisition unit, a first determination unit and a second determination unit.
[0141] The second acquisition unit is used to acquire the video information of any video channel when it is detected that any playback time point has been reached; the video information is used to describe whether the server video cache library has the first video of any video channel at the playback time point; the server video cache library is located in the server.
[0142] The first determining unit is configured to obtain the first video from the server video cache library if the first video exists in the server video cache library, and determine the first video as the video to be played back corresponding to any one of the video channels.
[0143] The second determination unit is used to obtain a second video from a device video library provided in a shooting device corresponding to any one of the video channels if the first video does not exist in the server video cache library, and determine the second video as the video to be played back corresponding to any one of the video channels.
[0144] In one embodiment of the present application, the second acquisition unit specifically includes: a first generation unit and a third determination unit.
[0145] The first generating unit is used to generate target video file information according to the server video cache library and the device video library corresponding to each of the multiple video channels; wherein the target video file information includes the target start time, target video duration and target video source at each moment of the target video corresponding to each of the multiple video channels.
[0146] The third determining unit is used to determine the video information of any one video channel according to the target video file information.
[0147] In one embodiment of the present application, the second acquisition unit specifically includes: a fourth determination unit and a fifth determination unit.
[0148] The fourth determining unit is used to determine the cached video corresponding to any one video channel existing in the server video cache library according to the target video file information.
[0149] The fifth determining unit is used to set the arbitrary playback time point according to the start time and the end time of the cached video.
[0150] In one embodiment of the present application, the first generating unit specifically includes: a sixth determining unit, a third acquiring unit and a second generating unit.
[0151] The sixth determining unit is used to determine a playback time period according to the received video playback request.
[0152] The third acquisition unit is used for acquiring the first video file information of each of the multiple video channels from the server video cache library if the playback time period is within the cache time of the server video cache library.
[0153] The second generating unit is used for generating the target video file information according to each of the first video file information if the first video file information of each of the plurality of video channels exists in the server video cache library.
[0154] In one embodiment of the present application, the video transmission device 800 further includes: a fourth acquisition unit and a third generation unit.
[0155] The fourth acquisition unit is configured to acquire the second video file information of the first video channel from the device video library corresponding to the first video channel if the first video file information of the first video channel does not exist in the server video cache library.
[0156] The third generating unit is used to generate the target video file information according to each of the first video file information and the second video file information.
[0157] In one embodiment of the present application, each of the first video file information includes the first start time and the first video duration of each first sub-video, and the second video file information includes the second start time and the second video duration of the second sub-video; the third generation unit specifically includes: a processing unit.
[0158] The processing unit is used to deduplicate and merge the first video file information and the second video file information according to the processing strategy, the first start time, the first video duration, the second start time and the second video duration to obtain the target video file information.
[0159] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0160] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, 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 software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0161] Fig. 9 This is a schematic diagram of the structure of a server provided in an embodiment of the present application. Fig. 9 As shown, the server 9 of this embodiment includes: at least one processor 90 ( Fig. 9 Only one is shown in the figure) a processor, a memory 91, and a computer program 92 stored in the memory 91 and executable on the at least one processor 90, and when the processor 90 executes the computer program 92, the steps in any of the above-mentioned video transmission method embodiments are implemented.
[0162] The server may include, but is not limited to, a processor 90 and a memory 91. Those skilled in the art will appreciate that Fig. 9 It is only an example of the server 9 and does not constitute a limitation on the server 9. The server 9 may include more or fewer components than shown in the figure, or a combination of certain components, or different components, for example, it may also include input and output devices, network access devices, etc.
[0163] The processor 90 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0164] In some embodiments, the memory 91 may be an internal storage unit of the server 9, such as the memory of the server 9. In other embodiments, the memory 91 may also be an external storage device of the server 9, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the server 9. Further, the memory 91 may also include both the internal storage unit of the server 9 and an external storage device. The memory 91 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of the computer program. The memory 91 may also be used to temporarily store data that has been output or is to be output.
[0165] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.
[0166] An embodiment of the present application provides a computer program product. When the computer program product runs on a server, the server can implement the steps in the above-mentioned method embodiments when executing the computer program product.
[0167] If the 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 present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device capable of carrying the computer program code to the server, a recording medium, a computer memory, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), an electric carrier signal, a telecommunication signal, and a software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.
[0168] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0169] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A video transmission method, characterized in that: include: Obtaining videos to be played back corresponding to each of the multiple video channels, and determining the shooting time of each of the multiple video frames in each of the videos to be played back; Based on a transmission link, video frame sets at different times are transmitted to a user terminal in chronological order; wherein the video frame sets include video frames corresponding to each of the videos to be played back at the same shooting time.
2. The video transmission method according to claim 1, characterized in that: The step of obtaining the to-be-played videos corresponding to the respective multiple video channels includes: For any video channel, when it is detected that any playback time point has been reached, video information of the any video channel is obtained; the video information is used to describe whether a server video cache library has a first video of the any video channel at the playback time point; the server video cache library is located in the server; If the first video exists in the server video cache library, the first video is obtained from the server video cache library, and the first video is determined as the video to be played back corresponding to any one of the video channels; If the first video does not exist in the server video cache library, the second video is obtained from the device video library provided in the shooting device corresponding to the any one video channel, and the second video is determined as the video to be played back corresponding to the any one video channel.
3. The video transmission method according to claim 2, characterized in that: The obtaining of video information of any one of the video channels includes: Generate target video file information according to the server video cache library and the device video libraries corresponding to the multiple video channels; wherein the target video file information includes the target start time, target video duration and target video source at each time of the target video corresponding to the multiple video channels; The video information of any one video channel is determined according to the target video file information.
4. The video transmission method according to claim 3, characterized in that: Any one of the playback time points is set according to the following method: Determine, according to the target video file information, a cached video corresponding to any one of the video channels in the server video cache library; The arbitrary playback time point is set according to the start time and the end time of the cached video.
5. The video transmission method according to claim 3, characterized in that: The generating target video file information according to the server video cache library and the device video libraries corresponding to the plurality of video channels respectively includes: Determine a playback time period according to the received video playback request; If the playback time period is within the cache time of the server video cache library, obtaining first video file information of each of the multiple video channels from the server video cache library; If the server video cache library contains the first video file information of each of the plurality of video channels, the target video file information is generated according to each of the first video file information.
6. The video transmission method according to claim 5, characterized in that: After obtaining the first video file information of each of the plurality of video channels from the server video cache library, the method further includes: If the first video file information of the first video channel does not exist in the video cache library of the server, obtaining the second video file information of the first video channel from the device video library corresponding to the first video channel; The target video file information is generated according to each of the first video file information and the second video file information.
7. The video transmission method according to claim 6, characterized in that: The first video file information includes the first start time and the first video duration of each first sub-video, and the second video file information includes the second start time and the second video duration of the second sub-video; The step of generating the target video file information according to each of the first video file information and the second video file information includes: According to the processing strategy, each of the first start times, each of the first video durations, the second start time and the second video duration, each of the first video file information and the second video file information is deduplicated and merged to obtain the target video file information.
8. A video transmission device, characterized in that: include: A first acquisition unit is used to acquire the to-be-played videos corresponding to the multiple video channels, and determine the shooting time of the multiple video frames in each of the to-be-played videos; A transmission unit is used to transmit video frame sets at different times to a user terminal in chronological order based on a transmission link; wherein the video frame set includes video frames corresponding to each of the videos to be played back at the same shooting time.
9. A server comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the video transmission method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the video transmission method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Data transmission method and system
CN119232995A
