Unmanned aerial vehicle-based live video streaming method and system, device, and storage medium
Disclosed in embodiments of the present disclosure are an unmanned aerial vehicle-based live video streaming method and system, a device, and a storage medium. The method includes: acquiring original video stream data sent by an unmanned aerial vehicle; encoding/decoding the original video stream data to obtain output buffer data; converting the output buffer data into video frames supported by the WebRtc protocol; and sending the video frames to a preset server through a WebRtc transmission channel, so that the preset server performs live streaming display according to the video frames.
1 . An unmanned aerial vehicle-based live video streaming method, comprising:
measuring a network signal strength of a network over which a terminal is currently communicating with a preset server;
determining a video stream bit rate according to the network signal strength on the basis of a second rule, the second rule being a rule for increasing or decreasing the video stream bit rate according to the increase or decrease of the network signal strength;
sending the video stream bit rate to an unmanned aerial vehicle, the video stream bit rate representing an image clarity during image transmission between the unmanned aerial vehicle and the terminal;
the terminal acquiring original video stream data sent by the unmanned aerial vehicle at the video stream bit rate;
the terminal encoding/decoding the original video stream data to obtain output buffer data;
the terminal converting the output buffer data into video frames supported by the WebRtc protocol; and
the terminal sending the video frames to the preset server through a WebRtc transmission channel, so that the preset server performs live streaming display according to the video frames.
2 . The unmanned aerial vehicle-based live video streaming method according to claim 1 , wherein the original video stream data comprises H264 data, and the terminal encoding/decoding the original video stream data to obtain output buffer data comprises:
writing the H264 data into a codec input buffer and submitting the H264 data to a codec; and
encoding/decoding, by the codec, the H264 data to generate ByteBuffer video stream data and write the ByteBuffer video stream data into a codec output buffer.
3 . The unmanned aerial vehicle-based live video streaming method according to claim 2 , wherein the terminal converting the output buffer data into video frames supported by the WebRtc protocol comprises:
reading the ByteBuffer video stream data from the codec output buffer; and
performing decoding and data conversion on the basis of the ByteBuffer video stream data to obtain VideoFrame data.
4 . The unmanned aerial vehicle-based live video streaming method according to claim 1 , wherein before the terminal sending the video frames to the preset server through the WebRtc transmission channel, the method further comprises:
determining a current resolution according to the network signal strength on the basis of a first rule; and
adjusting a video stream resolution of the video frames according to the current resolution.
5 . The unmanned aerial vehicle-based live video streaming method according to claim 4 , wherein the determining the current resolution according to the network signal strength on the basis of the first rule comprises:
determining whether the network signal strength is greater than or equal to a first signal strength;
when the network signal strength is greater than or equal to the first signal strength, determining that the current resolution is 1920×1080p; and
when the network signal strength is less than the first signal strength, determining that the current resolution is 1080×720p.
6 . The unmanned aerial vehicle-based live video streaming method according to claim 1 , wherein the WebRtc transmission channel comprises a RTCPeerConnection channel.
7 . The unmanned aerial vehicle-based live video streaming method according to claim 1 , wherein the WebRtc transmission channel comprises a RTCDataChannel channel.
8 . An unmanned aerial vehicle-based live video streaming system, comprising:
a network measurement module, configured to measure a network signal strength of a network over which a terminal is currently communicating with a preset server;
a bit rate determination module, configured to determine a video stream bit rate according to the network signal strength on the basis of a second rule, the second rule being a rule for increasing or decreasing the video stream bit rate according to the increase or decrease of the network signal strength; and
a bit rate adjustment module, configured to send the video stream bit rate to an unmanned aerial vehicle, the video stream bit rate representing an image clarity during image transmission between the unmanned aerial vehicle and the terminal;
a data receiving module, configured to acquire original video stream data sent by the unmanned aerial vehicle at the video stream bit rate;
an encoding/decoding module, configured to encode/decode the original video stream data to obtain output buffer data;
a data conversion module, configured to convert the output buffer data into video frames supported by the WebRtc protocol; and
a WebRtc transmission module, configured to send the video frames to the preset server through a WebRtc transmission channel, so that the preset server performs live streaming display according to the video frames.
9 . The unmanned aerial vehicle-based live video streaming system according to claim 8 , wherein the original video stream data comprises H264 data, and the encoding/decoding module further configure to:
write the H264 data into a codec input buffer and submit the H264 data to a codec; and
encode/decode, by the codec, the H264 data to generate ByteBuffer video stream data and write the ByteBuffer video stream data into a codec output buffer.
10 . The unmanned aerial vehicle-based live video streaming system according to claim 9 , wherein the data conversion module further configure to:
read the ByteBuffer video stream data from the codec output buffer; and
perform decoding and data conversion on the basis of the ByteBuffer video stream data to obtain VideoFrame data.
11 . The unmanned aerial vehicle-based live video streaming system according to claim 8 , comprising:
a resolution determination module, configured to determine a current resolution according to the network signal strength on the basis of a first rule; and
a video frame adjustment module, configured to adjust a video stream resolution of the video frames according to the current resolution.
12 . The unmanned aerial vehicle-based live video streaming system according to claim 11 , the resolution determination module further configure to:
determine whether the network signal strength is greater than or equal to a first signal strength;
when the network signal strength is greater than or equal to the first signal strength, determine that the current resolution is 1920×1080p; and
when the network signal strength is less than the first signal strength, determine that the current resolution is 1080×720p.
13 . An electronic device, comprising a memory and a processor, wherein the memory stores a computer program, when executed by the processor, cause the processor to perform an unmanned aerial vehicle-based live video streaming method, comprising:
measuring a network signal strength of a network over which a terminal is currently communicating with a preset server;
determining a video stream bit rate according to the network signal strength on the basis of a second rule, the second rule being a rule for increasing or decreasing the video stream bit rate according to the increase or decrease of the network signal strength;
sending the video stream bit rate to an unmanned aerial vehicle, the video stream bit rate representing an image clarity during image transmission between the unmanned aerial vehicle and the terminal;
acquiring original video stream data sent by the unmanned aerial vehicle;
encoding/decoding the original video stream data to obtain output buffer data;
converting the output buffer data into video frames supported by the WebRtc protocol; and
sending the video frames to the preset server through a WebRtc transmission channel, so that the preset server performs live streaming display according to the video frames.
14 . The electronic device according to claim 13 , wherein the original video stream data comprises H264 data, and the encoding/decoding the original video stream data to obtain output buffer data comprises:
writing the H264 data into a codec input buffer and submitting the H264 data to a codec; and
encoding/decoding, by the codec, the H264 data to generate ByteBuffer video stream data and write the ByteBuffer video stream data into a codec output buffer.
15 . The electronic device according to claim 14 , wherein the converting the output buffer data into video frames supported by the WebRtc protocol comprises:
reading the ByteBuffer video stream data from the codec output buffer; and
performing decoding and data conversion on the basis of the ByteBuffer video stream data to obtain VideoFrame data.
16 . The electronic device according to claim 13 , wherein before the sending the video frames to the preset server through the WebRtc transmission channel, the method further comprises:
determining a current resolution according to the network signal strength on the basis of a first rule; and
adjusting a video stream resolution of the video frames according to the current resolution.
17 . The electronic device according to claim 16 , wherein the determining the current resolution according to the network signal strength on the basis of the first rule comprises:
determining whether the network signal strength is greater than or equal to a first signal strength;
when the network signal strength is greater than or equal to the first signal strength, determining that the current resolution is 1920×1080p; and
when the network signal strength is less than the first signal strength, determining that the current resolution is 1080×720p.
18 . The unmanned aerial vehicle-based live video streaming method according to claim 1 , wherein the original video stream data is first transmitted by the unmanned aerial vehicle to a remote control device, and then transmitted by the remote control device to the terminal.
19 . The unmanned aerial vehicle-based live video streaming system according to claim 8 , wherein the original video stream data is first transmitted by the unmanned aerial vehicle to a remote control device, and then transmitted by the remote control device to the terminal.
20 . The electronic device according to claim 13 , wherein the original video stream data is first transmitted by the unmanned aerial vehicle to a remote control device, and then transmitted by the remote control device to the terminal.