Disclosure of Invention
In order to solve the technical problem, the invention provides a video live broadcasting method and device.
According to a first aspect of the present invention, the present invention provides a live video broadcasting method, which is applied to a server, and includes:
step 1, receiving a request of a client for requesting live video, wherein the request comprises a unique identifier of the client;
step 2, creating a control service and a streaming media service corresponding to the unique identifier;
step 3, returning the access address of the control service and the access address of the streaming media service to the client;
step 4, receiving area coordinate information of live video sent by a client based on the access address, acquiring live video data based on the area coordinate information, and publishing the acquired live video data to an access address of the streaming media service;
and 5, pushing the live video data to a client based on the access address.
The video live broadcast method can also have the following characteristics:
in step 4, the acquiring live video data based on the area coordinate information includes:
extracting the region coordinate information, wherein the region coordinate information comprises a reference coordinate point, a region width and a region height based on the reference coordinate point;
and taking the video data corresponding to the area determined by the reference coordinate point, the area width and the area height as live video data.
The video live broadcast method can also have the following characteristics:
in the step 4, the method also comprises the steps of obtaining a canvas,
the obtaining canvas comprises:
acquiring frame video data of multiple paths of acquisition equipment at the same time, and generating canvas for all the frame video data according to a preset rule, wherein the canvas comprises hundred million-level pixel image data.
The video live broadcast method can also have the following characteristics:
in step 4, the acquiring live video data based on the area coordinate information includes:
determining the position relation of pictures corresponding to all the frame video data under the same coordinate system;
and determining an area corresponding to the area coordinate information in the canvas, and taking video data corresponding to the area corresponding to the determined area coordinate information as live video data.
The video live broadcast method can also have the following characteristics:
the acquiring of the live video data based on the area coordinate information includes:
determining the position relation of the pictures of the multi-channel acquisition equipment under the same coordinate system;
and determining video data corresponding to the area coordinate information according to the determined position relation of the pictures of the multi-channel acquisition equipment, and taking the video data corresponding to the determined area coordinate information as live video data.
The video live broadcast method can also have the following characteristics:
before step 2, the method further comprises the following steps:
and searching and determining whether a control service and a streaming media service corresponding to the unique identifier exist or not based on the unique identifier, and if so, executing the step 3.
The video live broadcast method can also have the following characteristics:
in step 1, the method further comprises: the request includes a resolution of the client;
in step 5, the pushing the live video data to the client includes: converting the live video data according to the resolution ratio and then sending the converted live video data to a client
According to a second aspect of the present invention, there is provided a video live broadcasting apparatus, adapted to a server, comprising:
the receiving module is used for receiving a request of a client for requesting live video, wherein the request comprises a unique identifier of the client;
a control service module: the control server is used for creating a control service corresponding to the unique identifier and returning an access address of the control service to the client; the access address is used for receiving the area coordinate information of the live video sent by the client, acquiring the live video data based on the area coordinate information, and issuing the acquired live video data to the access address of the streaming media service;
the streaming media service module: the system is used for creating the streaming media service corresponding to the unique identifier and returning the access address of the streaming media service to the client; and the server is also used for pushing the live video data to a client based on the access address of the streaming media service.
In a third aspect of the invention, a computer-readable storage medium is provided, on which a computer program is stored, which program, when being executed by a processor, is adapted to carry out the above-mentioned method steps.
In a fourth aspect of the invention, a computer device is provided, comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the method when executing the program.
The video live broadcast method and the device have the following beneficial effects:
1. each client has exclusivity to the control service and the streaming media service and is in a one-to-one relationship, and the client flexibly controls the watching area through the corresponding control service;
2. the resolution of each client can be different, the streaming media service can be coded according to the resolution requested by the client, and the client can watch the streaming media at the proper resolution;
3. and the service is provided according to the requirement, so that the server resource is saved. The control service and the streaming media service are started as required in the live broadcast process, and when the client does not watch live broadcast video any more, the control service and the streaming media service do not need to be started;
4. the server only sends the video data corresponding to the area of the client appointed to watch the live video to the client as the live video data, and other video data outside the area do not need to be sent, so that the problems of bandwidth waste and coding and decoding resource waste caused by the transmission of redundant video data between the server and the client are solved;
5. the requirement that a client sends different area coordinate information to realize that a user designates a watching area and freely switches a live broadcast view angle mode to watch live broadcast video is met;
6. the ultrahigh-definition video with hundred million-level pixels is used as a video source, so that a user can see any local detail image picture in a panoramic video image, and the important requirement of capturing all details of the picture by the user is met.
Other characteristic features and advantages of the invention will become apparent from the following description of exemplary embodiments, which is to be read in connection with the accompanying drawings.
DETAILED DESCRIPTION OF EMBODIMENT (S) OF INVENTION
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention. It should be noted that the embodiments and features of the embodiments in the present application may be arbitrarily combined with each other without conflict.
Fig. 1 is a flowchart illustrating a video live broadcasting method according to an embodiment of the present invention.
As shown in fig. 1, the video live broadcasting method is applied to a server, and is characterized by including:
step 101, receiving a request of a client for requesting live video, wherein the request comprises a unique identifier of the client;
step 102, creating a control service and a streaming media service corresponding to the unique identifier;
step 103, returning the access address of the control service and the access address of the streaming media service to the client;
104, receiving regional coordinate information of a live video sent by a client based on an access address, acquiring live video data based on the regional coordinate information, and issuing the acquired live video data to an access address of a streaming media service;
and 105, pushing the live video data to the client based on the access address.
The client can be a computer end, a mobile phone end, a flat plate end, VR glasses and the like.
In the embodiment, a server can be connected with a plurality of clients, the server receives a request of live video data sent by the clients, the request carries a unique identifier of the client, the server creates a control service and a streaming media service corresponding to the unique identifier and returns an access address of the control service and an access address of the streaming media service to the clients, the clients send regional coordinate information of the live video requested to be watched to the server by accessing the access address of the control service corresponding to the clients, the server receives the regional coordinate information, acquires the live video data according to the regional coordinate information, and issues the acquired live video data to the access address of the streaming media service; the client watches the requested live video data by entering the access address, on one hand, the exclusivity of each client to the control service and the streaming media service is realized, the relationship is one-to-one, the client flexibly controls the watching video area through the corresponding control service, in addition, the server sends the video data corresponding to the area requested to be watched by the client to the client as the live video data, other video data outside the area do not need to be sent, and the problems of bandwidth waste and coding and decoding resource waste caused by the transmission of redundant video data between the server and the client are solved; meanwhile, the requirement that the client sends different area coordinate information is met, and the requirement that a user designates a watching area and freely switches a live broadcast view angle mode to watch live broadcast video is met.
In step 101, the protocol in which the server receives the request includes, but is not limited to, the HTTP protocol.
Further, the method further comprises: in step 101, the request includes the resolution of the client;
specifically, in step 105, pushing the acquired live video data to the client includes: and converting the acquired live video data according to the resolution ratio and then sending the converted live video data to the client.
In this embodiment, the resolution of each client may be different, and the server may perform encoding according to the resolution requested by the client, and send the encoded data to the corresponding client, so that the client can view the encoded data at the specified resolution.
Further, before step 102, the method further includes: and searching and determining whether a control service and a streaming media service corresponding to the unique identifier exist based on the unique identifier, and if so, executing step 103.
In this embodiment, the unique identifier of the client is used for searching to determine whether the client requesting the live video has the control service and the streaming media service already in the server, so as to prevent the problem of occupying space resources due to repeatedly creating the control service and the streaming media service corresponding to the client, that is, providing the service according to the requirement, and saving the server resources.
Further, the step 104 of acquiring live video data based on the area coordinate information includes:
extracting region coordinate information, wherein the region coordinate information comprises a reference coordinate point, a region width and a region height based on the reference coordinate point; and taking the video data corresponding to the area determined by the reference coordinate point, the area width and the area height as live video data.
Specifically, for example, the client sends area coordinate information of (x, y, w, h) to request viewing of an area, where (x, y) represents the coordinates of the area at the upper left corner of the panoramic video image in the normalized coordinate system, w is the horizontal direction range of the viewing area in the normalized coordinate system of the panoramic video image, i.e., the area width, h is the vertical direction range of the viewing area in the normalized coordinate system of the panoramic video image, i.e., the area height, i.e., a rectangular area is determined according to the area coordinate information of (x, y, w, h), and video data corresponding to the determined rectangular area is taken as live video data.
Further, the method step 101 further includes: and acquiring live broadcast period information, wherein the live broadcast period information can be time period information appointed by a user in a request, and when the time period information is not appointed by the user, a time point of receiving the request is taken as a starting time, and a time point of quitting the request of the client from the server or a time point of disconnecting the client from the server is taken as an end time and recorded as the live broadcast period information.
Acquiring live video data based on the region coordinate information in step 104 includes: and acquiring live broadcast video data in the live broadcast time interval information based on the region coordinate information.
Further, in step 104: still including acquireing the canvas, specifically, acquireing the canvas includes: acquiring frame video data of multiple paths of acquisition equipment at the same time, and generating canvas comprising hundred million-level pixel image data for all the frame video data according to a preset rule.
Giga-pixel image data is image data of several hundred million or even billion pixels in resolution.
Further, the step 104 of acquiring live video data based on the area coordinate information includes:
determining the position relation of pictures corresponding to all frame video data under the same coordinate system;
and determining an area corresponding to the area coordinate information in the canvas, and taking video data corresponding to the area corresponding to the determined area coordinate information as live video data.
The canvas decodes frame video data which are collected by a server and coded at the same time and received by a plurality of paths of collecting equipment (such as an array type camera), calibrates the cameras through an overlapping area between adjacent cameras, and splices the frame video data into a panoramic video image after unifying colors according to a preset rule, such as transformation of position coordinates, splicing and fusion of pictures, or shoots a scene video for a wide-angle camera array and generates the panoramic video image through a splicing algorithm, wherein the panoramic video image is a hundred million-level pixel image.
The array camera is characterized in that a certain number of cameras form an array, the array comprises a wide-angle camera serving as a reference and a plurality of telephoto camera arrays which are responsible for shooting high-resolution detail videos in a specific area, and the array camera solves the technical problem that the traditional camera cannot capture panoramic ultra-high definition image data. The server fuses high-resolution detail videos shot by the array type camera to obtain panoramic video images with hundred million-level pixels, ultra-high-definition videos with hundred million-level pixels are used as video sources, the resolution (such as 4K or 8K) specified by a user and live videos in any specified area can be sent to the user, and the important requirement of the user for capturing all details of pictures is met.
FIG. 2 illustrates a diagram of determining a region in a canvas to which region coordinate information corresponds.
As shown in fig. 2, the obtained canvas of the panoramic video image exists in the server, and is a complete video canvas composed of the frames of the multi-channel capturing device, the canvas coordinates are converted, the position relationship of the frames corresponding to all the frame video data is determined in the same coordinate system, specifically, the coordinate information of the canvas is converted, the canvas coordinates can be customized, the upper left corner coordinate of the canvas is defined as (0, 0), the upper right corner coordinate of the canvas is defined as (1, 0), the lower left corner coordinate of the canvas is defined as (0, 1), the lower right corner coordinate of the canvas is defined as (1, 1), after the canvas coordinates are converted into the normalized coordinate system, the position relationship of the frames corresponding to all the frame video data is determined, for example, the area coordinate information requested to be watched by the client is (0.18, 0.30, 0.49, 0.50), wherein (0.18, 0.30) is the coordinate of the point a, 0.49 is the area width, and 0.50 is the area height, and the rectangular area determined and corresponding to the three parameters in the coordinate system represents an area which the client wants to see, and the video data corresponding to the area is used as live video data.
In the embodiment, the acquisition equipment encodes the acquired data at the same moment and sends the encoded data to the server, the server receives all video data and then performs synchronous decoding, the synchronously decoded frame video data are spliced into the canvas of the panoramic video image with hundred million-level pixels, the server obtains the video data corresponding to the area which the client wants to see from the canvas of the panoramic video image according to the area coordinate information sent by the client, and then the video data is converted and sent to the user according to the specified resolution, so that the ultrahigh-definition video with hundred million-level pixels is used as a video source, the user specified resolution (such as 4K or 8K) and the live video in any specified area are sent to the user, the user can see any local detail image picture in the panoramic video, and the important requirement of the user for capturing all details of the picture is met.
In order to reduce the load of the server, the acquiring live video data based on the area coordinate information in step 104 includes:
determining the position relation of the pictures of the multi-channel acquisition equipment under the same coordinate system;
and determining video data corresponding to the area coordinate information according to the determined position relation of the pictures of the multi-channel acquisition equipment, and taking the video data corresponding to the determined area coordinate information as live video data.
Specifically, the coordinates of the upper left corner of the picture of the panoramic video to be captured may be defined as (0, 0), the coordinates of the upper right corner of the panoramic video to be captured are defined as (1, 0), the coordinates of the lower left corner of the panoramic video to be captured are defined as (0, 1), and the coordinates of the lower right corner of the panoramic video to be captured are defined as (1, 1).
The server can determine the acquisition equipment covered by the area and the watching area of each acquisition equipment according to the position relation of the pictures of each path of acquisition equipment through the received area coordinate information, cuts the watching area of each acquisition equipment, fuses and splices the cut videos into video data, and then determines the video data as the video data corresponding to the area coordinate information.
In the embodiment, under the same coordinate system, according to the position relation of the picture of each acquisition device in the panoramic video picture, according to the regional coordinate information of the viewing region requested by the client, the acquisition device covered by the rectangular region determined by the regional coordinate information and the viewing region covered by the acquisition device are determined, each viewing region is cut and then fused and spliced into the video data corresponding to the regional coordinate information, the video data is converted into the resolution requested by the client, and the resolution is encoded and packaged and then sent to the client, so that the canvas for generating the panoramic video image in the server is not needed, and the load of the server can be reduced.
The video live broadcast method further comprises the following steps: and step 106, when receiving the exit request of the client, closing the control service and the streaming media service corresponding to the unique identifier of the client.
In the embodiment, when the server receives a client request to quit, the control service and the streaming media service corresponding to the client are closed so as to release the space resources of the server in time, when a large number of clients request to access the server, the server can also actively detect whether the client and the server are disconnected, if no data traffic between the server and the client is detected in a long time or a preset time period, the client and the server are judged to be disconnected, the control service and the streaming media service corresponding to the client are closed, and therefore the server resources are reasonably distributed so as to ensure normal access of other clients.
The video live broadcast method further comprises the following steps: step 107, notifying the client of successful logout.
Fig. 3 is a block diagram of a video live broadcasting device 300 of the present invention, which is suitable for a server, and includes: a receiving module 301, a control service module 302 and a streaming media service module 303;
a receiving module 301, configured to receive a request of a client requesting a live video, where the request includes a unique identifier of the client; associating access addresses with access addresses
The control service module 302: the control server is used for establishing a control service corresponding to the unique identifier and returning an access address of the control service to the client; the system is also used for receiving the regional coordinate information of the live video sent by the client based on the access address, acquiring the live video data based on the regional coordinate information, and issuing the acquired live video data to the access address of the streaming media service;
the streaming media service module 303: the system is used for creating the streaming media service corresponding to the unique identifier and returning the access address of the streaming media service to the client; and the client is also used for pushing the live video data to the client based on the access address of the streaming media service.
Further, the control service module 302: the system is also used for extracting area coordinate information, wherein the area coordinate information comprises a reference coordinate point, an area width and an area height based on the reference coordinate point; and taking the video data corresponding to the area determined by the reference coordinate point, the area width and the area height as live video data.
Further, the control service module 302: it is also used for obtaining a canvas, specifically, obtaining a canvas comprises: acquiring frame video data of multiple paths of acquisition equipment at the same time, and generating canvas comprising hundred million-level pixel image data for all the frame video data according to a preset rule.
Further, the control service module 302: the video processing device is also used for determining the position relation of pictures corresponding to all the frame video data under the same coordinate system;
and determining an area corresponding to the area coordinate information in the canvas, and taking video data corresponding to the area corresponding to the determined area coordinate information as live video data.
Further, the control service module 302: the multi-channel acquisition equipment is also used for determining the position relation of the pictures of the multi-channel acquisition equipment in the same coordinate system;
and determining video data corresponding to the area coordinate information according to the determined position relation of the pictures of the multi-channel acquisition equipment, and taking the video data corresponding to the determined area coordinate information as live video data.
Further, the receiving module 301 is further configured to obtain live time period information;
the control service module 302: and the video server is also used for acquiring the live broadcast video data in the live broadcast time interval information based on the area coordinate information.
Further, the receiving module 301 is further configured to receive a resolution of the client;
the streaming media service module 203: and the system is also used for converting the live video data according to the resolution ratio and then sending the converted live video data to the client.
Further, the receiving module 301 is further configured to determine whether a control service and a streaming media service corresponding to the unique identifier already exist based on the unique identifier lookup of the client.
Further, the receiving module 301 is further configured to receive a quit request of the client;
the control service module 302: the receiving module is also used for closing the control service corresponding to the unique identifier of the client when receiving the quit request of the client;
the streaming media service module 303: and the receiving module is also used for closing the streaming media service corresponding to the unique identifier of the client when receiving the quit request of the client.
The video live broadcasting device further comprises: and informing the client of successful exit.
The methods provided herein are described below in connection with the systems provided herein:
fig. 4 is an interaction diagram illustrating a video live method according to an example embodiment.
As shown in fig. 4, in step 401, the client sends a request for requesting a live video, where the request includes a unique identifier of the client and a resolution of the client, and a receiving module of the server receives the request information.
Step 402, the receiving module determines whether a control service and a streaming media service corresponding to the unique identifier exist based on the unique identifier, if yes, the access address of the control service and the access address of the streaming media service are returned to the client, if not, information for creating the control service corresponding to the unique identifier of the client is sent to the control service module, and information for creating the streaming media service corresponding to the unique identifier of the client is sent to the streaming media module.
Step 403, the control service module creates a control service corresponding to the unique identifier, and the streaming media service module creates a streaming media service corresponding to the unique identifier;
step 404, after the control service module successfully creates the control service, the access address of the control service is returned, after the streaming media service module successfully creates the media service, the access address of the streaming media service is returned, and the server returns the access address of the control service and the access address of the streaming media service to the client;
405, the client receives the regional coordinate information of the live video sent by the client through the regional coordinate information of the live video sent by the access address, the control service module obtains the live video data based on the regional coordinate information, and the obtained live video data is released to the streaming media service module;
step 406, the streaming media service module converts the live video data and then issues the converted live video data through the access address of the streaming media service corresponding to the client;
in step 407, the client views the requested live video by accessing the access address.
Step 408, the client sends an exit request, when the receiving module receives the exit request, the control service module closes the control service corresponding to the unique identifier of the client, and the streaming media service module closes the streaming media service corresponding to the unique identifier of the client;
step 409, after the control service module successfully closes the control service and the streaming media service module successfully closes the streaming media service, the server notifies the client that the quit is successful.
An embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the storage medium, and when the computer program is executed by a processor, the computer program implements the steps of the method.
The embodiment of the present invention further provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and capable of running on the processor, and when the processor executes the computer program, the steps of the method are implemented.
FIG. 5 is a block diagram illustrating a computer device 500 in accordance with an exemplary embodiment. For example, the computer device 500 may be provided as a server. Referring to fig. 5, the computer device 500 includes a processor 501, and the number of the processors may be set to one or more as necessary. The computer device 500 also includes a memory 502 for storing instructions, such as application programs, that are executable by the processor 501. The number of the memories can be set to be one or more according to needs, and the number of the applications stored in the memories can be one or more. The processor 501 is configured to execute instructions to perform the above-described method.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, apparatus (device), or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media having computer-usable program code embodied in the medium. Computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data, including, but not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, Digital Versatile Disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can be accessed by the computer, and the like. In addition, communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media as known to those skilled in the art.
The present invention has been described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (devices) and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that an article or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such article or apparatus. Without further limitation, an element defined by the phrase "comprising … …" does not exclude the presence of additional like elements in the article or device comprising the element.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, it is intended that the present invention cover the modifications and variations of this invention provided they come within the scope of the appended claims and their equivalents.