Video verification method and system under peer-to-peer network, electronic equipment and storage medium
By implementing multi-level video verification in peer-to-peer networks, and using slice time and verification frame number to generate index files and verification codes, the problem of large amount of calculation and low credibility of video verification methods in peer-to-peer networks is solved, and the problem of high-quality calculation and low credibility of video verification methods in peer-to-peer networks is improved. Video playback effect and data integrity.
Patent Information
- Application Number
- CN202410930986.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-11
- Publication Date
- 2024-11-12
AI Technical Summary
In peer-to-peer networks, existing video verification methods such as CRC32 checksum file name verification have large calculations, resulting in poor client playback effect, and low credibility, which is easy to be forged by illegal users and cannot effectively prevent data forgery. .
By implementing multi-level video verification between on-demand system, signaling server and peer, using preset slice time and verification frame number to generate index files, generate and verify video verification codes, and ensure the integrity of video data and Consistency prevents data forgery.
提高了视频播放效果,增强了客户体验,确保了视频数据在对等网络中的传输完整性和正确性,防止了数据伪造和串片问题。
Smart Images

Figure CN118945431A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of Internet technology, and more specifically, to a video verification method, system, electronic device and storage medium in a peer-to-peer network. Background Art
[0002] With the rapid growth of the Internet, multimedia content such as pictures, texts, audio, and video has become the main component of the Internet, especially the streaming media technology under peer-to-peer networks has been widely used. The network sharing and fast routing mechanism under peer-to-peer networks provide viewers with a good streaming video viewing experience.
[0003] Since data is unreliable in a peer-to-peer network, it is necessary to verify the data. Currently, the CRC32 verification method or the method of verifying whether the file name is consistent is used to verify the consistency of the data. However, the CRC32 verification method will cause a large amount of calculation on the client, resulting in poor client playback and poor viewing experience for customers. The verification method using the file name has low credibility, and illegal users can forge the same file name to achieve the effect of deception. Summary of the invention
[0004] In view of this, the present invention provides a video verification method, system, electronic device and storage medium in a peer-to-peer network, with the purpose of improving video playback effect, preventing data forgery and improving customer experience.
[0005] A first aspect of the present invention provides a video verification system in a peer-to-peer network, the video verification system in a peer-to-peer network comprising: a video-on-demand system, a client, a signaling server and a peer;
[0006] The on-demand system is used to receive a playback request sent by the client, determine the video information of the video according to the index file of the definition video corresponding to the video indicated by the playback request, and feed back the video information to the client; the index file is generated according to the preset slice duration, the number of check frames and the definition video;
[0007] The signaling server is used to receive a first video verification request sent by the client according to the video information, and determine whether there is seed video data according to the video information carried in the first video verification request; if so, generate a room number according to the video information, and send a second video verification request carrying the room number and the video information to the peer end;
[0008] The peer end is used to receive the second video verification request, obtain the target seed video data according to the video information, and perform video verification on the target seed video data; if the verification passes, join the room indicated by the room number, and send prompt information indicating the existence of the target seed video data to the client through the signaling server;
[0009] The client is used to receive the prompt information, read the target seed video data from the peer end according to the video information using a peer-to-peer network, and perform video verification on the target seed video data; if the target seed video data passes the verification, the target seed video data is played.
[0010] Optionally, when the on-demand system generates a corresponding index file according to the preset slice duration, the number of check frames and the definition video, it is specifically used to:
[0011] The definition video is sliced according to a preset slice duration to obtain a plurality of sliced videos of the definition video and a video file thereof; wherein the definition video is obtained by transcoding an initial video bound to a corresponding video ID;
[0012] For each of the sliced videos, the sliced video is processed according to the number of check frames to obtain a check code of the sliced video;
[0013] The slice file size of each of the sliced videos is obtained, and an index file of the definition video is generated according to the number of check frames, the video file of each of the sliced videos, the slice file size of each of the sliced videos and the check code of each of the sliced videos.
[0014] Optionally, the on-demand system is also used for:
[0015] Storing the index file of the definition video in a corresponding storage to obtain a storage path of the index file of the definition video;
[0016] The video encoding information of the definition video is obtained, and the index file storage path and the video encoding information of the definition video are sent to the CDN or the video server.
[0017] Optionally, the video information includes at least a video file of the video, a slice file size of the video, and a checksum of the video, and when the signaling server generates a unique room number according to the video information of the video, it is specifically used to:
[0018] A unique room number is generated according to the video file of the video, the slice file size of the video and the verification code of the video.
[0019] Optionally, the video information further includes a user ID and a video ID of the video, and when the peer end obtains the target seed video data according to the video information and performs video verification on the seed video data, it is specifically used to:
[0020] Acquire target seed video data from pre-stored video data according to the user ID and the video ID;
[0021] Processing the target seed video data according to the check frame number to obtain a first check code of the target seed video data;
[0022] Reading a first file size of the target seed video data, and determining whether the first file size is the same as a slice file size of the video, and whether the first check code is consistent with a check code of the video;
[0023] If the size of the first seed file is the same as the size of the slice file of the video, and the first verification code is consistent with the verification code of the video, it is determined that the target seed video data has passed the verification;
[0024] If the first file size is different from the slice file size of the video, and / or the first verification code is inconsistent with the verification code of the video, it is determined that the target seed video data verification fails.
[0025] Optionally, when the client reads the target seed video data from the peer end using a peer-to-peer network, it is specifically used to:
[0026] Determine whether the peer is in the same local area network;
[0027] If the peer terminal is in the same local area network, reading the target seed video data from the peer terminal through a peer-to-peer network;
[0028] If the peer is not in the same local area network, a network hole is punched through a peer-to-peer network to establish a data connection with the peer;
[0029] Under the data connection established with the peer end, the target seed video data is read from the peer end through a peer network.
[0030] Optionally, when the client uses the video information to perform video verification on the target seed video data, it is specifically used to:
[0031] Processing the target seed video data according to the check frame number to obtain a second check code of the target seed video data;
[0032] Reading a second file size of the received target seed video data, and determining whether the second file size is the same as a slice file size of the video, and whether the second check code is consistent with a check code of the video;
[0033] If the second file size is the same as the slice file size of the video, and the second verification code is the same as the verification code of the video, it is determined that the target seed video data has passed the verification;
[0034] If the second file size is different from the slice file size of the video, and / or the second verification code is inconsistent with the verification code of the video, it is determined that the target seed video data verification fails.
[0035] A second aspect of the present invention provides a video verification method in a peer-to-peer network, which is applied to a video verification system in a peer-to-peer network, wherein the system includes a video-on-demand system, a client, a signaling server, and a peer end, and the method includes:
[0036] The client responds to the user's click operation of playing and sends a corresponding play request to the on-demand system;
[0037] The video information of the video is determined by the on-demand system according to the index file of the definition video corresponding to the video played according to the playback request, and the video information is fed back to the client; the index file is generated according to the preset slice duration, the number of check frames and the definition video;
[0038] Generate a first video verification request according to the video information by the client, and send the first video verification request to the signaling server;
[0039] Determine, by the signaling server, whether there is seed video data according to the video information carried in the first video verification request; if so, generate a room number according to the video information, and send a second video verification request carrying the room number and the video information to the peer end;
[0040] Obtaining target seed video data according to the video information through the peer end, and performing video verification on the target seed video data; if the verification passes, joining the room indicated by the room number, and sending prompt information indicating the existence of the target seed video data to the client through the signaling server;
[0041] The prompt information is received through the client, the target seed video data is read from the opposite end according to the video information using a peer-to-peer network, and a video verification is performed on the target seed video data; if the target seed video data passes the verification, the target seed video data is played.
[0042] The third aspect of the present invention provides an electronic device, comprising: a processor and a memory, wherein the processor and the memory are connected via a communication bus; wherein the processor is used to call and execute a program stored in the memory; and the memory is used to store a program, wherein the program is used to implement a video verification method under a peer-to-peer network as provided in the second aspect of the present invention.
[0043] A fourth aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to execute the video verification method in a peer-to-peer network provided in the second aspect of the present invention.
[0044] The present invention provides a video verification method, system, electronic device and storage medium in a peer-to-peer network, wherein a client responds to a user's play click operation and sends a corresponding play request to a video-on-demand system; the video-on-demand system determines the video information of the video in an index file of a definition video corresponding to the video to be played according to the play request, and feeds back the video information to the client; the index file is generated according to a preset slice duration, a verification frame number and a definition video; the client generates a first video verification request according to the video information, and sends the first video verification request to a signaling server; the signaling server determines whether there is seed video data according to the video information carried in the first video verification request, so as to implement a first-level verification of the video requested to be played by the client; if the signaling server determines that there is corresponding seed video data, it can be considered that the first-level verification of the video requested to be played by the client is completed, and then a room number can be generated according to the video information, and a second video verification request carrying the room number and video information can be sent to the opposite end; the opposite end obtains the target seed video data according to the video information, and performs video verification on the target seed video data, so as to implement the verification of the client Secondary verification of the video requested to be played; if the target seed video data verification passes, it can be considered that the secondary verification of the video requested to be played by the client is completed, and then the room indicated by the room number is added, and a prompt message indicating the existence of the target seed video data is sent to the client through the signaling server; the client receives the prompt message, uses the peer-to-peer network to read the target seed video data from the other end according to the video information, and performs video verification on the target seed video data to achieve tertiary verification of the video requested to be played; if the target seed video data verification passes, it means that the received target seed video data is complete and consistent with the target seed video data transmitted by the other end, that is, the tertiary verification of the video requested to be played is completed, and then the target seed video data can be played. It can be seen that the technical solution provided by the present invention can realize multi-level video verification in the three links of the signaling server, the client and the other end, ensure the normal video data under the peer-to-peer network, and realize the integrity and correctness of video data transmission in the peer-to-peer network, prevent data forgery and string problems, improve video playback effect, prevent data forgery and improve customer experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, 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 embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0046] Figure 1 A schematic diagram of a process flow of a video verification method in a peer-to-peer network provided by an embodiment of the present invention;
[0047] Figure 2 An example diagram of a definition index file provided by an embodiment of the present invention;
[0048] Figure 3 An example diagram of a video verification method in a peer-to-peer network provided by an embodiment of the present invention;
[0049] Figure 4 A schematic diagram of the structure of a video verification system in a peer-to-peer network provided by an embodiment of the present invention;
[0050] Figure 5 An example diagram of a data transmission method between a client, a peer and a signaling server provided in an embodiment of the present invention;
[0051] Figure 6 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0052] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0053] In this application, relational terms such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
[0054] See also Figure 1 , shows a flow chart of a video verification method in a peer-to-peer network provided by an embodiment of the present invention, which is applied to a video verification system in a peer-to-peer network. The video verification system in a peer-to-peer network includes: a video-on-demand system, a CDN / video server, a client, a signaling server, and a peer. The video verification method in a peer-to-peer network specifically includes the following steps:
[0055] S101: The client responds to the user's play click operation and sends a corresponding play request to the on-demand system.
[0056] In the specific process of executing step S101, when the user wants to play the corresponding video, he can perform a corresponding play click operation on the corresponding client. When the client detects the user's play click operation, it can generate a corresponding play request according to the video played by the play click operation instruction, and send the generated play request to the on-demand system. The play request can carry the user ID of the user and the video ID of the video requested to be played.
[0057] It should be noted that the definition can be 360P, 480P, 720P, 1080P, etc., and can be set according to actual applications, and is not limited in this embodiment of the present invention.
[0058] It should also be noted that the client may be an APP, a browser, a mobile phone, a television, or other device, which is not limited in this embodiment of the present invention.
[0059] S102: The on-demand system receives a play request sent by the client, determines and feeds back video information of the video according to an index file of a definition video corresponding to the video indicated by the play request.
[0060] Among them, the index file of the definition video is generated according to the preset slice duration, the number of verification frames and the definition video.
[0061] In an embodiment of the present invention, the process of generating a corresponding index file by the on-demand system according to the preset slicing duration, the number of check frames and the clarity video can be specifically as follows: slicing the clarity video according to the preset slicing duration and the number of check frames to obtain multiple slice videos of the clarity video and their video files; wherein the clarity video is obtained by transcoding an initial video bound to a corresponding video ID; for each slice video, processing the slice video according to the number of check frames to obtain a check code of the slice video; obtaining the slice file size of each slice video, and generating an index file of the clarity video according to the number of check frames, the video file of each slice video, the slice file size of each slice video and the check code of each slice video.
[0062] In some embodiments, when the on-demand system obtains the initial video, it generates a unique video ID for the initial video and binds the initial video to the video ID of the initial video; transcodes the initial video bound to the corresponding video ID to obtain multiple definition videos corresponding to the initial video; for each definition video, the definition video can be sliced according to the preset slice duration to obtain multiple slice videos and video files of the definition video; for each slice video, the slice video is processed according to the preset number of check frames to obtain the check code of the slice video; the slice file size of each slice video is obtained, and an index file of the definition video is generated based on the number of check frames, the video file of each slice video, the slice file size of each slice video and the check code of each slice video. The definition of each definition video is different. The video ID of each definition video is the same as the video ID of the initial video, and the video ID of each slice video is the same as the video ID of the corresponding definition video.
[0063] It should be noted that the preset slice duration may be 10s, 15s, etc., and the preset number of check frames may be 10 frames, 15 frames, etc., which may be set according to actual applications and are not limited in this embodiment of the present invention.
[0064] In some embodiments, various pre-configured parameters can be passed to the videoClip tool, where the pre-configured parameters are shown in Table 1; the videoClip tool can be called to slice the clarity video indicated by the path of the video file to be sliced (the path of the clarity video) according to the preset slicing duration, and obtain multiple sliced videos and their video files corresponding to the clarity video; for each sliced video, video frames corresponding to the number of check frames can be obtained from the sliced video, and the obtained video frames can be hashed to obtain the hash value (check code) corresponding to the sliced video; finally, the slice file size of each sliced video is obtained, and an index file of the clarity video corresponding to the slice type (preset protocol) is generated based on the number of check frames, the video file of each sliced video, the slice file band of each sliced video, and the check code of each sliced video.
[0065] Table 1:
[0066]
[0067] For example, the pre-configured parameters (videoClip-ic76c09f80bdffbc889867e765b7b0e4e.ts -n 10 -t 10 -c hls -o playlist.m3u8) is passed to the videoClip tool. For the definition video whose video file is c76c09f80bdffbc889867e765b7b0e4e.ts, the videoClip tool can be called to slice the definition video indicated by the path (playlist.m3u8) of the sliced video file according to the preset slice duration (10s), and 3 sliced videos and their video files (.ts files) corresponding to the definition video can be obtained; for each sliced video, the video frame corresponding to the check frame number (the first 10 frames) can be obtained from the sliced video, and the obtained video frame is hashed to obtain the hash value (check code) corresponding to the sliced video; finally, the slice file size of each sliced video is read, and an index file of the definition video corresponding to the slice type (hls) is generated according to the check frame number (10 frames), the video file of each sliced video, the slice file size of each sliced video and the video code of each sliced video, such as Figure 2 shown.
[0068] It should be noted that Figure 2 MGTV-CHECKNUM is the number of check frames, MGTV-FILESIZE is the slice file size, and MGTV-CHECKSUM is the check code and is a custom TAG.
[0069] It should also be noted that if the slice type is dash protocol, the above method can also be used to generate the index file corresponding to the clarity video; for example, the video file is a clarity video of 2BE3F8B4FBB5492A226CF67366D7BA00.ts, and the file name can be uuid or the file's md5 value to determine the uniqueness of the file (video).
[0070] It should be noted that the video encoding information of the definition video includes the duration, resolution and encoding format of the definition video, etc., which is not limited in this embodiment of the present invention.
[0071] Furthermore, in an embodiment of the present invention, after obtaining the index file of each definition video, the on-demand system can also store the index file of each definition video into a corresponding storage, obtain the video path corresponding to each definition video, and store the video path and video encoding information of each definition video and distribute it to a CDN or a video server.
[0072] In the specific process of executing step S102, after receiving the play request sent by the client, the on-demand system can determine the corresponding definition video according to the video ID of the play request, and obtain the index file of the definition video from the storage according to the video path of the definition video; obtain the video file, check code, slice file size and check frame number corresponding to the video indicated by the play request from the index file of the definition video, generate corresponding video information according to the video file, check code, slice file size, check frame number corresponding to the video and the video ID and user ID carried in the play request, and feed the generated video information back to the client. The video information may include the user ID of the user requesting to play the video, the video ID of the video requested to play, the video file of the video, check code, slice file size and check frame number.
[0073] It should be noted that the video indicated to be played in the play request may be a sliced video corresponding to the definition video.
[0074] S103: The client generates a first video verification request according to the video information, and sends the first video verification request to the signaling server.
[0075] The first video verification request includes video information of the video.
[0076] In the specific process of executing step S103, after receiving the video information of the video fed back by the on-demand system, the client can generate a first video verification request based on the video information of the received video, and start the corresponding peer network module to send the first video verification request to the signaling server through the started peer network module.
[0077] S104: The signaling server determines whether there is seed video data according to the video information carried in the first video verification request; if there is seed video data, execute step S105.
[0078] In an embodiment of the present invention, the signaling server can receive audio data and video data sent by the other end in real time, so that after receiving the first video verification data sent by the client, the signaling server can determine whether corresponding seed video data exists in the audio data and video data stored in itself based on the video information in the first video verification data.
[0079] In some embodiments, the signaling server can determine whether there is video data with a user ID identical to the user ID in the video information, and video data with a video ID identical to the video ID in the video information in the video data and audio data stored in the signaling server. If so, the video data with the same user ID and video ID in the video information can be determined as seed video data, that is, it can be determined that there is usable peer network seed data in the signaling server.
[0080] It should be noted that if there is no available peer-to-peer network seed data in the signaling server, corresponding prompt information can be output to the client to prompt the user that there is currently no corresponding video.
[0081] S105: The signaling server generates a room number according to the video information, and sends a second video verification request carrying the room number and the video information to the peer end; wherein the second video verification request includes the video information and the room number of the video.
[0082] In the specific process of executing step S105, when determining that there is available peer-to-peer network seed data, the signaling server can generate a unique room number based on the video file, the size of the slice file of the video, and the verification code of the video, and generate a second video verification request based on the generated room number and video information, and finally send the generated second video verification request to the peer end. The method of generating a unique room number based on the video file, the size of the slice file of the video, and the verification code of the video can refer to formula (1).
[0083] R=MD5(C+S+N) (1)
[0084] Among them, R is the room number, C is the check code of the video, S is the slice file size of the video, and N is the video file of the video.
[0085] S106: The peer end obtains target seed video data according to the video information, and performs video verification on the target seed video data; if the target seed video data passes the verification, execute step S107.
[0086] During the specific execution of step S106, when the other end receives the second video verification request sent by the signaling server, it can obtain the corresponding target seed video data from the pre-stored audio data and video data based on the user ID and video ID in the video information carried in the second video verification request, and use the verification frame number, video slice file size and verification code in the video information to perform video verification on the target seed video data; if the target seed video data passes the verification, execute step S107.
[0087] It should be noted that if the target seed video data fails the verification, it means that the current target seed video data may have been tampered with or is incomplete. At this time, a corresponding prompt message can be output to the client to prompt the user that the video currently requested to be played has an error.
[0088] It should also be noted that the video data and audio data stored in the cache of the other end should theoretically be the same as the audio data and video data stored in the signaling server. Therefore, when there is seed video data that can be used in the signaling server, the other end will also have corresponding target seed data. However, in order to prevent the other end from being tampered with when reporting the corresponding data to the signaling server, the video information can be used to perform further video verification on the target seed video data.
[0089] Optionally, the process in which the opposite end obtains the target seed video data according to the video information and performs video verification on the target seed video data can be specifically as follows: obtaining the target seed video data from pre-stored video data according to the user ID and the video ID; processing the target seed video data according to the verification frame number to obtain a first verification code of the target seed video data; reading the first file size of the target seed video data, and determining whether the first file size is the same as the slice file size of the video, and whether the first verification code is consistent with the verification code of the video; if the first file size is the same as the slice file size of the video, and the first verification code is consistent with the verification code of the video, it is determined that the target seed video data verification has passed; if the first file size is different from the slice file size of the video, and / or the first verification code is inconsistent with the verification code of the video, it is determined that the target seed video data verification has failed.
[0090] In actual application, after receiving the second video verification request sent by the signaling server, the opposite end can obtain the target seed video data whose user ID and video ID are consistent with the user ID and video ID in the video information in the second video verification request from the cache (which can be a storage medium such as a disk or memory), read the first file size of the target seed video data, and perform hash calculation on the video frames corresponding to the number of verification frames in the target seed video data to obtain the corresponding first verification code, and finally determine whether the first file size is the same as the slice file size of the video, and whether the first verification code is consistent with the verification code of the video; if the first file size is the same as the slice file size of the video, and the first verification code is consistent with the verification code of the video, it is determined that the target seed video data verification has passed; if the first file size is different from the slice file size of the video, and / or the first verification code is inconsistent with the verification code of the video, it is determined that the target seed video data verification has failed.
[0091] Furthermore, in an embodiment of the present invention, when it is determined that the verification of the target seed video has passed, the video file of the target seed video can be further obtained, and it can be determined whether the video file of the target seed video is consistent with the seed file in the video information. If they are consistent, step S107 can be executed; if they are inconsistent, a corresponding prompt message is output to the client to prompt the user that an error has occurred in the video currently requested to be played.
[0092] S107: The other end joins the room indicated by the room number, and sends a prompt message indicating the existence of the target seed video data to the signaling server.
[0093] In the specific process of executing step S107, when the opposite end determines that the target seed data has passed the verification, it can join the room indicated by the room number in the video information to achieve being in the same room as the client, and send a prompt message to the signaling server indicating the existence of the target seed video data.
[0094] S108: The signaling server sends prompt information indicating the existence of the target seed video data to the client.
[0095] In the specific process of executing step S108, after receiving the prompt information sent by the other end, the signaling server can forward the received prompt information to the client, so that the client can understand that the other end currently has usable target seed video data and read the corresponding target seed video data from the other end.
[0096] S109: The client receives the prompt information, uses the peer-to-peer network to read the target seed video data from the peer according to the video information, and performs video verification on the target seed video data. If the target seed video data passes the verification, step S110 is executed.
[0097] In the specific process of executing step S109, after receiving the prompt information indicating the existence of the target seed video data, the client can read the corresponding target seed video data from the cache of the other end according to the user ID and video ID in the video information using the peer network, and perform video verification on the target seed video data. If the target seed video data passes the verification, step S110 is executed.
[0098] It should be noted that if the target seed video data fails the verification, it means that when the client reads the corresponding target seed video data from the other end, the target seed video data may have been tampered with or incomplete. At this time, a prompt message can be output to remind the user that the video currently requested to be played has an error.
[0099] It should also be noted that when it is determined that the target seed video data verification fails, the CDN file address of the video indicated by the play request can be directly read from the CDN / video server, and the video can be read and played from the CDN / video server according to the CDN file address.
[0100] Optionally, the process of the client reading the target seed video data from the other end using the peer-to-peer network can specifically be: determining whether the client is in the same local area network as the other end; if the client is in the same local area network as the other end, reading the target seed video data from the other end through the peer-to-peer network; if the client is not in the same local area network as the other end, performing network hole punching through the peer-to-peer network to establish a data connection with the other end; after establishing a data connection with the other end, reading the target seed video data from the other end through the peer-to-peer network.
[0101] In actual application, after joining the corresponding room, the other party can also inform the client through the signaling server that it has found a unique and suitable target seed video data. The client can first determine whether it is currently in the same LAN as the other party. If it is in the same LAN, it can directly read the corresponding target seed video data from the other party through the other party network; if it is not in the same LAN, the client can perform peer-to-peer network drilling with the other party to establish a data connection with the other party, and after the data connection is established, read the corresponding target seed data from the other party.
[0102] Optionally, the process of the client using video information to perform video verification on the target seed video data can be specifically as follows: processing the target seed video data according to the verification frame number to obtain a second verification code of the target seed video data; reading the second file size of the received target seed video data, and determining whether the second file size is the same as the slice file size of the video, and whether the second verification code is consistent with the verification code of the video; if the second file size is the same as the slice file size of the video, and the second verification code is the same as the verification code of the video, determining that the target seed video data verification has passed; if the second file size is different from the slice file size of the video, and / or the second verification code is inconsistent with the verification code of the video, determining that the target seed video data verification has failed.
[0103] In actual application, after reading the corresponding target seed video data, the client can obtain the second file size of the currently read target seed video data, and perform hash calculation on the video frames corresponding to the number of check frames in the target seed video data to obtain the corresponding second check code, and finally determine whether the second file size is the same as the slice file size of the video, and whether the second check code is consistent with the check code of the video; if the second file size is the same as the slice file size of the video, and the second check code is consistent with the check code of the video, it is determined that the target seed video data has passed the check, that is, it is determined that the target seed video data is consistent with the CDN file of the video indicated by the play request, and then step S110 can be executed to transmit the target seed video output to the player for playback; if the second file size is not the same as the slice file size of the video, and / or the first check code is inconsistent with the check code of the video, it is determined that the target seed video data has failed the check.
[0104] S110: The client plays the target seed video data.
[0105] In the specific process of executing step S1110, if the client determines that the target seed video data has passed the verification, that is, determines that the target seed video data is consistent with the CDN file of the video indicated by the play request, the target seed video output can be transmitted to the player for playback.
[0106] The present invention provides a video verification method under a peer-to-peer network, in which a client responds to a user's play click operation and sends a corresponding play request to a video-on-demand system; the video-on-demand system determines the video information of the video in an index file of a definition video corresponding to the video to be played according to the play request, and feeds back the video information to the client; the index file is generated according to a preset slice duration, a verification frame number and a definition video; the client generates a first video verification request according to the video information, and sends the first video verification request to a signaling server; the signaling server determines whether there is seed video data according to the video information carried in the first video verification request, so as to realize a first-level verification of the video requested to be played by the client; if the signaling server determines that there is corresponding seed video data, it can be considered that the first-level verification of the video requested to be played by the client is completed, and then a room number can be generated according to the video information, and a second video verification request carrying the room number and the video information can be sent to the opposite end; the opposite end obtains the target seed video data according to the video information, and performs video verification on the target seed video data, so as to realize the video requested to be played by the client. Second-level verification of the frequency; if the target seed video data verification passes, it can be considered that the second-level verification of the video requested to be played by the client is completed, and then the room indicated by the room number is added, and a prompt message indicating the existence of the target seed video data is sent to the client through the signaling server; the client receives the prompt message, uses the peer-to-peer network to read the target seed video data from the other end according to the video information, and performs video verification on the target seed video data to achieve three-level verification of the video requested to be played; if the target seed video data verification passes, it means that the received target seed video data is complete and consistent with the target seed video data transmitted by the other end, that is, the three-level verification of the video requested to be played is completed, and then the target seed video data can be played. It can be seen that the technical solution provided by the present invention can realize multi-level video verification in the three links of the signaling server, the client and the other end, ensure the normal video data under the peer-to-peer network, and realize the integrity and correctness of video data transmission in the peer-to-peer network, prevent data forgery and string problems, improve video playback effect, prevent data forgery and improve customer experience.
[0107] In order to better understand the contents provided by the above embodiments of the present invention, the following examples are given. Figure 3 shown.
[0108] A1: The on-demand system can transcode the initial video in advance, and slice each definition video obtained by transcoding to obtain multiple slice videos and their video files for each definition video; for each definition video, process each slice video of the definition video according to the number of verification frames to obtain the verification code of each slice video of the definition video, and finally the slice file size of each slice video, and generate an index file of the definition video according to the number of verification frames, the video file of each slice video, the slice file size of each slice video and the verification code of each slice video.
[0109] A2: The on-demand system distributes the index file of each definition video generated to the CDN / video server; specifically, after obtaining the index file of each definition video, the on-demand system can also store the index file of each definition video into the corresponding storage, obtain the video path corresponding to each definition video, and store and distribute the video path and video encoding information of each definition video to the CDN or video server.
[0110] A3: The client responds to the user's play click operation and sends a corresponding play request to the on-demand system, wherein the play request may carry the user ID of the user and the video ID of the video requested to be played.
[0111] A4: The video player feeds back corresponding video information to the client; specifically, the video player determines the corresponding definition video according to the video ID of the playback request, and obtains the index file of the definition video from the storage according to the video path of the definition video; obtains the video file, check code, slice file size and check frame number corresponding to the video indicated by the playback request from the index file of the definition video, generates corresponding video information according to the video file, check code, slice file size, check frame number corresponding to the video and the video ID and user ID carried in the playback request, and feeds back the generated video information to the client.
[0112] A5: The client carries the video information to request whether there is available seed video data in the signaling server; specifically, the client generates a first video verification request based on the video information, and sends the first video verification request to the signaling server. The signaling server can determine whether there is video data with a user ID that is the same as the user ID in the video information, and a video ID that is the same as the video ID in the video information in the video data and audio data stored in itself. If so, the video data with the same user ID and video ID in the video information can be determined as seed video data, that is, it can be determined that there is usable peer-to-peer network seed data in the signaling server, and then A6 is executed; if there is no usable peer-to-peer network seed data in the signaling server, the corresponding prompt information can be output to the client to prompt the user that the corresponding video does not currently exist.
[0113] A6: When determining that the seed video data exists, the signaling server generates a room number according to the video information, and sends a second video verification request carrying the room number and the video information to the peer end.
[0114] A7: The peer end obtains the corresponding target seed video data from the pre-stored audio data and video data according to the user ID and video ID in the video information carried in the second video verification request.
[0115] A8: The peer end performs video verification on the target seed video data using the verification frame number in the video information, the video slice file size and the verification code; if the target seed video data passes the verification, execute A9.
[0116] A9: The other end joins the room indicated by the room number, and sends a prompt message to the signaling server indicating that the target seed video data exists.
[0117] A10: The signaling server sends prompt information indicating the existence of the target seed video data to the client.
[0118] A11: The client receives the prompt information, and performs network hole punching through a peer-to-peer network when the client and the peer are not in the same local area network, so as to read the target seed video data from the peer through the peer-to-peer network.
[0119] A12: The client performs video verification on the target seed video data using the video information; if the video verification passes, execute A13; if the video verification fails, execute A14.
[0120] A13: The client plays the target seed video data.
[0121] A14: If the client fails to verify the target seed video data using the video information, the client reads the CDN file from the CDN / video server and plays the CDN file.
[0122] Based on the video verification method in a peer-to-peer network provided by the above embodiment of the present invention, correspondingly, the embodiment of the present invention also provides a video verification system in a peer-to-peer network, such as Figure 4 As shown, the video verification system under the peer-to-peer network includes: a video-on-demand system, a client, a CDN or a video server, a signaling server and a peer; wherein the data transmission method between the client, the peer and the signaling server is as follows Figure 5 shown.
[0123] The on-demand system is used to receive a playback request sent by a client, determine the video information of the video according to the index file of the definition video corresponding to the video played by the playback request, and feed back the video information to the client; the index file is generated according to the preset slice duration, the number of check frames and the definition video;
[0124] The signaling server is used to receive a first video verification request sent by the client according to the video information, and determine whether there is seed video data according to the video information carried in the first video verification request; if so, generate a room number according to the video information, and send a second video verification request carrying the room number and the video information to the peer end;
[0125] The peer end is used to receive the second video verification request, obtain the target seed video data according to the video information, and perform video verification on the target seed video data; if the verification passes, join the room indicated by the room number, and send a prompt message indicating the existence of the target seed video data to the client through the signaling server;
[0126] The client is used to receive prompt information, use the peer-to-peer network to read the target seed video data from the other end according to the video information, and perform video verification on the target seed video data; if the target seed video data passes the verification, the target seed video data is played.
[0127] The specific principles and execution processes of each unit in the video verification system under the peer-to-peer network disclosed in the above embodiment of the present invention are the same as the video verification method under the peer-to-peer network disclosed in the above embodiment of the present invention. Please refer to the corresponding parts of the video verification method under the peer-to-peer network disclosed in the above embodiment of the present invention, and will not be repeated here.
[0128] The present invention provides a video verification system under a peer-to-peer network, in which a client responds to a user's play click operation and sends a corresponding play request to a video-on-demand system; the video-on-demand system determines video information of the video in an index file of a definition video corresponding to the video to be played according to the play request, and feeds back the video information to the client; the index file is generated according to a preset slice duration, a verification frame number and a definition video; the client generates a first video verification request according to the video information, and sends the first video verification request to a signaling server; the signaling server determines whether there is seed video data according to the video information carried in the first video verification request, so as to realize a first-level verification of the video requested to be played by the client; if the signaling server determines that there is corresponding seed video data, it can be considered that the first-level verification of the video requested to be played by the client is completed, and then a room number can be generated according to the video information, and a second video verification request carrying the room number and the video information can be sent to the opposite end; the opposite end obtains the target seed video data according to the video information, and performs video verification on the target seed video data, so as to realize the verification of the video requested to be played by the client. Second-level verification of the frequency; if the target seed video data verification passes, it can be considered that the second-level verification of the video requested to be played by the client is completed, and then the room indicated by the room number is added, and a prompt message indicating the existence of the target seed video data is sent to the client through the signaling server; the client receives the prompt message, uses the peer-to-peer network to read the target seed video data from the other end according to the video information, and performs video verification on the target seed video data to achieve three-level verification of the video requested to be played; if the target seed video data verification passes, it means that the received target seed video data is complete and consistent with the target seed video data transmitted by the other end, that is, the three-level verification of the video requested to be played is completed, and then the target seed video data can be played. It can be seen that the technical solution provided by the present invention can realize multi-level video verification in the three links of the signaling server, the client and the other end, ensure the normal video data under the peer-to-peer network, and realize the integrity and correctness of video data transmission in the peer-to-peer network, prevent data forgery and string problems, improve video playback effect, prevent data forgery and improve customer experience.
[0129] Optionally, when the on-demand system generates a corresponding index file according to the preset slice duration, check frame number and definition video, it is specifically used for:
[0130] Slice the definition video according to the preset slice duration to obtain multiple slice videos of the definition video and video files thereof; wherein the definition video is obtained by transcoding the initial video bound to the corresponding video ID;
[0131] For each slice video, the slice video is processed according to the number of verification frames to obtain a verification code of the slice video;
[0132] The slice file size of each slice video is obtained, and an index file of the definition video is generated according to the number of verification frames, the video file of each slice video, the slice file size of each slice video and the verification code of each slice video.
[0133] Optionally, the on-demand system is also used to:
[0134] The index file of the definition video is stored in the corresponding storage to obtain the storage path of the index file of the definition video;
[0135] The video encoding information of the high-definition video is obtained, and the index file storage path and the video encoding information of the high-definition video are sent to the CDN or the video server.
[0136] Optionally, the video information includes at least a video file of the video, a slice file size of the video, and a checksum of the video. When the signaling server generates a unique room number according to the video information of the video, it is specifically used for:
[0137] A unique room number is generated based on the video file, the slice file size of the video and the verification code of the video.
[0138] Optionally, the video information also includes a user ID and a video ID of the video. When the peer end obtains the target seed video data according to the video information and performs video verification on the seed video data, it is specifically used for:
[0139] Obtain target seed video data from pre-stored video data according to the user ID and the video ID;
[0140] Processing the target seed video data according to the check frame number to obtain a first check code of the target seed video data;
[0141] Read the first file size of the target seed video data, and determine whether the first file size is the same as the slice file size of the video, and whether the first check code is consistent with the check code of the video;
[0142] If the size of the first seed file is the same as the size of the slice file of the video, and the first verification code is consistent with the verification code of the video, it is determined that the target seed video data verification has passed;
[0143] If the first file size is different from the slice file size of the video, and / or the first verification code is inconsistent with the verification code of the video, it is determined that the target seed video data verification fails.
[0144] Optionally, when the client uses a peer-to-peer network to read target seed video data from a peer, it is specifically used to:
[0145] Determine whether the peer is in the same LAN;
[0146] If the peer is in the same local area network, the target seed video data is read from the peer through the peer network;
[0147] If the peer is not in the same LAN, a network hole is punched through the peer network to establish a data connection with the peer.
[0148] When a data connection is established with the peer end, target seed video data is read from the peer end through a peer network.
[0149] Optionally, when the client uses the video information to perform video verification on the target seed video data, it is specifically used for:
[0150] Processing the target seed video data according to the check frame number to obtain a second check code of the target seed video data;
[0151] Read the second file size of the received target seed video data, and determine whether the second file size is the same as the slice file size of the video, and whether the second check code is consistent with the check code of the video;
[0152] If the second file size is the same as the slice file size of the video, and the second verification code is the same as the verification code of the video, it is determined that the target seed video data has passed the verification;
[0153] If the second file size is different from the slice file size of the video, and / or the second verification code is inconsistent with the verification code of the video, it is determined that the target seed video data verification fails.
[0154] The present application embodiment provides an electronic device, such as Figure 6 As shown, the electronic device includes a processor 601 and a memory 602, the memory 602 is used to store program codes and data for video verification in a peer-to-peer network, and the processor 601 is used to call the program instructions in the memory to execute the steps shown in the video verification method in a peer-to-peer network in the above embodiment.
[0155] An embodiment of the present application provides a storage medium, which includes a storage program, wherein when the program is running, the device where the storage medium is located is controlled to execute the video verification method under the peer-to-peer network shown in the above embodiment.
[0156] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The system and system embodiments described above are merely schematic, in which the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0157] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0158] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
[0159] The above are only preferred embodiments of the present invention. It should be pointed out that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A video verification system in a peer-to-peer network, characterized in that: The video verification system under the peer-to-peer network includes: a video-on-demand system, a client, a signaling server and a peer; The on-demand system is used to receive a playback request sent by the client, determine the video information of the video according to the index file of the definition video corresponding to the video indicated by the playback request, and feed back the video information to the client; the index file is generated according to the preset slice duration, the number of check frames and the definition video; The signaling server is used to receive a first video verification request sent by the client according to the video information, and determine whether there is seed video data according to the video information carried in the first video verification request; if so, generate a room number according to the video information, and send a second video verification request carrying the room number and the video information to the peer end; The peer end is used to receive the second video verification request, obtain the target seed video data according to the video information, and perform video verification on the target seed video data; if the verification passes, join the room indicated by the room number, and send prompt information indicating the existence of the target seed video data to the client through the signaling server; The client is used to receive the prompt information, read the target seed video data from the peer end according to the video information using a peer-to-peer network, and perform video verification on the target seed video data; if the target seed video data passes the verification, the target seed video data is played.
2. The system according to claim 1, characterized in that When the on-demand system generates a corresponding index file according to the preset slice duration, the number of check frames and the definition video, it is specifically used to: The definition video is sliced according to a preset slice duration to obtain a plurality of sliced videos of the definition video and a video file thereof; wherein the definition video is obtained by transcoding an initial video bound to a corresponding video ID; For each of the sliced videos, the sliced video is processed according to the number of check frames to obtain a check code of the sliced video; The slice file size of each of the sliced videos is obtained, and an index file of the definition video is generated according to the number of check frames, the video file of each of the sliced videos, the slice file size of each of the sliced videos and the check code of each of the sliced videos.
3. The system according to claim 2, characterized in that The on-demand system is also used for: Storing the index file of the definition video in a corresponding storage to obtain a storage path of the index file of the definition video; The video encoding information of the definition video is obtained, and the index file storage path and the video encoding information of the definition video are sent to the CDN or the video server.
4. The system according to claim 1, characterized in that The video information includes at least the video file of the video, the slice file size of the video and the check code of the video. When the signaling server generates a unique room number according to the video information of the video, it is specifically used to: A unique room number is generated according to the video file of the video, the slice file size of the video and the verification code of the video.
5. The system according to claim 4, characterized in that The video information also includes a user ID and a video ID of the video. When the peer end obtains the target seed video data according to the video information and performs video verification on the seed video data, it is specifically used to: Acquire target seed video data from pre-stored video data according to the user ID and the video ID; Processing the target seed video data according to the check frame number to obtain a first check code of the target seed video data; Reading a first file size of the target seed video data, and determining whether the first file size is the same as a slice file size of the video, and whether the first check code is consistent with a check code of the video; If the size of the first seed file is the same as the size of the slice file of the video, and the first verification code is consistent with the verification code of the video, it is determined that the target seed video data has passed the verification; If the first file size is different from the slice file size of the video, and / or the first verification code is inconsistent with the verification code of the video, it is determined that the target seed video data verification fails.
6. The system according to claim 1, characterized in that When the client uses the peer network to read the target seed video data from the peer, it is specifically used to: Determine whether the peer is in the same local area network; If the peer terminal is in the same local area network, reading the target seed video data from the peer terminal through a peer-to-peer network; If the peer is not in the same local area network, a network hole is punched through a peer-to-peer network to establish a data connection with the peer; Under the data connection established with the peer end, the target seed video data is read from the peer end through a peer network.
7. The system according to claim 4, characterized in that When the client uses the video information to perform video verification on the target seed video data, it is specifically used to: Processing the target seed video data according to the check frame number to obtain a second check code of the target seed video data; Reading a second file size of the received target seed video data, and determining whether the second file size is the same as a slice file size of the video, and whether the second check code is consistent with a check code of the video; If the second file size is the same as the slice file size of the video, and the second verification code is the same as the verification code of the video, it is determined that the target seed video data has passed the verification; If the second file size is different from the slice file size of the video, and / or the second verification code is inconsistent with the verification code of the video, it is determined that the target seed video data verification fails.
8. A video verification method in a peer-to-peer network, characterized in that: A video verification system applied to a peer-to-peer network, the system comprising a video-on-demand system, a client, a signaling server and a peer, the method comprising: The client responds to the user's play click operation and sends a corresponding play request to the on-demand system; Determine the video information of the video by using the on-demand system according to the index file of the definition video corresponding to the video played by the playback request, and feed back the video information to the client; the index file is generated according to the preset slice duration, the number of check frames and the definition video; Generate a first video verification request according to the video information by the client, and send the first video verification request to the signaling server; Determine, by the signaling server, whether there is seed video data according to the video information carried in the first video verification request; if so, generate a room number according to the video information, and send a second video verification request carrying the room number and the video information to the peer end; Obtaining target seed video data according to the video information through the peer end, and performing video verification on the target seed video data; if the verification passes, joining the room indicated by the room number, and sending prompt information indicating the existence of the target seed video data to the client through the signaling server; The prompt information is received through the client, the target seed video data is read from the opposite end according to the video information using a peer-to-peer network, and a video verification is performed on the target seed video data; if the target seed video data passes the verification, the target seed video data is played.
9. An electronic device, characterized in that: include: A processor and a memory, wherein the processor and the memory are connected via a communication bus; wherein the processor is used to call and execute a program stored in the memory; The memory is used to store a program, and the program is used to implement the video verification method in a peer-to-peer network as claimed in claim 8.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to execute the video verification method in a peer-to-peer network as claimed in claim 8.
