Camera video playback method, device, system and electronic equipment
By directly communicating with the camera with the target video playback device and generating supported playback files, the problem of high cost of playing camera videos in the prior art is solved, and convenient and efficient playback is achieved.
Patent Information
- Application Number
- CN202411232134.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-04
- Publication Date
- 2024-12-31
- Estimated Expiration
- 2044-09-04
AI Technical Summary
The existing technology is costly when playing camera videos, and it is impossible to easily play camera videos. It is necessary to build a server on the public network or use a third-party CDN for streaming processing and forwarding.
By installing the target playback agent in the target video playback device, it communicates directly with the camera, generates supported playback files and plays them, avoiding the transfer processing of public network servers and CDNs.
Save server and bandwidth costs, improve playback efficiency, and realize convenient camera video playback.
Smart Images

Figure CN118741265B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a camera video playback method, device, system and electronic equipment. Background Art
[0002] At present, the video playback protocols and formats generally supported by the players in electronic devices (such as mobile phones or computers) are very limited. For example, the supported playback protocols may include HTTP (HyperText Transfer Protocol), RTMP (Real Time Messaging Protocol), HLS (HTTP Live Streaming, a dynamic bit rate adaptive technology, mainly used for audio and video services) and DASH (Dynamic Adaptive Streaming over HTTP, dynamic adaptive streaming based on HTTP) and other standard protocols, and the supported playback formats may include h264 (a digital video compression format, i.e. a video format), aac (Advanced Audio Coding, Advanced Audio Coding, etc., perform differently on different playback terminals and different players; while home cameras generally use P2P transmission protocols (Peer-to-Peer, peer-to-peer connection protocol, also known as point-to-point transmission protocol or point-to-point protocol), the audio format can be AAC (an audio format) or G711 (another audio format), and the video format can be H264 and H265 (another video format). If you use a standard player directly, you cannot directly play the camera video. In this regard, the relevant technology usually builds a server on the public network or uses a third-party CDN (Content Delivery Network) to enable electronic devices to obtain and play the camera stream through the supported playback protocol. At this time, the camera pushes the stream to the server or CDN through the standard protocol, and then the server or CDN converts the received stream into a stream that can be played by a standard player. Only then can the camera stream be played on the electronic device, resulting in high costs. Based on this, how to conveniently play camera videos to effectively save costs has not yet had a good solution. Summary of the invention
[0003] In view of this, the embodiments of the present invention provide a camera video playback method, device, system and electronic device to solve the problem of high cost when playing camera videos in related technologies; that is, the embodiments of the present invention can conveniently play camera videos to effectively save costs, that is, the embodiments of the present invention do not need to build a server on the public network or use a third-party CDN to process the camera stream and forward it to the target video playback device, and can achieve direct communication between the target camera and the target video playback device through the target playback agent program, and when the target camera and the target video playback device communicate directly, the target player in the target video playback device can support the playback of the target camera's video, which can save a lot of server and bandwidth costs, and can greatly save public network server and computing power costs, thereby improving playback efficiency.
[0004] According to one aspect of an embodiment of the present invention, a camera video playback method is provided, the method being applied to a target video playback device, the target video playback device being any video playback device in a camera video playback system, the target video playback device being installed with a target playback agent program; the method comprising:
[0005] After detecting a target camera video playback request for a target camera, determining a target playback address indicated by the target camera video playback request, wherein the target playback address includes a target camera identifier of the target camera;
[0006] Through the target playback agent, based on the target camera identifier, a push stream request for the target camera is sent to the camera platform, so that the camera platform sends a push stream instruction to the target camera;
[0007] Receive the audio and video stream pushed by the target camera, and generate a target playback file corresponding to the target camera video playback request based on the received audio and video stream, wherein the target playback file includes at least one slice to be played, and the playback protocol output by the target playback agent program is the playback protocol supported by the target player in the target video playback device, and the playback format corresponding to one slice to be played is the playback format supported by the target player;
[0008] The target player plays the slice to be played in the target playback file to play the video of the target camera.
[0009] According to another aspect of an embodiment of the present invention, a camera video playback device is provided, wherein the camera video playback device runs in a target video playback device, wherein the target video playback device is any video playback device in a camera video playback system, and wherein a target playback agent program is installed in the target video playback device; the device comprises:
[0010] A processing unit, configured to, after detecting a target camera video playback request for a target camera, determine a target playback address indicated by the target camera video playback request, wherein the target playback address includes a target camera identifier of the target camera;
[0011] A sending unit, configured to send a streaming request for the target camera to the camera platform through the target playback agent program based on the target camera identifier, so that the camera platform sends a streaming instruction to the target camera;
[0012] A receiving unit, used to receive the audio and video stream pushed by the target camera;
[0013] The processing unit is further used to generate a target playback file corresponding to the target camera video playback request based on the received audio and video stream, the target playback file includes at least one slice to be played, the playback protocol output by the target playback agent program is the playback protocol supported by the target player in the target video playback device, and the playback format corresponding to one slice to be played is the playback format supported by the target player;
[0014] The processing unit is further used to play the to-be-played slice in the target playback file through the target player to play the video of the target camera.
[0015] According to another aspect of an embodiment of the present invention, an electronic device is provided, comprising a processor and a memory storing a program, wherein the program comprises instructions, which, when executed by the processor, enable the processor to perform the above-mentioned method.
[0016] According to another aspect of an embodiment of the present invention, a camera video playback system is provided, which includes a target video playback device, and the target video playback device is any video playback device in the camera video playback system; wherein the target video playback device is installed with a target playback agent program, and the target video playback device is used to execute the above-mentioned method.
[0017] According to another aspect of an embodiment of the present invention, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable a computer to execute the above-mentioned method.
[0018] The embodiment of the present invention can determine the target playback address indicated by the target camera video playback request after detecting the target camera video playback request for the target camera, and the target playback address includes the target camera identifier of the target camera; and send a streaming request for the target camera to the camera platform based on the target camera identifier through the target playback agent program, so that the camera platform sends a streaming instruction to the target camera. Further, the audio and video stream pushed by the target camera can be received, and a target playback file corresponding to the target camera video playback request can be generated based on the received audio and video stream. The target playback file includes at least one slice to be played, and the playback protocol output by the target playback agent program is the playback protocol supported by the target player in the target video playback device, and the playback format corresponding to a slice to be played is the playback format supported by the target player. Based on this, the slice to be played in the target playback file can be played through the target player to achieve the playback of the target camera video. It can be seen that the embodiment of the present invention can conveniently perform camera video playback to effectively save costs. That is to say, the embodiment of the present invention does not need to build a server on the public network or use a third-party CDN to process the camera stream and forward it to the target video playback device, so as to conveniently realize camera video playback; accordingly, the embodiment of the present invention can realize direct communication between the target camera and the target video playback device through the target playback agent program, and when the target camera and the target video playback device communicate directly, the target player in the target video playback device can support the playback of the target camera video, which can save a lot of server and bandwidth costs, and can greatly save public network server and computing power costs, thereby improving playback efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Further details, features and advantages of the invention are disclosed in the following description of exemplary embodiments in conjunction with the accompanying drawings, in which:
[0020] Figure 1 A schematic flow chart of a camera video playback method according to an exemplary embodiment of the present invention is shown;
[0021] Figure 2 A schematic flow chart of another camera video playback method according to an exemplary embodiment of the present invention is shown;
[0022] Figure 3 A schematic flow chart of another camera video playback method according to an exemplary embodiment of the present invention is shown;
[0023] Figure 4 A schematic flow chart of another camera video playback method according to an exemplary embodiment of the present invention is shown;
[0024] Figure 5A schematic diagram showing an update timeout determination time according to an exemplary embodiment of the present invention is shown;
[0025] Figure 6 A schematic diagram of a stop process according to an exemplary embodiment of the present invention is shown;
[0026] Figure 7 A schematic block diagram of a camera video playback device according to an exemplary embodiment of the present invention is shown;
[0027] Figure 8 A block diagram of an exemplary electronic device that can be used to implement an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0028] Embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present invention. It should be understood that the drawings and embodiments of the present invention are only for exemplary purposes and are not intended to limit the scope of protection of the present invention.
[0029] It should be understood that the various steps described in the method embodiments of the present invention may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present invention is not limited in this respect.
[0030] The term "including" and its variations used in this document are open inclusions, that is, "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one other embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions of other terms will be given in the following description. It should be noted that the concepts of "first", "second", etc. mentioned in the present invention are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0031] It should be noted that the modifications of "one" and "plurality" mentioned in the present invention are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0032] The names of the messages or information exchanged between multiple devices in the embodiments of the present invention are only used for illustrative purposes, and are not used to limit the scope of these messages or information.
[0033] It should be noted that the embodiment of the present invention may involve a camera video playback system, which may include but is not limited to: at least one video playback device, a camera platform (also referred to as a camera management platform) and at least one camera, etc.; wherein, a video playback device may be installed with a playback agent program (also referred to as a playback agent application), that is, the electronic device installed with the playback agent program can be used as a video playback device in the camera video playback system; accordingly, the camera platform can be used to manage at least one camera. Optionally, the embodiment of the present invention can use any video playback device in at least one video playback device as a target video playback device, that is, the camera video playback system may include a target video playback device, and the target video playback device may be any video playback device in the camera video playback system, and the playback agent program installed in the target video playback device may be used as a target playback agent program, that is, the target video playback device may be installed with a target playback agent program. Based on this, a video playback device can be an electronic device.
[0034] Optionally, the execution subject of the camera video playback method provided in the embodiment of the present invention may be an electronic device, that is, it may be an electronic device as a target video playback device, that is, the execution subject of the camera video playback method provided in the embodiment of the present invention may be a target video playback device. Optionally, the electronic device may be a terminal (i.e., a client) or a server; accordingly, the terminal mentioned here may include but is not limited to: smart phones, tablet computers, laptop computers, desktop computers, smart watches, smart voice interaction devices, smart home appliances, car terminals, etc. The server mentioned here may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, etc.
[0035] Based on the above description, an embodiment of the present invention proposes a camera video playback method, which can be executed by the electronic device mentioned above (such as a terminal or a server). The electronic device mentioned here can be a target video playback device, that is, the camera video playback method can be executed by the target video playback device, that is, the camera video playback method can be executed by the target video playback device and the target playback agent program in the target video playback device; based on this, the camera video playback method can be applied to the target video playback device, and the target video playback device is any video playback device in the camera video playback system. For the sake of ease of explanation, the following description will take the target video playback device executing the camera video playback method as an example; Figure 1 As shown, the camera video playback method may include the following steps S101-S104:
[0036] S101, after detecting a target camera video playback request for a target camera, determining a target playback address indicated by the target camera video playback request, where the target playback address includes a target camera identifier of the target camera.
[0037] Optionally, the target camera may be any camera, which is not limited in the embodiment of the present invention.
[0038] In the embodiment of the present invention, the user can install and start the target playback agent program in the target video playback device so that the target video playback device is installed with the target playback agent program. Optionally, after the target playback agent program is started, a user login page (also referred to as a user authorization page) can be entered. In this case, the user can perform a playback agent login operation on the user login page so that the target playback agent program in the target video playback device can detect the playback agent login operation, that is, at this time, the target video playback device can detect the playback agent login operation through the target playback agent program.
[0039] Based on this, when a playback agent login operation is detected, it can be determined whether the login is successful based on the login information indicated by the playback agent login operation; optionally, the target video playback device can determine whether the login is successful through the target playback agent program based on the login information indicated by the playback agent login operation. Optionally, the login information indicated by the playback agent login operation may include a user name and a login password (in this case, the user may enter the user name and the login password to log in). In this case, it may be determined whether the user name and the login password indicated by the playback agent login operation match. If it is determined that the user name and the login password match, it may be determined that the login is successful. If it is determined that the user name and the login password do not match, it may be determined that the login fails. Alternatively, the login information indicated by the playback agent login operation may include a user mobile phone number and a login verification code (in this case, the user may enter the user mobile phone number and the login verification code to log in). In this case, it may be determined whether the user mobile phone number and the login verification code match. If it is determined that the user mobile phone number and the login verification code match, it may be determined that the login is successful. If it is determined that the user mobile phone number and the login verification code do not match, it may be determined that the login fails. Alternatively, the login information indicated by the playback agent login operation may include a third-party platform account. In this case, if an authorization instruction of the third-party platform indicated by the third-party platform account is detected, it may be determined that the login is successful, and so on. This is not limited in the embodiments of the present invention.
[0040] Optionally, after successful login (i.e., after successful login to the target playback agent program), the target playback agent program may generate a playback verification identifier, that is, the target video playback device may generate a playback verification identifier through the target playback agent program. Optionally, the playback verification identifier may be randomly generated according to a preset verification identifier length; optionally, the preset verification identifier length may be set according to experience or according to actual needs, which is not limited in the embodiment of the present invention; illustratively, the preset verification identifier length may be 16, in which case the playback verification identifier may be a 16-bit string, and so on. Optionally, the target playback agent program may output a playback verification identifier so that the user may perform a camera video playback operation through the playback verification identifier. In an embodiment of the present invention, the playback verification identifier may be used in a subsequent verification process.
[0041] Optionally, the target playback agent can also start a local http service, and can set a preset local port as the target local port, so that the target local port is used as the local port monitored by the target playback agent, and can set a preset local address as the target local address; based on this, the target playback agent can connect to the camera platform and wait for the camera video playback request sent by the player. Optionally, the target playback agent can also use a preset audio format as the target audio format, and / or a preset video format as the target video format, and so on. Optionally, the preset local address, preset local port, preset audio format, and preset video format can all be set according to experience or according to actual needs, and the embodiments of the present invention are not limited to this.
[0042] Optionally, the target playback agent may also include an agent settings page, so the user can set the target local port and / or target local address through the agent settings page, thereby updating the target local port and / or target local address; and / or, the user can set the target audio format and / or target video format in the agent settings page to update the target audio format and / or target video format, etc.; the embodiments of the present invention are not limited to this.
[0043] Optionally, the target video playback device may further include a target player; optionally, the target player may be any player in the target video playback device, such as a standard player. Optionally, the target video playback device may detect the camera video playback request through the target player; specifically, the user may perform a target camera video playback operation for the target camera, in which case the target player may detect the target camera video playback request for the target camera. Optionally, the target camera video playback operation may be a target playback address input operation, in which case the user may input the target playback address in the target player to implement the target playback address input operation, in which case the input target playback address may be used as the target playback address indicated by the target camera video playback request; or, the user may perform a click operation or a long press operation on the target camera video playback button to implement the target camera video playback operation, in which case the user may set the initial playback address corresponding to the target camera through the target player, in which case the target playback address indicated by the target camera video playback request may be determined based on the initial playback address, and so on; the embodiment of the present invention does not limit this.
[0044] Optionally, the target playback address (also referred to as the address requested for playback) may include, but is not limited to: the target camera identifier (such as the camera name or camera number, etc.) of the target camera, the target local address (i.e., the local address of the local machine), the target local port, the target verification identifier, and the target playback identifier, etc.; the embodiment of the present invention does not limit this. Optionally, the target playback identifier may include at least one of the following: the device identifier and the playback number (such as the current playback number) of the target video playback device, etc., which is not limited to this in the embodiment of the present invention. Optionally, the target verification identifier and the target playback identifier may be set according to experience or according to actual needs, which is not limited to this in the embodiment of the present invention; illustratively, the playback number in the target playback identifier may also be randomly generated or generated in sequence, etc. Optionally, the initial playback address may include, but is not limited to: the target camera identifier, the target local address, the target local port, and the target verification identifier, etc., which is not limited to this in the embodiment of the present invention; based on this, the target player may generate a target playback identifier, thereby using the initial playback address and the target playback identifier to construct the target playback address, and the target playback address indicated by the target camera video playback request may be constructed based on the initial playback address and the target playback identifier, etc.
[0045] Exemplarily, the target playback address can be http: / / 127.0.0.1:8123 / live.m3u8?id=device_id&token=1212ads1212ads12&session=Device 1+123; where 127.0.0.1 can be the target local address, 8123 can represent the target local port, id can be the device id of the camera (e.g., device_id can represent the target camera identifier), token can represent the target verification identifier (e.g., the playback verification identifier generated when the target playback proxy program starts), session can represent the target playback identifier, Device 1 can be the device identifier of the target video playback device, 123 can represent the playback number of the current playback (i.e., this playback), m3u8 can represent generating an m3u8 file (a list file for saving audio and video (i.e., audio-video) chunks), and so on.
[0046] Based on this, after the target player detects a target camera video playback request for the target camera, the target video playback device can determine the target playback address indicated by the target camera video playback request through the target player. Correspondingly, the target video playback device can send the target camera video playback request to the target playback proxy program through the target player. The target camera video playback request can carry the target playback address, so that the target player requests to play the video of the target camera from the target playback proxy program, thereby enabling the target playback proxy program to determine the target playback address indicated by the target camera video playback request. In other words, the target camera video playback request can be detected by the target player, and the target playback address also includes the target local address, the target local port, and the target verification identifier; based on this, the target video playback device can send the target camera video playback request to the target playback proxy program through the target player to trigger the target playback proxy program to execute the determination of the target playback address indicated by the target camera video playback request, so that the target playback proxy program determines the target playback address, that is, the target playback proxy program can parse the target camera video playback request after receiving it to achieve the determination of the target playback address. It can be seen that when the target player requests to play, the target playback address (i.e., the playback url (Uniform Resource Locator)) needs to carry the target verification identifier and the target camera identifier, etc.
[0047] Further, the target video playback device can determine whether the target verification mark is a playback verification mark through the target playback agent program; if the target verification mark is a playback verification mark, it can trigger the execution of the following through the target playback agent program, based on the target camera mark, to send a push stream request for the target camera to the camera platform; if the target verification mark is not a playback verification mark, the authentication failure indication information can be output, that is, the following through the target playback agent program, based on the target camera mark, to send a push stream request for the target camera to the camera platform is not triggered. Among them, the authentication failure indication information can be used to indicate authentication failure (i.e., verification failure); optionally, the authentication failure indication information can be set according to experience or according to actual needs, and the embodiment of the present invention does not limit this; illustratively, the authentication failure indication information can be "authentication failed" or "authentication failed", etc. Optionally, when outputting the authentication failure indication information, the target playback agent program can display the authentication failure indication information in the form of a pop-up window to realize the output of the authentication failure indication information; or, the authentication failure indication information can also be returned to the target player through the target playback agent program, so that the target player displays the authentication failure indication information, etc.
[0048] It can be seen that after receiving the target camera video playback request to parse the target playback address, the target playback agent can verify the legitimacy of the target playback address through the target verification identifier in the target playback address, thereby verifying the legitimacy of the target camera video playback request. For example, when the target verification identifier is a playback verification identifier, it can be determined that the target camera video playback request and / or the target playback address have passed the legitimacy verification; when the target verification identifier is not a playback verification identifier, it can be determined that the target camera video playback request and / or the target playback address have not passed the legitimacy verification.
[0049] In summary, it can be seen that the embodiment of the present invention can be accessed through the target local address, that is, a target camera video playback request can be made, which can be safer; and the target camera video playback request and / or the target playback address can be verified through the playback verification mark to further improve the security of the playback request.
[0050] S102, sending a streaming request for the target camera to the camera platform through the target playback agent based on the target camera identifier, so that the camera platform sends a streaming instruction to the target camera.
[0051] In an embodiment of the present invention, the target playback agent may request the camera platform to send a streaming instruction to the target camera; optionally, the target playback agent may simultaneously start receiving the stream. Optionally, before sending a streaming request for the target camera to the camera platform, the target playback agent may also create a target playback (i.e., the current playback) using the target playback identifier; the target playback may be the playback indicated by the target playback identifier; or, the target playback may be created using the playback number in the target playback identifier, etc.; the embodiments of the present invention do not limit this. In other embodiments, the target playback agent may also start receiving the stream after the target camera starts streaming, etc.; the present invention does not limit this.
[0052] Optionally, the above streaming request (herein referring to the streaming request for the target camera) may carry at least one of the following: the target playback identifier and the target camera identifier, etc.; the embodiments of the present invention do not limit this. After receiving the streaming request for the target camera, the camera platform may send a streaming instruction to the target camera based on the data carried in the streaming request (such as the target playback identifier and the target camera identifier, etc.).
[0053] Optionally, the streaming instruction (i.e., the sent streaming address) may include but is not limited to: the target playback identifier, the target camera identifier, and the streaming start identifier, etc.; the embodiments of the present invention do not limit this. Optionally, the streaming start identifier may be set according to experience or according to actual requirements; the embodiments of the present invention do not limit this. Optionally, for a home camera, generally a private peer-to-peer transmission protocol is used for streaming; exemplarily, the streaming instruction may be p2p: / / device_id?session=Device 1+123&cmd=start; where start may be the streaming start identifier.
[0054] S103, receive the audio and video stream pushed by the target camera, and generate a target playback file corresponding to the target camera video playback request based on the received audio and video stream. The target playback file includes at least one slice to be played. The playback protocol output by the target playback agent is the playback protocol supported by the target player in the target video playback device, and the playback format corresponding to one slice to be played is the playback format supported by the target player.
[0055] In an embodiment of the present invention, the target video playback device may receive the audio and video stream pushed by the target camera (i.e., including the audio stream and / or the video stream) through the target playback agent, that is, the target playback agent may receive the audio and video stream pushed by the target camera. Based on this, the target playback file corresponding to the target camera video playback request may be generated through the target playback agent based on the received audio and video stream.
[0056] Optionally, the target playback file can be a playback file under the playback indicated by the target playback identifier, that is, the target playback file can be a playback file under the target playback, and the target playback identifier can be used to indicate the target playback. Optionally, the target playback file can be an m3u8 file (which can be used to describe the latest slice list); optionally, a playback file can be located under a playback directory; based on this, at least one to-be-played slice can be saved in the target playback identifier directory under the http root directory of the target video playback device, that is, saved in the target playback file under the target playback identifier target, and at least one to-be-played slice can be determined based on the received audio and video stream to realize the generation of the target playback file based on the received audio and video stream. Among them, a playback file under playback can also be referred to as a playback file under the corresponding playback identifier directory.
[0057] S104, playing the to-be-played slice in the target playback file through the target player to play the video of the target camera.
[0058] Optionally, after the target player sends the target camera video playback request to the target playback proxy device, it may send a target playback acquisition request for the target playback file (i.e., a target playback acquisition request for the target playback) to the target playback proxy program every preset playback acquisition request interval duration to obtain the slice to be played from the target playback file, thereby playing the slice to be played in the target playback file; optionally, a slice to be played may include an audio stream and / or a video stream within the preset slice duration, that is, the video of the target camera may be a video generated by the audio and video stream of the target camera. Optionally, the preset playback acquisition request interval duration and the preset slice duration may be set according to experience or according to actual needs, and the embodiment of the present invention does not limit this. Optionally, the sending interval between the target camera video playback request and the first target playback acquisition request may be the same as or different from the preset playback acquisition request interval duration, and the embodiment of the present invention does not limit this. Optionally, the target playback acquisition request may be the same as the target camera video playback request. In this case, each target camera video playback request after the first target camera video playback request sent may be regarded as a target playback acquisition request, that is, the target playback acquisition request may carry the above-mentioned target playback address; or, the target playback acquisition request may also be different from the target camera video playback request, such as the target playback acquisition request may not carry the target verification identifier, in which case authentication verification may not be performed, etc.; the embodiments of the present invention are not limited to this.
[0059] Further, when the target player detects the video closing operation for the target camera, it can stop sending the target playback acquisition request to the target playback proxy device, and can close the video playback of the target camera, that is, stop playing the video of the target camera. Optionally, the video of the target camera can be played on the video playback interface of the target player, and the video playback interface can include a video closing button, so the user can click or long press the video closing button (i.e., the pressing time is greater than the preset pressing time threshold) to realize the video closing operation for the target camera; or, the user can realize the video closing operation for the target camera by voice input (such as voice input to close the video of the target camera, etc.); the embodiment of the present invention does not limit this. Optionally, the preset pressing time threshold can be set according to experience or according to actual needs, and the embodiment of the present invention does not limit this.
[0060] The embodiment of the present invention can determine the target playback address indicated by the target camera video playback request after detecting the target camera video playback request for the target camera, and the target playback address includes the target camera identifier of the target camera; and send a streaming request for the target camera to the camera platform based on the target camera identifier through the target playback agent program, so that the camera platform sends a streaming instruction to the target camera. Further, the audio and video stream pushed by the target camera can be received, and a target playback file corresponding to the target camera video playback request can be generated based on the received audio and video stream. The target playback file includes at least one slice to be played, and the playback protocol output by the target playback agent program is the playback protocol supported by the target player in the target video playback device, and the playback format corresponding to a slice to be played is the playback format supported by the target player. Based on this, the slice to be played in the target playback file can be played through the target player to achieve the playback of the target camera video. It can be seen that the embodiment of the present invention can conveniently perform camera video playback to effectively save costs. That is to say, the embodiment of the present invention does not need to build a server on the public network or use a third-party CDN to process the camera stream and forward it to the target video playback device, so as to conveniently realize camera video playback; accordingly, the embodiment of the present invention can realize direct communication between the target camera and the target video playback device through the target playback agent program, and when the target camera and the target video playback device communicate directly, the target player in the target video playback device can support the playback of the target camera video, which can save a lot of server and bandwidth costs, and can greatly save public network server and computing power costs, thereby improving playback efficiency.
[0061] Based on the above description, the embodiment of the present invention also proposes a more specific camera video playback method, which can be executed by the electronic device mentioned above (such as a terminal or a server), and the electronic device mentioned here can be a target video playback device, that is, the camera video playback method can be executed by the target video playback device, that is, the camera video playback method can be executed by the target player and the target playback agent program in the target video playback device; based on this, the camera video playback method can be applied to the target video playback device, and the target video playback device is any video playback device in the camera video playback system, and the target video playback device is installed with a target playback agent program. For the sake of ease of explanation, the following description will take the target video playback device executing the camera video playback method as an example; please refer to Figure 2 The camera video playback method may include the following steps S201-S207:
[0062] S201, after detecting a target camera video playback request for a target camera, determining a target playback address indicated by the target camera video playback request, where the target playback address includes a target camera identifier of the target camera.
[0063] S202, sending a streaming request for the target camera to the camera platform through the target playback agent based on the target camera identifier, so that the camera platform sends a streaming instruction to the target camera.
[0064] S203, receiving the audio and video stream pushed by the target camera, and generating a target playback file corresponding to the target camera video playback request based on the received audio and video stream, the target playback file includes at least one slice to be played, the playback protocol output by the target playback agent program is the playback protocol supported by the target player in the target video playback device, and the playback format corresponding to a slice to be played is the playback format supported by the target player.
[0065] In an embodiment of the present invention, the target playback address may further include a target playback identifier, the target playback identifier may include a device identifier of a target video playback device, the target camera may support establishing point-to-point communication with a target playback agent program through the target playback identifier, the target playback identifier may also support being used to create a target playback, and the target playback file is a playback file under the target playback. Based on this, before the target camera pushes the audio and video stream to the target playback agent program, the target camera may establish point-to-point communication with the target playback agent program based on the target playback identifier, so that the target camera and the target playback agent program can communicate through a point-to-point transmission protocol, that is, the target camera can communicate with the target playback agent program point-to-point.
[0066] Correspondingly, when the target playback agent receives the audio and video stream pushed by the target camera, the target playback agent can receive the audio and video stream pushed by the target camera through point-to-point communication with the target camera. In other words, the target camera can push the audio and video stream to the target playback agent through point-to-point communication with the target camera.
[0067] In an embodiment of the present invention, when the target playback agent generates a target playback file corresponding to the target camera video playback request based on the received audio and video stream, it can determine whether the received audio and video stream meets the target video format and / or target audio format, and the target video format and target audio format are the playback formats supported by the target player. Optionally, the target video format can be a preset video format in the target playback agent, and the target audio format can be a preset audio format in the target playback agent; or, the user can perform an audio format setting operation and / or a video format setting operation on the agent setting page, then the target audio format can be the audio format set by the audio format setting operation, and the target video format can be the video format set by the video format setting operation, and so on. Exemplarily, the target audio format can be aac, and the target video format can be h264.
[0068] Based on this, if the received audio and video stream does not meet the target video format (that is, the video format of the video stream in the received audio and video stream is not the target video format, that is, at this time it can be determined that the received video stream does not meet the target video format), the target playback agent can perform video transcoding on the received audio and video stream according to the target video format, that is, the video stream in the received audio and video stream can be transcoded according to the target video format to obtain a video stream after the playback format is transcoded, and the video format of the video stream after the playback format is transcoded is the target video format; if the received audio and video stream does not meet the target audio format (that is, the audio in the received audio and video stream is not the target audio format The audio format of the stream is not the target audio format, that is, at this time it can be determined that the audio stream in the received audio and video stream does not meet the target audio format), then the received audio and video stream can be audio transcoded according to the target audio format, that is, the audio stream in the received audio and video stream can be audio transcoded according to the target audio format to obtain an audio stream after playback format transcoding, so as to obtain an audio and video stream after playback format transcoding (including a video stream after playback format transcoding and / or an audio stream after playback format transcoding), and the audio format of the audio stream after playback format transcoding is the target audio format; and the audio and video stream after playback format transcoding can be used as the audio and video stream to be cached. It should be understood that when the received audio and video stream does not meet the target video format but meets the target audio format, the audio and video stream after playback format transcoding may include the video stream after playback format transcoding and the audio stream in the received audio and video stream; when the received audio and video stream meets the target video format but does not meet the target audio format, the audio and video stream after playback format transcoding may include the audio stream after playback format transcoding and the video stream in the received audio and video stream; when the received audio and video stream does not meet the target video format and does not meet the target audio format, the audio and video stream after playback format transcoding may include the video stream after playback format transcoding and the audio stream after playback format transcoding.
[0069] Correspondingly, if the received audio and video stream meets the target video format and the target audio format, the received audio and video stream can be used as the audio and video stream to be cached.
[0070] Further, the target playback agent can encapsulate the cached audio and video stream according to the preset playback protocol to obtain the target audio and video stream, and use the target audio and video stream to generate a target playback file corresponding to the target camera video playback request; Figure 3As shown; wherein, the preset playback protocol is the playback protocol outputted by the target playback agent, and the preset playback protocol is the playback protocol supported by the target player. Optionally, the preset playback protocol can be set according to experience or according to actual needs, and the embodiment of the present invention does not limit this; illustratively, the preset playback protocol can be any standard playback protocol, such as the preset playback protocol can be the HLS protocol, in which case, the playback protocol outputted by the target playback agent can be the HLS protocol.
[0071] Optionally, when encapsulating the cached audio and video stream according to the preset playback protocol to obtain the target audio and video stream, the target playback agent program may first encapsulate the cached audio and video stream with MPEGTS (a standard data container format) to obtain an internal encapsulation result, thereby achieving the encapsulation of the MPEGTS stream. In this case, the internal part of the target playback agent program is MPEGTS encapsulation; optionally, the internal encapsulation result may also be called TS (Transport Stream) encapsulation result. Then, the internal encapsulation result may be encapsulated according to the preset playback protocol to obtain the target audio and video stream; illustratively, taking the preset playback protocol as the HLS protocol as an example, the internal encapsulation result may be encapsulated with the HLS protocol to obtain the HLS protocol encapsulation result, and the HLS protocol encapsulation result may be used as the target audio and video stream. Optionally, the video stream and audio stream in the cached audio and video stream may be encapsulated separately (for example, the video stream and audio stream may be encapsulated by MPEGTS separately, in which case the internal encapsulation result may include the internal video stream encapsulation result and the internal audio stream encapsulation result, thereby respectively performing HLS protocol encapsulation on the internal video stream encapsulation result and the internal audio stream encapsulation result), to obtain the target audio and video stream, in which case the target audio and video stream may include the target video stream and the target audio stream, for example, the target audio stream may be an audio stream encapsulated by the HLS protocol, and the target video stream may be a video stream encapsulated by the HLS protocol; or, the audio stream and video stream in the cached audio and video stream may be encapsulated together, so that the target audio and video stream includes an encapsulation file, that is, the audio and video streams are encapsulated together, and so on; the embodiments of the present invention are not limited to this.
[0072] Correspondingly, when the target audio and video stream is used to generate the target playback file corresponding to the target camera video playback request, the target playback agent program can slice the target audio and video stream, and can save each slice under the target audio and video stream to the cache in turn to obtain the playback protocol cache (when the preset playback protocol is the HLS protocol, it can also be called the HLS cache); optionally, the playback protocol cache can be saved in the target playback identification directory under the http root directory of the target video playback device to generate the target playback file corresponding to the target camera video playback request, that is, the target playback file can be generated in the target playback identification directory under the http root directory of the target video playback device, and the playback protocol cache can be saved in the target playback file as the slice to be played in the target playback file, so as to realize the use of the target audio and video stream to generate the target playback file corresponding to the target camera video playback request. Optionally, a slice may include audio frames and / or video frames within a preset slice duration, that is, may include audio streams and / or video streams within a preset slice duration; illustratively, assuming that the preset slice duration is 5 seconds, each slice may be 5 seconds. In this case, the target playback file may be updated every 5 seconds, that is, a new slice may be added to the target playback file every 5 seconds to update the to-be-played slice in the target playback file. Based on this, the target playback file may be updated every preset slice duration.
[0073] Optionally, the playback protocol cache may be less than or equal to a preset cache slice number threshold, that is, the playback protocol cache may include at most a preset cache slice number threshold slices. In this case, when the playback protocol cache is greater than the preset cache slice number threshold, the earliest slice currently existing may be deleted. Optionally, the preset cache slice number threshold may be set according to experience or according to actual needs, and the embodiment of the present invention does not limit this; for example, assuming that the preset cache slice number threshold is 24 and the preset slice duration is 5s, in this case, when the playback protocol cache is greater than 24 slices (i.e., 2 minutes), the earliest slice may be deleted. Based on this, when the playback protocol cache is greater than the preset cache slice number threshold, it may be determined that the earliest slice currently existing is an expired cache, thereby deleting the expired cache. Optionally, the target playback agent may also determine that the cache of any slice in the playback protocol cache is expired when the cache duration of any slice exceeds the preset cache duration threshold, that is, determine that any slice is an expired cache, thereby deleting the expired cache, and so on; the embodiment of the present invention does not limit this. Optionally, the preset expiration cache duration may be set based on experience or actual needs, which is not limited in the embodiment of the present invention.
[0074] Optionally, the number of slices to be played in the target playback file may be less than or equal to a preset threshold of the number of slices to be played, that is, the target playback file may record at most the preset threshold of the number of slices to be played, then when the number of slices to be played in the target playback file reaches the preset threshold of the number of slices to be played, and a new slice to be played needs to be added to the target playback file, the earliest added slice to be played in the target playback file (that is, the earliest slice to be played, which may also be called the first slice to be played in the target playback file at the current time) may be deleted first, and then the slice to be played may be added to the target playback file. Optionally, the preset threshold of the number of slices to be played may be set according to experience or according to actual needs, and the embodiment of the present invention does not limit this; illustratively, the preset threshold of the number of slices to be played may be 10.
[0075] S204, playing the to-be-played slice in the target playback file through the target player to play the video of the target camera.
[0076] In an embodiment of the present invention, the target video playback device can receive a playback acquisition request sent by the player to be acquired for the target playback file through the target playback agent program, and the playback acquisition request includes a to-be-verified identifier: Optionally, the player to be acquired can be any player, such as the player to be acquired can be the target player (in this case, the playback acquisition request can be a target playback acquisition request), and the to-be-verified identifier can be a target verification identifier. Based on this, the target playback agent program can determine whether the to-be-verified identifier is a playback verification identifier; if the to-be-verified identifier is a playback verification identifier, the data to be sent is determined from the target playback file (i.e., the data to be sent is determined from the target playback file at the current time), and the data to be sent is sent to the player to be acquired. Optionally, the playback acquisition request may be a playback file request or a ts slice request, etc. (i.e., the playback acquisition request may be a request for m3u8 or ts slice, etc.), which is not limited in this embodiment of the present invention; optionally, the data to be sent may include the earliest slice to be played among all slices to be played in the target playback file that have not been sent to the player to be acquired, or may include all slices to be played in the target playback file that have not been sent to the player to be acquired, or may include the entire target playback file (i.e., including all slices to be played in the target playback file), etc.; this is not limited in this embodiment of the present invention.
[0077] Correspondingly, if the identification to be verified is not a play verification identification, the file acquisition error indication information can be sent to the player to be acquired. Optionally, the file acquisition error indication information can be set according to experience or according to actual needs, which is not limited in the embodiment of the present invention; optionally, the file acquisition error indication information can be the same as the authentication failure indication information or different, which is not limited in the embodiment of the present invention.
[0078] In summary, after the target camera is normally connected to the network (i.e., normally started and connected to the camera platform), and the target playback agent is installed and started, the target playback address (such as the standard protocol address (i.e., the target local address + the target local port) + the authentication string (i.e., the target verification identifier)) can be used to request playback (such as sending a target camera video playback request to request playback of the target camera's video), so that playback can begin after the target playback agent starts receiving streams, starts audio and video transcoding, and starts the standard playback protocol (i.e., the preset playback protocol) service. Figure 4 shown.
[0079] S205: When the target playback agent receives the playback protocol request for the target playback file, the timeout determination time is updated.
[0080] Optionally, when the target playback agent receives any playback acquisition request for the target playback file, the target playback agent may first determine whether the verification identifier carried by any playback acquisition request is the same as the playback verification identifier, and when the verification identifier carried by any playback acquisition request is the same as the playback verification identifier, it is determined that a playback protocol request (such as an HLS request) for the target playback file is received, thereby triggering the execution of the above-mentioned update timeout determination time; or, it may be determined that a playback protocol request for the target playback file is received when any playback acquisition request for the target playback file is received. In this case, each time a playback acquisition request is received, it can be determined that a playback protocol request for the target playback file is received. It can be seen that each time a playback protocol request for the target playback file is received, the timeout determination time can be updated, such as Figure 5 Optionally, any playback acquisition request may be sent by the target player, or may be sent by other players other than the target player (such as a player in a video playback device other than the target video playback device, or a player in the target video playback device other than the target player, etc.), which is not limited in this embodiment of the present invention; illustratively, any playback acquisition request may be sent by the above-mentioned player to be acquired.
[0081] Optionally, any playback acquisition request can be a playback file request (i.e., an m3u8 request for requesting an m3u8 file), or a ts slice request (for requesting a slice to be played in a target playback file), etc., which is not limited in the embodiment of the present invention. Based on this, the target playback agent can monitor the player's request (including playback file request and ts slice request, etc.) to implement monitoring of playback protocol request.
[0082] Optionally, the timeout determination time can be the request listening interval (i.e., the difference between the current system time and the time of the most recent playback protocol request received). In this case, when the timeout determination time is updated, the timeout determination time can be reset to 0; or, the timeout determination time can also be the end time of the listening (i.e., the time when the listening playback protocol request ends). In this case, when the timeout determination time is updated, the preset listening time threshold can be determined, and the timeout determination time can be updated based on the preset listening time threshold, such as using the summation result between the current system time and the preset listening time threshold (i.e., the time after the preset listening time threshold is accumulated on the current system time) to update the timeout determination time, etc.; the embodiment of the present invention does not limit this. Optionally, the preset listening time threshold can be set according to experience or according to actual needs, and the embodiment of the present invention does not limit this; illustratively, the preset listening time threshold can be 5 minutes.
[0083] S206: Determine whether the target playback file meets the stop request condition based on the timeout determination time at every preset stop detection time.
[0084] Optionally, the preset stop detection duration can be set according to experience or according to actual needs, which is not limited in the embodiment of the present invention. Based on this, the target playback agent can determine whether the target playback file meets the stop request condition based on the timeout determination time (i.e., the current timeout determination time) every preset stop detection duration.
[0085] In one embodiment, when the timeout determination time is the request listening interval duration, the target playback agent program may determine whether the timeout determination time is greater than a preset listening duration threshold, so as to determine whether the target playback file reaches the stop request condition based on the timeout determination time; based on this, when the timeout determination time is greater than the preset listening duration threshold, it can be determined that the target playback file reaches the stop request condition, that is, it can be determined that the target playback reaches the stop request condition, etc.; when the timeout determination time is less than or equal to the preset listening duration threshold, it can be determined that the target playback file does not reach the stop request condition.
[0086] In another embodiment, when the timeout determination time is the end time of monitoring, the target playback agent program can determine whether the current system time exceeds the timeout determination time, so as to determine whether the target playback file reaches the stop request condition based on the timeout determination time; in this case, if the current system time exceeds the timeout determination time, it can be determined that the target playback file reaches the stop request condition; if the current system time does not exceed the timeout determination time, it can be determined that the target playback file does not reach the stop request condition.
[0087] It can be seen that when a playback protocol request for the target playback file is not received within the preset monitoring time threshold, it can be determined that the target playback file reaches the stop request condition, and the playback request timeout for the target playback can be detected.
[0088] S207: If it is determined that the target playback file meets the stop request condition, a target camera push stream stop request is sent to stop the push stream of the target camera.
[0089] Optionally, when sending the target camera push-stream stop request, the target playback agent may send the target camera push-stream stop request to the camera platform, so that the camera platform sends the push-stream stop instruction to the target camera; or, the target playback agent may directly send the target camera push-stream stop request to the target camera through point-to-point communication with the target camera, and the target camera push-stream stop request may be a push-stream stop instruction for the target camera, etc.; the embodiment of the present invention does not limit this. Optionally, the target camera push-stream stop request may carry at least one of the following: target camera identifier, target playback identifier, and push-stream stop identifier, etc., and the embodiment of the present invention does not limit this; accordingly, the push-stream stop instruction may include but is not limited to the target camera identifier, target playback identifier, and push-stream stop identifier, etc., and the embodiment of the present invention does not limit this; exemplary, the format of the push-stream stop instruction may be: p2p: / / device_id?session= device 1+123&cmd=stop, where stop (stop) may represent the push-stream stop identifier.
[0090] Based on this, when it is determined that the target playback file meets the stop request condition, the target video playback device can start the stop process; further, the target camera can stop streaming after receiving the stop streaming instruction; then correspondingly, the target playback agent can stop receiving the stream, such as Figure 6 Optionally, the target playback agent program can also delete the target playback and clear the local cache, that is, clear the local playback protocol cache, etc. after stopping the streaming.
[0091] In summary, the embodiments of the present invention can directly realize point-to-point communication between the target video playback device and the target camera through the target playback agent program, which can save a lot of server and bandwidth costs, and can perform operations such as transcoding and protocol encapsulation of the received audio and video streams on the target video playback device through the target playback agent program, which can greatly save public network servers and computing power costs.
[0092] The embodiment of the present invention can determine the target playback address indicated by the target camera video playback request after detecting the target camera video playback request, and the target playback address includes the target camera identifier of the target camera; and send a push stream request for the target camera to the camera platform based on the target camera identifier through the target playback agent program, so that the camera platform sends a push stream instruction to the target camera. Then, the audio and video stream pushed by the target camera can be received, and the target playback file corresponding to the target camera video playback request can be generated based on the received audio and video stream. The target playback file includes at least one slice to be played, and the playback protocol output by the target playback agent program is the playback protocol supported by the target player in the target video playback device, and the playback format corresponding to a slice to be played is the playback format supported by the target player. Based on this, the slice to be played in the target playback file can be played through the target player to play the video of the target camera, and the camera video can be played conveniently to effectively save costs. Furthermore, when the target playback agent receives a playback protocol request for the target playback file, the timeout determination time is updated; and every preset stop detection time, it is determined whether the target playback file has reached the stop request condition based on the timeout determination time; if it is determined that the target playback file has reached the stop request condition, a target camera stop streaming request is sent to stop the target camera from streaming. It can be seen that the embodiment of the present invention can stop the playback process when the target playback file reaches the stop request condition, which can avoid the camera from streaming all the time, that is, the camera can stop streaming after a period of time after the playback ends, and the camera can be requested to stream again when the camera video needs to be played next time to achieve camera video playback, which can further save costs and avoid waste of resources.
[0093] Based on the description of the relevant embodiments of the above-mentioned camera video playback method, the embodiment of the present invention further proposes a camera video playback device, which can be a computer program (including program code) running in an electronic device, and the electronic device here can be a target video playback device, that is, the camera video playback device runs in the target video playback device, and the target video playback device is any video playback device in the camera video playback system, and the target video playback device is installed with a target playback agent program; Figure 7 As shown, the camera video playback device may include a processing unit 701, a sending unit 702 and a receiving unit 703. The camera video playback device may execute Figure 1 or Figure 2 The camera video playback method shown, that is, the camera video playback device can run the above units:
[0094] The processing unit 701 is used to determine the target playback address indicated by the target camera video playback request after detecting the target camera video playback request, wherein the target playback address includes the target camera identifier of the target camera;
[0095] The sending unit 702 is used to send a push stream request for the target camera to the camera platform through the target playback agent program based on the target camera identifier, so that the camera platform sends a push stream instruction to the target camera;
[0096] The receiving unit 703 is used to receive the audio and video stream pushed by the target camera;
[0097] The processing unit 701 is further used to generate a target playback file corresponding to the target camera video playback request based on the received audio and video stream, the target playback file includes at least one slice to be played, the playback protocol output by the target playback agent program is the playback protocol supported by the target player in the target video playback device, and the playback format corresponding to one slice to be played is the playback format supported by the target player;
[0098] The processing unit 701 is further configured to play the to-be-played slice in the target playback file through the target player, so as to play the video of the target camera.
[0099] In one embodiment, the target playback address also includes a target playback identifier, the target playback identifier includes a device identifier of the target video playback device, the target camera supports establishing point-to-point communication with the target playback agent through the target playback identifier, the target playback identifier also supports creating a target playback, and the target playback file is a playback file under the target playback; when receiving the audio and video stream pushed by the target camera, the receiving unit 703 can be specifically used to:
[0100] Through point-to-point communication with the target camera, the audio and video stream pushed by the target camera is received.
[0101] In another implementation manner, when the processing unit 701 generates the target playback file corresponding to the target camera video playback request based on the received audio and video stream, it can be specifically used to:
[0102] Determine whether the received audio and video stream meets the target video format and / or the target audio format, where the target video format and the target audio format are playback formats supported by the target player;
[0103] If the received audio and video stream does not meet the target video format, the received audio and video stream is transcoded according to the target video format; if the received audio and video stream does not meet the target audio format, the received audio and video stream is transcoded according to the target audio format to obtain an audio and video stream after being transcoded in a playback format; and the audio and video stream after being transcoded in the playback format is used as the audio and video stream to be cached;
[0104] If the received audio and video stream meets the target video format and the target audio format, the received audio and video stream is used as the audio and video stream to be cached;
[0105] The audio and video stream to be cached is encapsulated according to the preset playback protocol to obtain the target audio and video stream, and the target audio and video stream is used to generate the target playback file corresponding to the target camera video playback request. The preset playback protocol is the playback protocol output by the target playback agent program, and the preset playback protocol is the playback protocol supported by the target player.
[0106] In another implementation manner, the target camera video playback request is detected by the target player, the target playback address also includes a target local address, a target local port and a target verification identifier, and the sending unit 702 can also be used to:
[0107] The target camera video playback request is sent to the target playback agent program through the target player, so as to trigger the execution of determining the target playback address indicated by the target camera video playback request through the target playback agent program;
[0108] The processing unit 701 may also be used for:
[0109] Through the target playback agent, determine whether the target verification identifier is the playback verification identifier; if the target verification identifier is the playback verification identifier, trigger the execution of the target playback agent, and based on the target camera identifier, send a streaming request for the target camera to the camera platform; if the target verification identifier is not the playback verification identifier, output authentication failure indication information.
[0110] In another implementation, the processing unit 701 may also be used to:
[0111] When a playback agent login operation is detected, determining whether the login is successful based on the login information indicated by the playback agent login operation;
[0112] After successful login, the play verification identifier is generated.
[0113] In another implementation manner, the receiving unit 703 may also be used to:
[0114] The target playback agent receives a playback acquisition request sent by a player to be acquired for the target playback file, wherein the playback acquisition request includes a to-be-verified identifier:
[0115] The processing unit 701 may also be used for:
[0116] Determine whether the to-be-verified identifier is a playback verification identifier;
[0117] The sending unit 702 may also be used for:
[0118] If the to-be-verified identifier is the play verification identifier, determining the data to be sent from the target play file, and sending the data to be sent to the player to be acquired;
[0119] If the identifier to be verified is not the playback verification identifier, file acquisition error indication information is sent to the player to be acquired.
[0120] In another implementation, the processing unit 701 may also be used to:
[0121] When the target playback agent receives a playback protocol request for the target playback file, updating a timeout determination time;
[0122] At predetermined stop detection time intervals, judging whether the target playback file meets the stop request condition based on the timeout determination time;
[0123] The sending unit 702 may also be used for:
[0124] If it is determined that the target playback file meets the stop request condition, a target camera streaming stop request is sent to stop the streaming of the target camera.
[0125] According to another embodiment of the present invention, Figure 7 Each unit in the camera video playback device shown can be separately or completely combined into one or several other units to form, or one (some) of the units can be further divided into multiple functionally smaller units to form, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present invention. The above-mentioned units are divided based on logical functions. In actual applications, the function of one unit can also be implemented by multiple units, or the functions of multiple units can be implemented by one unit. In other embodiments of the present invention, any camera video playback device may also include other units. In actual applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units.
[0126] According to another embodiment of the present invention, the program can be executed by running a program on a general electronic device such as a computer including a central processing unit (CPU), a random access memory medium (RAM), a read-only memory medium (ROM), and other processing elements and storage elements. Figure 1 or Figure 2 A computer program (including program code) for each step involved in the corresponding method shown in Figure 7 The camera video playback device shown in the embodiment of the present invention is used to implement the camera video playback method of the embodiment of the present invention. The computer program can be recorded on a computer storage medium, for example, and loaded into the above-mentioned electronic device through the computer storage medium and run therein.
[0127] The embodiment of the present invention can determine the target playback address indicated by the target camera video playback request after detecting the target camera video playback request for the target camera, and the target playback address includes the target camera identifier of the target camera; and send a streaming request for the target camera to the camera platform based on the target camera identifier through the target playback agent program, so that the camera platform sends a streaming instruction to the target camera. Further, the audio and video stream pushed by the target camera can be received, and a target playback file corresponding to the target camera video playback request can be generated based on the received audio and video stream. The target playback file includes at least one slice to be played, and the playback protocol output by the target playback agent program is the playback protocol supported by the target player in the target video playback device, and the playback format corresponding to a slice to be played is the playback format supported by the target player. Based on this, the slice to be played in the target playback file can be played through the target player to achieve the playback of the target camera video. It can be seen that the embodiment of the present invention can conveniently perform camera video playback to effectively save costs. That is to say, the embodiment of the present invention does not need to build a server on the public network or use a third-party CDN to process the camera stream and forward it to the target video playback device, so as to conveniently realize camera video playback; accordingly, the embodiment of the present invention can realize direct communication between the target camera and the target video playback device through the target playback agent program, and when the target camera and the target video playback device communicate directly, the target player in the target video playback device can support the playback of the target camera video, which can save a lot of server and bandwidth costs, and can greatly save public network server and computing power costs, thereby improving playback efficiency.
[0128] Based on the description of the above method embodiment and device embodiment, the exemplary embodiment of the present invention further provides an electronic device, including: at least one processor; and a memory connected to the at least one processor in communication. The memory stores a computer program that can be executed by the at least one processor, and the computer program is used to enable the electronic device to perform the method according to the embodiment of the present invention when executed by the at least one processor.
[0129] An exemplary embodiment of the present invention also provides a camera video playback system, which includes a target video playback device, and the target video playback device is any video playback device in the camera video playback system; wherein the target video playback device is installed with a target playback agent program, and the target video playback device is used to execute the method according to an embodiment of the present invention.
[0130] Exemplary embodiments of the present invention also provide a non-transitory computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor of a computer, is used to cause the computer to perform a method according to an embodiment of the present invention.
[0131] An exemplary embodiment of the present invention further provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor of a computer, the computer is used to enable the computer to perform a method according to an embodiment of the present invention.
[0132] refer to Figure 8 , a block diagram of an electronic device 800 that can be used as a server or client of the present invention will now be described, which is an example of a hardware device that can be applied to various aspects of the present invention. The electronic device is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0133] like Figure 8As shown, the electronic device 800 includes a computing unit 801, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 to a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the electronic device 800 can also be stored. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0134] A plurality of components in the electronic device 800 are connected to the I / O interface 805, including: an input unit 806, an output unit 807, a storage unit 808, and a communication unit 809. The input unit 806 may be any type of device capable of inputting information to the electronic device 800, and the input unit 806 may receive input digital or character information, and generate key signal inputs related to user settings and / or function control of the electronic device. The output unit 807 may be any type of device capable of presenting information, and may include, but is not limited to, a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. The storage unit 808 may include, but is not limited to, a disk, an optical disk. The communication unit 809 allows the electronic device 800 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks, and may include, but is not limited to, a modem, a network card, an infrared communication device, a wireless communication transceiver, and / or a chipset, such as a Bluetooth™ device, a WiFi device, a WiMax device, a cellular communication device, and / or the like.
[0135] The computing unit 801 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 801 performs the various methods and processes described above. For example, in some embodiments, the camera video playback method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 800 via the ROM 802 and / or the communication unit 809. In some embodiments, the computing unit 801 may be configured to execute the camera video playback method in any other appropriate manner (e.g., by means of firmware).
[0136] The program code for implementing the method of the present invention can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code can be executed entirely on the machine, partially on the machine, partially on the machine as a stand-alone software package and partially on a remote machine, or entirely on a remote machine or server.
[0137] In the context of the present invention, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0138] As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and / or device (e.g., disk, optical disk, memory, programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.
[0139] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0140] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0141] A computer system may include clients and servers. Clients and servers are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship to each other.
[0142] Furthermore, it should be understood that what is disclosed above is only a preferred embodiment of the present invention, and certainly cannot be used to limit the scope of rights of the present invention. Therefore, equivalent changes made according to the claims of the present invention are still within the scope of the present invention.
Claims
1. A camera video playback method, characterized in that: The method is applied to a target video playback device, the target video playback device is any video playback device in a camera video playback system, and the target video playback device is installed with a target playback agent program; the method comprises: After detecting a target camera video playback request for a target camera, determining a target playback address indicated by the target camera video playback request, wherein the target playback address includes a target camera identifier of the target camera; Through the target playback agent, based on the target camera identifier, a push stream request for the target camera is sent to the camera platform, so that the camera platform sends a push stream instruction to the target camera; Receive the audio and video stream pushed by the target camera, and generate a target playback file corresponding to the target camera video playback request based on the received audio and video stream, wherein the target playback file includes at least one slice to be played, and the playback protocol output by the target playback agent program is the playback protocol supported by the target player in the target video playback device, and the playback format corresponding to one slice to be played is the playback format supported by the target player; The target player plays the slice to be played in the target playback file to play the video of the target camera.
2. The method according to claim 1, characterized in that The target playback address also includes a target playback identifier, the target playback identifier includes a device identifier of the target video playback device, the target camera supports establishing point-to-point communication with the target playback agent through the target playback identifier, the target playback identifier also supports creating a target playback, and the target playback file is a playback file under the target playback; The receiving the audio and video stream pushed by the target camera includes: Through point-to-point communication with the target camera, the audio and video stream pushed by the target camera is received.
3. The method according to claim 1 or 2, characterized in that: The generating a target playback file corresponding to the target camera video playback request based on the received audio and video stream includes: Determine whether the received audio and video stream meets the target video format and / or the target audio format, where the target video format and the target audio format are playback formats supported by the target player; If the received audio and video stream does not meet the target video format, the received audio and video stream is transcoded according to the target video format; if the received audio and video stream does not meet the target audio format, the received audio and video stream is transcoded according to the target audio format to obtain an audio and video stream after being transcoded in a playback format; and the audio and video stream after being transcoded in the playback format is used as the audio and video stream to be cached; If the received audio and video stream meets the target video format and the target audio format, the received audio and video stream is used as the audio and video stream to be cached; The audio and video stream to be cached is encapsulated according to the preset playback protocol to obtain the target audio and video stream, and the target audio and video stream is used to generate the target playback file corresponding to the target camera video playback request. The preset playback protocol is the playback protocol output by the target playback agent program, and the preset playback protocol is the playback protocol supported by the target player.
4. The method according to claim 1 or 2, characterized in that: The target camera video playback request is detected by the target player, the target playback address also includes a target local address, a target local port and a target verification identifier, and the method further includes: The target camera video playback request is sent to the target playback agent program through the target player, so as to trigger the execution of determining the target playback address indicated by the target camera video playback request through the target playback agent program; Through the target playback agent, determine whether the target verification identifier is the playback verification identifier; if the target verification identifier is the playback verification identifier, trigger the execution of the target playback agent, and based on the target camera identifier, send a streaming request for the target camera to the camera platform; if the target verification identifier is not the playback verification identifier, output authentication failure indication information.
5. The method according to claim 4, characterized in that The method further comprises: When a playback agent login operation is detected, determining whether the login is successful based on the login information indicated by the playback agent login operation; After successful login, the play verification identifier is generated.
6. The method according to claim 1 or 2, characterized in that: The method further comprises: The target playback agent receives a playback acquisition request sent by a player to be acquired for the target playback file, wherein the playback acquisition request includes a to-be-verified identifier, and the player to be acquired is any player: Determine whether the to-be-verified identifier is a playback verification identifier; If the to-be-verified identifier is the play verification identifier, determining the data to be sent from the target play file, and sending the data to be sent to the player to be acquired; If the identifier to be verified is not the playback verification identifier, file acquisition error indication information is sent to the player to be acquired.
7. The method according to claim 1 or 2, characterized in that: The method further comprises: When the target playback agent receives a playback protocol request for the target playback file, updating a timeout determination time; At predetermined stop detection time intervals, judging whether the target playback file meets the stop request condition based on the timeout determination time; If it is determined that the target playback file meets the stop request condition, a target camera streaming stop request is sent to stop the streaming of the target camera.
8. A camera video playback device, characterized in that: The camera video playback device runs in a target video playback device, the target video playback device is any video playback device in the camera video playback system, and the target video playback device is installed with a target playback agent program; The device comprises: A processing unit, configured to, after detecting a target camera video playback request for a target camera, determine a target playback address indicated by the target camera video playback request, wherein the target playback address includes a target camera identifier of the target camera; A sending unit, configured to send a streaming request for the target camera to the camera platform through the target playback agent program based on the target camera identifier, so that the camera platform sends a streaming instruction to the target camera; A receiving unit, used to receive the audio and video stream pushed by the target camera; The processing unit is further used to generate a target playback file corresponding to the target camera video playback request based on the received audio and video stream, the target playback file includes at least one slice to be played, the playback protocol output by the target playback agent program is the playback protocol supported by the target player in the target video playback device, and the playback format corresponding to one slice to be played is the playback format supported by the target player; The processing unit is further used to play the to-be-played slice in the target playback file through the target player to play the video of the target camera.
9. An electronic device, characterized in that: include: processor; as well as Memory for storing programs, The program includes instructions, which, when executed by the processor, cause the processor to perform the method according to any one of claims 1 to 7.
10. A camera video playback system, characterized in that: The camera video playback system includes a target video playback device, and the target video playback device is any video playback device in the camera video playback system; wherein the target video playback device is installed with a target playback agent program, and the target video playback device is used to execute the method according to any one of claims 1-7.
