CN114531606B - Method, system and equipment for generating packaged video data to be transmitted and transmitting video - Google Patents

Method, system and equipment for generating packaged video data to be transmitted and transmitting video Download PDF

Info

Publication number
CN114531606B
CN114531606B CN202210162563.5A CN202210162563A CN114531606B CN 114531606 B CN114531606 B CN 114531606B CN 202210162563 A CN202210162563 A CN 202210162563A CN 114531606 B CN114531606 B CN 114531606B
Authority
CN
China
Prior art keywords
stream
transmitted
request information
video
video data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210162563.5A
Other languages
Chinese (zh)
Other versions
CN114531606A (en
Inventor
惠国宾
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chongqing Unisinsight Technology Co Ltd
Original Assignee
Chongqing Unisinsight Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chongqing Unisinsight Technology Co Ltd filed Critical Chongqing Unisinsight Technology Co Ltd
Priority to CN202210162563.5A priority Critical patent/CN114531606B/en
Publication of CN114531606A publication Critical patent/CN114531606A/en
Application granted granted Critical
Publication of CN114531606B publication Critical patent/CN114531606B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/234Processing of video elementary streams, e.g. splicing of video streams, manipulating MPEG-4 scene graphs
    • H04N21/2343Processing of video elementary streams, e.g. splicing of video streams, manipulating MPEG-4 scene graphs involving reformatting operations of video signals for distribution or compliance with end-user requests or end-user device requirements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • H04L69/164Adaptation or special uses of UDP protocol
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs
    • H04N21/4402Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs involving reformatting operations of video signals for household redistribution, storage or real-time display
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/60Network structure or processes for video distribution between server and client or between remote clients; Control signalling between clients, server and network components; Transmission of management data between server and client, e.g. sending from server to client commands for recording incoming content stream; Communication details between server and client 
    • H04N21/63Control signaling related to video distribution between client, server and network components; Network processes for video distribution between server and clients or between remote clients, e.g. transmitting basic layer and enhancement layers over different transmission paths, setting up a peer-to-peer communication via Internet between remote STB's; Communication protocols; Addressing
    • H04N21/643Communication protocols
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/60Network structure or processes for video distribution between server and client or between remote clients; Control signalling between clients, server and network components; Transmission of management data between server and client, e.g. sending from server to client commands for recording incoming content stream; Communication details between server and client 
    • H04N21/63Control signaling related to video distribution between client, server and network components; Network processes for video distribution between server and clients or between remote clients, e.g. transmitting basic layer and enhancement layers over different transmission paths, setting up a peer-to-peer communication via Internet between remote STB's; Communication protocols; Addressing
    • H04N21/647Control signaling between network components and server or clients; Network processes for video distribution between server and clients, e.g. controlling the quality of the video stream, by dropping packets, protecting content from unauthorised alteration within the network, monitoring of network load, bridging between two different networks, e.g. between IP and wireless
    • H04N21/64784Data processing by the network

Abstract

The invention provides a method, a system and equipment for generating and transmitting encapsulated video data to be transmitted.

Description

Method, system and equipment for generating packaged video data to be transmitted and transmitting video
Technical Field
The invention relates to the technical field of video transmission, in particular to a method, a system and equipment for generating packaged video data to be transmitted and transmitting video.
Background
The UDP (User Datagram Protocol) User Datagram Protocol belongs to a transmission layer in a TCP/IP (transmission control Protocol/Internet Protocol) family, is a Protocol which is used more in real-time video transmission, is connectionless, and can better ensure the real-time performance of a video compared with another Protocol TCP (connection) of the transmission layer because of no complex control process.
Currently, the most used UDP video transmission Protocol is RTSP (Real Time Streaming Protocol, application layer Protocol in TCP/IP Protocol, a multimedia information transmission Protocol)/UDP Protocol, which is a standard media transmission Protocol, and firstly negotiates the UDP port number of transmission through RTSP Protocol interactive signaling, and then transmits video stream through the UDP port. However, the RTSP/UDP protocol is used, so that the occupation of ports is more and the occupation of system resources is large.
Disclosure of Invention
In view of the above drawbacks of the prior art, the present invention provides a method, system and device for generating encapsulated video data to be transmitted, and transmitting video data, so as to solve the above technical problems.
In a first aspect, the present invention provides a method for generating encapsulated video data to be transmitted, where the method includes:
acquiring a video stream to be transmitted and stream taking request information, and generating a request information identifier of the stream taking request information, wherein the stream taking request information comprises a request address;
and generating and packaging video data to be transmitted according to the request information identifier, the video stream to be transmitted and the request address.
Optionally, the encapsulated to-be-transmitted video data includes a custom media frame and/or a user datagram protocol, where the custom media frame includes at least a part of frame data generated according to the to-be-transmitted video stream and at least one of the following:
frame type, encoding type, frame length, and timestamp.
Optionally, the encapsulated to-be-transmitted video data includes a custom encapsulation format header, where the custom encapsulation format header includes at least one of:
head mark, tail mark, packet sequence number, request information mark and reserved blank byte.
Optionally, if the encapsulated to-be-transmitted video data includes a custom encapsulated format header and a custom media frame, where the custom encapsulated format header includes a header flag, a trailer flag, and a packet sequence number, and the total data size of frame data generated according to the to-be-transmitted video stream is greater than a preset size threshold, the method further includes:
dividing the frame data into at least two sub-frame data according to the total size of the data;
and respectively packaging the sub-frame data into sub-packaged video data to be transmitted according to the original sequence of the sub-frame data in the frame data, wherein the packaged video data to be transmitted comprises the sub-packaged video data to be transmitted, the package sequence of the packet sequence number in the sub-packaged video data to be transmitted is the same as the original sequence, the head mark in the sub-packaged video data to be transmitted with the earliest package sequence is characterized as the head, and the tail mark in the sub-packaged video data to be transmitted with the latest package sequence is characterized as the tail.
In a second aspect, the present invention further provides a method for transmitting a video with multiplexed ports, where the method includes:
acquiring at least two pieces of flow acquisition request information, and generating a request information identifier of each piece of flow acquisition request information, wherein the flow acquisition request information comprises request flow source information and ports, and the ports of the at least two pieces of flow acquisition request information are the same;
determining at least one video stream to be transmitted corresponding to the stream taking request information according to the request stream source information of each stream taking request information;
packaging the video stream to be transmitted and a request information identifier of a stream taking request information corresponding to the video stream to be transmitted to obtain packaged video data to be transmitted corresponding to the stream taking request information;
and respectively transmitting the packaged video data to be transmitted through a matching port, wherein the matching port is a port of the streaming request information corresponding to the packaged video data to be transmitted.
Optionally, the stream fetching request information further includes a sending address, and the generation manner of the encapsulated to-be-transmitted video data includes the generation method of the encapsulated to-be-transmitted video data according to the first aspect.
Optionally, the request stream source information includes request channel information and request code stream information, the initial stream source information includes initial channel information and initial code stream information, and the determination method of the video stream to be transmitted includes:
acquiring a frame of video frame and initial channel information and initial code stream information of the video frame;
and if the initial stream source information of the video frame is the same as the request stream source information of at least one stream taking request information, determining the video frame as the video stream to be transmitted corresponding to the stream taking request information.
Optionally, the method further includes:
generating an initial stream source information-request information identifier mapping relation according to the request stream source information, the request information identifiers and the initial stream source information of the equipment providing the video stream to be transmitted;
generating a port information-request information identifier mapping relation according to each request information identifier and each port information;
determining at least one to-be-transmitted video stream corresponding to the stream taking request information according to the request stream source information of each piece of stream taking request information respectively comprises determining at least one to-be-transmitted video stream corresponding to the stream taking request information from each video frame according to an initial stream source information-request information identifier mapping relationship, a port information-request information identifier mapping relationship and initial stream source information of at least one video frame.
Optionally, the stream fetching request information further includes a sending address, and the method further includes:
and generating a sending address-request information identifier mapping relation according to each request information identifier and each sending address, and transmitting the obtained packaged video data to be transmitted to the corresponding sending address through the matching port according to the sending address-request information identifier mapping relation.
Optionally, before obtaining at least two pieces of stream fetching request information, the method further includes:
the method comprises the steps that a server side obtains a connection request sent by a client side, and connection between the server side and the client side is established;
and the server side acquires the login request sent by the client side and feeds a login success message back to the client side.
In a third aspect, the present invention further provides a video transmission method for port multiplexing, where the method includes:
sending at least two pieces of flow fetching request information, wherein the flow fetching request information comprises request flow source information and a port;
acquiring request information identification of each streaming request information;
monitoring the port to receive the packaged video data to be transmitted, and respectively assembling the packaged video data to be transmitted corresponding to each request information identifier into a complete video frame, wherein the generation mode of the packaged video data to be transmitted comprises the generation method of the packaged video data to be transmitted according to the first aspect.
Optionally, if the generation manner of the packaged video data to be transmitted includes the generation method of the packaged video data to be transmitted according to the optional manner in the fourth aspect of the first aspect, that is, if the packaged video data to be transmitted includes a plurality of sub-packaged video data to be transmitted, the assembling the packaged video data to be transmitted corresponding to each request information identifier into a complete video frame respectively includes:
establishing a mapping relation between the stream taking request information and the request information identifier according to the request information identifier and the stream taking request information;
matching corresponding stream taking request information according to the request information identification of the packaged video data to be transmitted;
and assembling the sub-frame data into a complete video frame according to the packet sequence of the packet sequence number in the sub-package video data to be transmitted corresponding to the stream taking request information.
In a fourth aspect, the present invention further provides a generating system for encapsulating video data to be transmitted, where the system includes:
the device comprises a first acquisition module, a second acquisition module and a processing module, wherein the first acquisition module is used for acquiring a video stream to be transmitted and stream taking request information and generating a request information identifier of the stream taking request information, and the stream taking request information comprises a request address;
and the generating module is used for generating and packaging the video data to be transmitted according to the request information identifier, the video stream to be transmitted and the request address.
In a fifth aspect, the present invention further provides a video transmission system with port multiplexing, where the system includes:
a second obtaining module, configured to obtain at least two pieces of flow fetching request information, and generate a request information identifier of each piece of flow fetching request information, where the flow fetching request information includes request flow source information and a port, and the ports of the at least two pieces of flow fetching request information are the same;
a determining module, configured to determine, according to request stream source information of each piece of stream fetching request information, at least one to-be-transmitted video stream corresponding to the stream fetching request information;
the encapsulation module is used for encapsulating the video stream to be transmitted and a request information identifier of a stream taking request information corresponding to the video stream to be transmitted to obtain encapsulated video data to be transmitted corresponding to the stream taking request information;
and the transmission module is used for respectively transmitting the packaged video data to be transmitted through a matching port, wherein the matching port is a port of the streaming request information corresponding to the packaged video data to be transmitted.
In a sixth aspect, the present invention further provides a video transmission system with port multiplexing, where the system includes:
a sending module, configured to send at least two pieces of stream fetching request information, where the stream fetching request information includes request stream source information and a port;
a third obtaining module, configured to obtain a request information identifier of each piece of stream fetching request information;
the monitoring module is configured to monitor the port to receive the packaged to-be-transmitted video data, and assemble the packaged to-be-transmitted video data corresponding to each request information identifier into a complete video frame, where a generation manner of the packaged to-be-transmitted video data includes any one of the generation methods of the packaged to-be-transmitted video data according to the first aspect.
In a seventh aspect, the present invention further provides an electronic device, comprising a processor, a memory, and a communication bus;
the communication bus is used for connecting the processor and the memory;
the processor is configured to execute the computer program stored in the memory to implement the method according to any one of the embodiments described above.
In an eighth aspect, the present invention also provides a computer-readable storage medium having stored thereon a computer program,
the computer program is for causing a computer to perform a method as in any one of the embodiments described above.
The invention has the beneficial effects that: according to the method for generating the packaged video data to be transmitted, the request information identifier is packaged in the packaged video data to be transmitted, multiplexing of media data sending and receiving ports can be achieved, and system resources are saved.
Drawings
Fig. 1 is a schematic flow chart of a generating method for encapsulating video data to be transmitted according to an embodiment of the present invention;
fig. 2 is a schematic diagram of a related art video transmission method according to an embodiment of the present invention;
fig. 3 is a schematic diagram of a video transmission method using the method provided in the present invention in an embodiment of the present invention;
FIG. 4 is a diagram illustrating a custom media frame format provided in an embodiment of the present invention;
fig. 5 is a schematic diagram of a custom UDP encapsulation format header provided in an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a video encapsulation protocol layer for encapsulating video data to be transmitted according to an embodiment of the present invention;
fig. 7 is a flowchart illustrating a video transmission method of port multiplexing according to an embodiment of the present invention;
fig. 8 is a schematic flow chart of a video transmission method of port multiplexing according to an embodiment of the present invention;
fig. 9 is a flowchart illustrating a video stream request signaling interaction manner according to an embodiment of the present invention;
fig. 10 is a schematic diagram of a mapping of stream source stream IDs provided in an embodiment of the invention;
FIG. 11 is a schematic diagram of a flow ID transmit address mapping representation provided in an embodiment of the present invention;
fig. 12 is a schematic flow chart of video stream data interaction provided in an embodiment of the present invention;
fig. 13 is a diagram of a request stream ID mapping table provided in an embodiment of the present invention;
fig. 14 is a schematic structural diagram of a generating system for encapsulating video data to be transmitted according to an embodiment of the present invention;
fig. 15 is a schematic structural diagram of a port-multiplexed video transmission system according to an embodiment of the present invention;
fig. 16 is a schematic structural diagram of a video transmission system with port multiplexing according to an embodiment of the present invention;
fig. 17 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The embodiments of the present invention are described below with reference to specific embodiments, and other advantages and effects of the present invention will be easily understood by those skilled in the art from the disclosure of the present specification. The invention is capable of other and different embodiments and of being practiced or of being carried out in various ways, and its several details are capable of modification in various respects, all without departing from the spirit and scope of the present invention. It should be noted that the features in the following embodiments and examples may be combined with each other without conflict.
It should be noted that the drawings provided in the following embodiments are only for illustrating the basic idea of the present invention, and the drawings only show the components related to the present invention rather than being drawn according to the number, shape and size of the components in actual implementation, and the type, amount and proportion of each component in actual implementation can be changed freely, and the layout of the components can be more complicated.
In the following description, numerous details are set forth to provide a more thorough explanation of embodiments of the present invention, however, it will be apparent to one skilled in the art that embodiments of the present invention may be practiced without these specific details, and in other embodiments, well-known structures and devices are shown in block diagram form, rather than in detail, in order to avoid obscuring embodiments of the present invention.
Referring to fig. 1, the present embodiment provides a generating method for encapsulating video data to be transmitted, where the method includes:
step S101: and acquiring the video stream to be transmitted and the stream taking request information, and generating a request information identifier of the stream taking request information. Wherein, the stream fetching request information comprises a request address.
Step S102: and generating and packaging video data to be transmitted according to the request information identifier, the video stream to be transmitted and the request address.
Optionally, the request information identifier is a globally unique identifier of the streaming request information on the server device. The video stream requested by the streaming request information may be a real-time video stream or the like.
The request information identifier is packaged in the video data to be transmitted, so that multiplexing of media data transmitting and receiving ports can be realized, and system resources are saved. After the port receives the packaged video data to be transmitted, the port can know a sending address corresponding to the request information identifier through reading the request information identifier in the packaged video data to be transmitted and through a preset sending address-request information identifier mapping relation, and correspondingly sends the packaged video data to be transmitted to the corresponding sending address. In the related art, as shown in fig. 2, each video stream (video streams 1, 2, 3, 4 shown in fig. 2) transmitted by the server is distributed through a corresponding port (ports 1111, 2222, 3333, 4444 shown in fig. 2) to satisfy a streaming request (requests 1, 2, 3, 4). Video transmission ports cannot be multiplexed, at least one port needs to be added for sending and receiving each video stream, and a large amount of system resources are occupied in equipment with a large number of video stream requests. Referring to fig. 3, in the generation method for encapsulating video data to be transmitted provided by this embodiment, each video stream (video streams 1, 2, 3, and 4 shown in fig. 3) sent by the server is distributed through one same port (port 1111 shown in fig. 3), and the request information identifier sealed and stored in the video data to be transmitted and the preset mapping relationship between the sending address and the request information identifier (the port ID mapping table shown in fig. 3) are distributed to the corresponding sending address to satisfy each stream fetching request (requests 1, 2, 3, and 4), so that different video streams and different stream fetching requests can be distributed through the same port, the number of ports is saved, the multiplexing of the ports is realized, and the occupation of system resources is saved. As can be obtained by comparing fig. 2 and fig. 3, for example, when 4 paths of video streams are transmitted, 4 ports are required by the data generation method in the related art, and the method provided by this embodiment can implement port multiplexing, and only one port is required to complete distribution of the 4 paths of video streams.
Optionally, the encapsulated video data to be transmitted includes a custom media frame and/or a user datagram protocol, where the custom media frame includes at least a part of frame data generated according to the video stream to be transmitted and at least one of the following:
frame type, encoding type, frame length, and timestamp.
The user datagram protocol may be a UDP protocol layer of a TCP/IP protocol stack, or the like.
Wherein, the frame type is used to distinguish whether it is a key frame (I frame) or a differential frame (P frame), and the coding type is used to identify which coding, such as H264 or H265; the timestamp is used to identify the temporal location of the current frame of the video stream to be transmitted. That is, the frame type includes a key frame or a differential frame, the encoding type includes an encoding manner of a video frame, and the frame length is a length (size) of at least a part of frame data included therein. By customizing the media frame format, the video coding information is packaged into the media frame (packaging the video data to be transmitted), so that the sdp information interaction of rtsp in the related technology of the video data to be transmitted in the video transmission process can be omitted.
In an optional implementation manner, referring to fig. 4, fig. 4 is a schematic diagram of a custom media frame format, where a frame type may be 2 bytes, an encoding type may be 2 bytes, a frame length may be 4 bytes, a timestamp is 8 bytes, a length of frame data is not fixed, and a threshold of a custom size may also be set. Compared with 12 bytes of RTP head, the custom head only has 8 bytes, which reduces data transmission quantity and saves bandwidth.
Optionally, the encapsulation of the video data to be transmitted includes a custom encapsulation format header, where the custom encapsulation format header includes at least one of the following:
head mark, tail mark, packet sequence number, request information mark and reserved blank byte.
The method includes the steps that whether packaged to-be-transmitted video data after one frame is fragmented is a head part, a middle part or a tail part can be identified through a head mark and a tail mark, a packet sequence number is used for processing the problem of disorder in UDP transmission, if the situation of sub-packaging exists, namely when the packaged to-be-transmitted video data comprises a plurality of sub-packaged to-be-transmitted video data, the transmission sequence of the sub-packaged to-be-transmitted video data is transmitted according to the packet sequence of the packet sequence number, and a request information identifier is used for realizing port multiplexing.
Referring to fig. 5, fig. 5 is a schematic diagram of a format of a header of a custom UDP encapsulation format, as shown in the diagram, a header flag H reserves 1 byte, a tail flag T reserves 1 byte, a reserved blank byte (reserved in the drawing) is 14 bytes, a packet sequence number is 2 bytes, and a request information identifier (stream ID in the drawing) is 4 bytes.
Referring to fig. 6, fig. 6 is a schematic diagram of a video encapsulation protocol layer for encapsulating video data to be transmitted, as shown in fig. 6, a custom encapsulation format header (custom UDP encapsulation format header in the figure) is a fixed 8-byte header on a user datagram protocol (UDP layer of a TCP/IP protocol stack, UDP in the figure), and carries a custom media frame (custom video frame in the figure) with a fixed 16-byte front, and a complete encoded video frame with an indefinite length (typically, P frame 20-80kb, i frame 100-300 kB).
Optionally, if the encapsulated to-be-transmitted video data includes a custom encapsulated format header and a custom media frame, the custom encapsulated format header includes a header flag, a trailer flag, and a packet sequence number, and the total data size of the frame data generated according to the to-be-transmitted video stream is greater than a preset size threshold, the method further includes:
dividing the frame data into at least two sub-frame data according to the total size of the data;
and respectively packaging the sub-frame data into sub-package video data to be transmitted according to the original sequence of the sub-frame data in frame data, wherein the packaged video data to be transmitted comprises the sub-package video data to be transmitted, the package sequence of the packet sequence number in the sub-package video data to be transmitted is the same as the original sequence, the head mark in the sub-package video data to be transmitted with the earliest package sequence is characterized as the head, and the tail mark in the sub-package video data to be transmitted with the latest package sequence is characterized as the tail.
In other words, the video stream to be transmitted may include one or more video frames, and after the video stream to be transmitted is encoded, the data length of the obtained frame data is long, which is not favorable for data transmission, and there may be problems of packet loss and the like, so that it needs to be packetized. Optionally, when the video stream to be transmitted is encapsulated to obtain encapsulated video data to be transmitted, the encapsulation may be performed according to each frame. When the frame data size of a frame encoded by itself is large (long), the frame is packetized. For example, a frame of video frame is split into several MTUs, and in order to reduce packet loss in network transmission, data sent through a UDP protocol is generally split into transmission packets with sizes smaller than 1 MTU, and then each split video frame is written into a custom media frame.
The following takes the encapsulation of a frame of video frame in a video stream to be transmitted as an example, and an exemplary description is given through a specific embodiment of the method for dividing the frame of video data and obtaining sub-encapsulated video data to be transmitted,
a frame of video frame M is set as an H264 encoded I frame, the size of the I frame is 4kB, and the code stream is first encapsulated into a custom media frame, where the video frame M is data requested by the stream fetching request information N, and the request information identifier (here, referred to as a stream ID) 3156 of the stream fetching request information N.
Frame type 1 (I-frame) encoding type 1 (H264) frame length 4096, time stamp: 163578638, followed by H264 frame data.
At this time, the total length of the custom media frame is 4096+16 bytes of media frame header +8 bytes of UDP encapsulation header =4120 bytes, which is larger than 1 MTU, and at this time, the custom media frame needs to be packetized and divided into 4 packets, and at this time, the custom encapsulation format header needs to be filled:
bag 1: the head flag H is 1, the tail flag T is 0, the packet sequence number is 0, and the stream ID is 3156;
bag 2: the head flag H is 0, the tail flag T is 0, the packet sequence number is 1, and the stream ID is 3156;
bag 3: the head flag H is 0, the tail flag T is 0, the packet sequence number is 2, and the stream ID is 3156;
bag 4: the head flag H is 0, the tail flag T is 1, the packet number is 3, and the stream ID is 3156;
subsequently, the sending address corresponding to the request identification information 3156 is 192.168.1.2 by querying the sending address-request identification information mapping table: 12345, sending the 4 packets to the address in the order of packet sequence number.
It should be noted that the above identification manner regarding the header flag, the trailer flag, the packet sequence number, and the stream ID is only an example, and a person skilled in the art may set the rule according to the requirement.
According to the generation method for packaging the video data to be transmitted, provided by the embodiment, the request information identifier is packaged in the video data to be transmitted, so that multiplexing of media data sending and receiving ports can be realized, and system resources are saved. For example, after the port receives the packaged to-be-transmitted video data, the port can read the request information identifier in the packaged to-be-transmitted video data, further know the sending address corresponding to the request information identifier through a preset sending address-request information identifier mapping relation, and correspondingly send the packaged to-be-transmitted video data to the corresponding sending address, so that different video streams and different stream taking requests can be distributed through the same port, the number of ports is saved, the multiplexing of the ports is realized, and the occupation of system resources is saved.
The present embodiment further provides a method for transmitting a video by port multiplexing, referring to fig. 7, the method includes:
step S701: and acquiring at least two pieces of stream taking request information, and generating request information identification of each stream taking request information. The stream fetching request information comprises request stream source information and ports, and the ports of at least two stream fetching request information are the same.
Step S702: and determining at least one video stream to be transmitted corresponding to the stream taking request information according to the request stream source information of each stream taking request information.
Step S703: and encapsulating the video stream to be transmitted and the request information identifier of stream taking request information corresponding to the video stream to be transmitted to obtain encapsulated video data to be transmitted corresponding to the stream taking request information.
Step S704: and respectively transmitting the packaged video data to be transmitted through the matched ports. The matching port is a port for packaging a stream taking request message corresponding to the video data to be transmitted.
The port multiplexing video transmission method provided in this embodiment may be applied to a server, and before step S701, the method further includes that the server establishes a TCP connection with a client, the streaming request information may be sent by the same client, or sent by different clients, and one client may send one or more streaming request information. The manner of generating the request information identifier of the stream fetching request information according to the obtained stream fetching request information may be a manner known by those skilled in the art, and is not limited herein. It should be noted that, for a stream fetching request message, the corresponding request message identifier is globally unique at the server. The client may be understood as a user requesting a stream source, the server may be understood as a device providing the stream source, and the device providing the stream source may be one or more shooting devices, such as a camera. Each shooting device such as a camera can also allocate a digital number, namely a channel number, to the camera from video streams with different resolutions, and the video stream with different resolutions of each camera is called a code stream number, for example, if there are 2 cameras, each camera has 3 paths of video streams with different resolutions, and the total number of the video streams is 6. And taking a certain code stream of a certain video channel as a stream source. In this case, one stream source may correspond to a plurality of request information identifications, and one request information identification may correspond to only one stream source.
Optionally, the request stream source information includes request channel information and request code stream information, the initial stream source information includes initial channel information and initial code stream information, and the determination method of the video stream to be transmitted includes:
acquiring a frame of video frame and initial channel information and initial code stream information of the video frame;
and if the initial stream source information of the video frame is the same as the request stream source information of the at least one stream taking request information, determining the video frame as the video stream to be transmitted corresponding to the stream taking request information.
In an embodiment, the server may traverse all the devices thereof or adopt other manners to obtain a stream source (obtain a video stream of a resolution ratio of a camera and other shooting devices, that is, obtain a video stream of a certain code stream of a certain channel), and obtain a frame of video frame, according to initial channel information and initial code stream information from which the video frame comes, may know initial stream source information of the video frame, and then compare the initial stream source information with the obtained request stream source information, if the initial stream source information and the obtained request stream source information are the same, it is determined that the video frame is a video frame required by a stream taking request corresponding to the stream taking request information, and then the video frame is taken as a to-be-transmitted video stream corresponding to the stream taking request information. Optionally, subsequently, other video frames from the same stream source as the video frame may also be used as the to-be-transmitted video stream corresponding to the stream fetching request information.
In one embodiment, the method further comprises:
generating an initial stream source information-request information identifier mapping relation according to the request stream source information, the request information identifiers and the initial stream source information of the equipment providing the video stream to be transmitted;
generating a port information-request information identifier mapping relation according to each request information identifier and each port information;
determining at least one video stream to be transmitted corresponding to the stream taking request information according to the request stream source information of each stream taking request information respectively comprises determining at least one video stream to be transmitted corresponding to the stream taking request information from each video frame according to the initial stream source information-request information identifier mapping relationship, the port information-request information identifier mapping relationship and the initial stream source information of at least one video frame.
In one embodiment, the streaming request information further includes a sending address, and the method further includes:
and generating a sending address-request information identifier mapping relation according to each request information identifier and each sending address, and transmitting the obtained packaged video data to be transmitted to the corresponding sending address through the matching port according to the sending address-request information identifier mapping relation.
Optionally, after acquiring the stream fetching request information, the server generates a request information identifier corresponding to the stream fetching request information, determines initial stream source information corresponding to the request stream source information in initial stream source information of each stream source in a device (server) providing a video stream to be transmitted according to the request stream source information, and generates an initial stream source information-request information identifier mapping relationship, which can be implemented in a manner of an initial stream source information-request information identifier mapping table. After the server side obtains the stream fetching request information, a request information identifier corresponding to the stream fetching request information is generated, a mapping relation between port information and the request information identifier is established according to the port information in the request stream source information, and the mapping relation can be realized in a mode of a mapping table between the port information and the request information identifier. After acquiring the stream fetching request information, the server generates a request information identifier corresponding to the stream fetching request information, and creates a mapping relation between a sending address and the request information identifier according to a sending address in the request stream source information, which can be implemented in a way of sending an address-request information identifier mapping table. It should be noted that any one of the three mapping relationships mentioned above may be created directly by the server, or may be created by a third party after obtaining the relevant information, and the created mapping relationship is fed back to the server.
For example, the request stream source information in the stream fetching request information is "channel 1 code stream 1", and the request information identifier of the stream fetching request information is "stream ID:1", initial stream source information of channel 1 stream 1 in the stream source of the server is" stream source 1", and at this time," stream source 1 "and" stream ID: 1' has a mapping relationship. That is, the video frames extracted from the "stream source 1" are "stream IDs" without other restrictions (such as other rights are required): 1' is corresponding to the video stream to be transmitted of the stream fetching request information. The request information identification of the stream fetching request information is "stream ID:1", port is" 1111", at this time" stream ID:1 "and" 1111 "have a mapping relationship. At this time, according to the above two mapping relationships, the "stream ID:1 "knows to transmit video frames acquired by stream source 1 through port 1111. The above method is exemplified by only one stream fetching request information and one stream source, and for the processing modes of multiple stream fetching request information and multiple stream sources, similar to the above mode, when the ports of multiple stream fetching request information are the same, multiplexing of the ports can be realized.
In an embodiment, the stream fetching request information further includes a sending address, and a generation manner of encapsulating the video data to be transmitted may adopt the generation method of encapsulating the video data to be transmitted according to any of the embodiments described above, and specific manners may refer to the above embodiments, which are not described herein again.
In one embodiment, before the step S701 acquires at least two pieces of stream fetching request information, the method further includes:
the server side obtains a connection request sent by the client side and establishes connection between the server side and the client side, wherein the connection can be TCP connection;
and the server side acquires the login request sent by the client side and feeds a login success message back to the client side.
In the video transmission method for port multiplexing provided by this embodiment, data transmission is performed by using the video data to be transmitted encapsulated with the request information identifier, so that multiplexing of media data transmitting and receiving ports can be realized, and system resources are saved. For example, after the port receives the packaged to-be-transmitted video data, the port can read the request information identifier in the packaged to-be-transmitted video data, further know the sending address corresponding to the request information identifier through a preset sending address-request information identifier mapping relation, and correspondingly send the packaged to-be-transmitted video data to the corresponding sending address, so that different video streams and different stream taking requests can be distributed through the same port, the number of ports is saved, the multiplexing of the ports is realized, and the occupation of system resources is saved. Meanwhile, in the data transmission process, the words need to exchange the signaling of login and request, and complex rtsp signaling interaction is not needed any more, particularly the interaction of sdp information of rtsp, so that the signaling interaction is less and more flexible.
Referring to fig. 8, the present embodiment further provides a video transmission method for port multiplexing, where the method includes:
step S801: and sending at least two pieces of stream fetching request information. The stream fetching request information comprises request stream source information and a port;
step S802: and acquiring the request information identifier of each stream fetching request information.
Step S803: and the monitoring port is used for receiving and packaging the video data to be transmitted and respectively assembling the video data to be transmitted and packaged corresponding to each request information identifier into a complete video frame. The method for generating the encapsulated video data to be transmitted includes the method for generating the encapsulated video data to be transmitted according to any of the embodiments, and specific modes can be referred to the embodiments, which are not described herein again.
Optionally, if the packaged video data to be transmitted includes a custom packaging format header and a custom media frame, the custom packaging format header includes a header flag, a trailer flag, and a packet number, and the total data size of frame data generated by the video stream to be transmitted is greater than a preset data threshold, the frame data is divided into at least two sub-frame data according to the total data size, each sub-frame data is packaged into sub-packaging video data to be transmitted according to an original sequence of each sub-frame data in the frame data, at this time, the packaged video data to be transmitted includes each sub-packaging video data to be transmitted, a packet sequence of the packet number in each sub-packaging video data to be transmitted is the same as the original sequence, the header flag in the sub-packaging video data to be transmitted at the top of the packet sequence is represented as a header, and the trailer flag in the sub-packaging video data to be transmitted at the bottom of the packet sequence is represented as a trailer, that is, the packaged video data to be transmitted includes a plurality of sub-packaging video data to be transmitted, and the packaged video data to be transmitted corresponding to be transmitted by each request information identifier is assembled into a complete video frame, including: :
creating a mapping relation between the stream taking request information and the request information identifier according to the request information identifier and the stream taking request information;
matching corresponding stream taking request information according to the request information identifier of the packaged video data to be transmitted;
and assembling the sub-frame data into a complete video frame according to the packet sequence of the packet sequence number in the sub-package video data to be transmitted corresponding to the stream taking request information.
In one embodiment, before the step S801 sends at least two pieces of stream fetching request information, the method further includes:
sending a connection request and receiving a connection success message fed back by a server;
and sending a login request and receiving a login success message fed back by the server.
In one embodiment, before assembling each sub-frame data into a complete video frame according to a packet sequence of a packet sequence number in each sub-packet to-be-transmitted video data corresponding to a streaming request message, the method further includes:
and acquiring a head mark and a tail mark in the video data to be transmitted of each sub-package so as to check the accuracy of the packet sequencing. If the head mark and the tail mark of the video data to be transmitted of a certain sub-package indicate that the video data to be transmitted of the sub-package is a middle package, but the package ordering is the first package (head package), the package ordering is not accurate, and at this time, it indicates that the video data to be transmitted of the sub-package which is not sent still exists or the video data to be transmitted of the sub-package is lost, a prompt that the ordering is incorrect can be sent.
According to the port multiplexing video transmission method provided by the embodiment, when the client sends the stream taking request information, the shared port is preset, the mapping corresponding relation between the request information identifier and the stream taking request information is formed according to the request information identifier issued by the server, and then after the fact that the corresponding port has the video data to be transmitted in a packaging mode and receives the video data to be transmitted in the packaging mode is monitored, the stream taking request information corresponding to the video data to be transmitted in the packaging mode can be known based on the request information identifier, and a complete video frame is generated according to the video data to be transmitted in the packaging mode.
Optionally, when the video stream to be transmitted is split into multiple sub-packages of video data to be transmitted for distribution, the sub-packages of the video data to be transmitted may be sequenced according to the package sequence numbers in the video data to be transmitted, and the sub-packages of the video data to be transmitted corresponding to the same streaming request information are combined to obtain a complete video frame.
Optionally, the video data to be transmitted may be further checked whether there are problems of packet loss, disorder and the like by using the header identifier, the tail identifier and the packet sequence number in each sub-package video data.
The first port multiplexing video transmission method is applied to a server, and the second port multiplexing video transmission method is applied to a client, and the following describes an implementation manner of the two port multiplexing video transmission methods by way of an example with a specific embodiment. Referring to fig. 8 and 9, the specific method includes:
step 1: the client and the server interact to request the video stream signaling, and the signaling interaction uses the TCP protocol, as shown in fig. 8, the video stream request signaling interaction mode specifically includes:
step 1.1: a TCP connection is established.
The client establishes TCP connection to the server, and the server feeds back that the connection is established successfully.
Step 1.2: and sending a login request.
The client sends a login request to the server, and the server feeds back login success.
Step 1.3: a real-time streaming request is sent.
The client sends a stream fetching request (stream fetching request information) to the server, and the server attaches a required channel number and a code stream number (request stream source information), and an IP address (sending address) and a UDP port number (port) which the server needs to send.
The real-time streaming request may be sent by one user or by multiple users.
The server side obtains the stream fetching request message to generate a request information identifier (stream ID), and feeds back the stream ID to the client side.
Step 1.4: and generating a mapping table of the stream ID and the stream source stream ID, wherein the stream ID sends an address mapping table.
The server generates a stream ID for the request, generates a stream source ID mapping table, each stream source corresponds to a plurality of IDs, each ID can only correspond to one stream source, each stream ID is globally unique on the server equipment, and returns the stream ID to the client; referring to fig. 10, fig. 10 is a schematic diagram of a stream source stream ID mapping table, referring to fig. 11, fig. 11 is a schematic diagram of a stream ID transmission address mapping table, where the stream ID transmission address mapping table further includes a mapping relationship between a port and a stream ID.
As shown in fig. 10 and 11, the stream source 1 corresponds to the stream fetch request identification streams ID1, 2, and 3, and the stream source 2 corresponds to the stream fetch request identification stream ID: 4. 5, 6, the stream source 3 corresponds to the stream fetching request identification stream ID: 7. 8, 9, \8230 \ 8230;, stream source n corresponds to a stream fetch request identifying stream ID: x, y, z, such that each stream ID corresponds to a stream source; each stream ID has a transmit address mapping table so that each stream source knows to which addresses it is to transmit.
Step 1.5: and storing the flow ID and generating a request flow ID mapping table.
The client stores the stream ID and generates a request stream ID mapping table; a stream ID of a client corresponds to a request, and different requests may have the same stream source, as shown in a request stream ID mapping table shown in fig. 13, where the stream ID:1 for stream request 1, stream ID:2 for stream request 2, stream ID: corresponding to stream request 3, stream ID: x corresponds to the stream request n, and the stream ID:1 and stream ID:2 requests are the same stream source.
Step 1.6: and monitoring the UDP port and waiting for the server to send the video stream.
The client monitors the UDP port and waits for receiving video stream data (packaging the video data to be transmitted or sub-packaging the video data to be transmitted) sent by the server.
Step 2: the client and the server interact with the video stream data, the video stream transmission uses the UDP protocol, as shown in fig. 12, the video stream data interaction process includes:
step 2.1: and traversing the stream source to obtain one frame of video data of one stream source.
The server side obtains a stream source and obtains a frame of video frame.
Step 2.2: a stream ID corresponding to a stream source is obtained.
The server obtains a flow ID mapped to the flow source from the flow source flow ID mapping table.
Step 2.3: and packaging the video data in the custom UDO format.
The server creates a self-defined UDP encapsulation (encapsulation of video data to be transmitted or sub-encapsulation of video data to be transmitted), writes a stream ID into a self-defined UDP encapsulation head (self-defined encapsulation format head), divides UDP encapsulation protocols into layers as shown in FIG. 6, divides a video frame into a plurality of MTU sizes (generally divides data sent through a UDP protocol into transmission with the size smaller than 1 MTU size for reducing packet loss of network transmission) as shown in FIG. 5, writes each divided video frame into the self-defined head (self-defined encapsulation format head), and then completes encapsulation of the video data in the self-defined UDP format.
Step 2.4: and sending the video data to the sending address and the port corresponding to the stream ID.
The server side obtains the sending address of the stream ID from the stream ID sending address mapping table, and sends a video frame (packaging video data to be transmitted or sub-packaging video data to be transmitted) in a custom UDP format to the address.
Step 2.5: and analyzing the custom format data to obtain the stream ID.
The client receives data (packaging video data to be transmitted or sub-packaging video data to be transmitted) from the port, and analyzes a self-defined UDP packaging head (packaging a self-defined packaging format of the video data to be transmitted or the sub-packaging video data to be transmitted) to obtain a stream ID of the video stream (packaging the video data to be transmitted or the sub-packaging video data to be transmitted).
Step 2.6: and matching the corresponding video stream request according to the stream ID.
The client matches to the corresponding video stream request (real-time stream request in fig. 8) according to the stored request stream ID mapping table.
Step 2.7: and combining a plurality of self-defined encapsulation packets into a complete video frame.
And if the packaged video data to be transmitted corresponding to one real-time stream request comprises a plurality of sub-packaged video data to be transmitted, assembling the sub-packaged video data to be transmitted into a complete video frame. That is, the client assembles the received multiple blocks of the custom UDP format video frame into a complete video frame. If the packaged video data to be transmitted corresponding to one real-time stream request is one, namely the packaged video data to be transmitted does not comprise a plurality of sub-packaged video data to be transmitted, the packaged video data to be transmitted is directly assembled into a complete video frame.
Compared with 12 bytes of an RTP (real-time transport protocol) header, the generation method for packaging the video data to be transmitted provided by the embodiment has the advantages that the custom packaging format header only has 8 bytes, so that the data transmission amount can be reduced, and the bandwidth is saved; and adding ID into protocol header (self-defined package format header) to distinguish different streams, realizing multiplexing of media data transmitting and receiving ports and saving system resources.
According to the port multiplexing video transmission method, based on the mode of carrying out video transmission on the video data to be transmitted which is generated by the generation method of packaging the video data to be transmitted, only the signaling of login and request stream is needed, the complicated RTSP signaling interaction is reduced, meanwhile, as the media frame format is customized, the video coding information is packaged into the media frame, compared with the mode of directly adopting RTSP/UDP Protocol in the related technology, firstly, the signaling is interacted through the RTSP Protocol, the UDP port number for transmission is negotiated, and then, the video stream is transmitted through the UDP port, the sdp (Session Description Protocol, which is mainly used for the direct media negotiation of multimedia Session) information interaction is saved, the signaling interaction is less and more flexible, the customized media stream packaging format is used, so that multiple media streams share one port, and the use of system resources is reduced.
In the following, an example is given by docking a network camera IPC and a digital video recorder NVR, where the IPC is used as a server and the first mentioned video transmission method of port multiplexing is used, the NVR is used as a client and the second mentioned video transmission method of port multiplexing is used, a request signaling port of the IPC is 20000, and the specific implementation manner is as follows:
1, IPC monitors a TCP port 20000 and waits for NVR to establish connection;
NVR is connected with 2000 port of IPC and sends login request to IPC;
3, returning an NVR success message after IPC verification is successful;
NVR sends request stream signaling to IPC, including channel number 0 and code stream number 0, and additionally sends IP192.168.1.2 and port 12345;
Method:start_stream
Data:channel:0,stream:0,ip:192.168.1.2,port:12345
5, IPC inquires the existence of the stream source corresponding to the 0 code stream of the channel 0, generates a stream ID for the request, and generates two tables: a stream source stream ID mapping table (table one) and a stream ID sending address mapping table (table two), and returns the stream ID to the client.
Result:ok
Data:streamID:3156
Table one, stream source stream ID mapping table
Flow source Channel number Code stream number Stream ID list
1 0 0 3156
Table two, stream ID transmit address mapping table
Stream ID Sending IP Transmitting port
3156 192.168.1.2 12345
Nvr receives the returned stream ID, generates the request stream ID mapping table (table three), and listens to port 12345.
Table three, request flow ID mapping table
Request stream ID Channel number Code stream number Stream ID
1 0 0 3156
7, IPC takes out a frame of video frame from the stream source 1 to carry out self-defined code stream format encapsulation, supposing that the frame is an I frame of H264 coding, the size is 4kB, firstly encapsulating the code stream into a self-defined media frame:
frame type 1 (I-frame) encoding type 1 (H264) frame length 4096, time stamp: 163578638, followed by H264 frame data.
At this time, the total length of the custom media frame is 4096+16 bytes media frame header +8 bytes UDP encapsulation header =4120 bytes, which is larger than 1 MTU size, and at this time, the custom media frame needs to be sub-packaged and divided into 4 packets, and at this time, the UDP encapsulation header needs to be filled:
bag 1: a head mark H;1, tail marker T:0, packet number: 0, stream ID:3156;
bag 2: head mark H:0, tail flag T:0, packet number: 1, stream ID:3156;
bag 3: head mark H:0, tail flag T:0, packet number: 2, stream ID:3156;
bag 4: a head marker H;0, tail flag T:1, packet number: 3, stream ID:3156.
as described above, the stream ID 3156 in the current stream ID list is obtained from the stream source stream ID mapping table, the stream ID is written into the UDP encapsulation header, and the stream ID transmission address mapping table is queried to obtain the transmission address 192.168.1.2 corresponding to the stream 3156: 12345, the 4 packets are sent out to the address in the order of packet ordering.
And 8, the NVR receives the 4 packets from the monitored UDP port 12345, analyzes the 4 packets, firstly checks the 4 packets as request 1 according to the request stream ID mapping table, transfers the 4 packets to the request 1 for processing, checks whether the head and tail marks of the 4 packets are correct or not after sequencing the serial numbers of the packets, and finally forms a complete self-defined media frame. When the NVR has multiple video pull requests (get stream requests) to IPC, the ports 12345 are multiplexed, so that only 1 port is needed to realize multi-path video transmission.
Referring to fig. 14, the present embodiment further provides a generating system 1400 for encapsulating video data to be transmitted, the system comprising:
a first obtaining module 1401, configured to obtain a video stream to be transmitted and stream fetching request information, and generate a request information identifier of the stream fetching request information, where the stream fetching request information includes a request address;
a generating module 1402, configured to generate and package video data to be transmitted according to the request information identifier, the video stream to be transmitted, and the request address.
In this embodiment, the system for generating encapsulated video data to be transmitted substantially includes a plurality of modules for executing the method for generating encapsulated video data to be transmitted in the above embodiment, and specific functions and technical effects may be implemented with reference to the above method embodiment, which is not described herein again.
Referring to fig. 15, the present embodiment further provides a video transmission system 1500 with multiplexed ports, including:
a second obtaining module 1501, configured to obtain at least two pieces of stream fetching request information, and generate a request information identifier of each piece of stream fetching request information, where the stream fetching request information includes request stream source information and ports, and the ports of the at least two pieces of stream fetching request information are the same;
a determining module 1502, configured to determine, according to request stream source information of each stream fetching request information, at least one to-be-transmitted video stream corresponding to the stream fetching request information;
the encapsulation module 1503 is configured to encapsulate the video stream to be transmitted and a request information identifier of a stream fetching request information corresponding to the video stream to be transmitted, so as to obtain encapsulated video data to be transmitted corresponding to the stream fetching request information;
the transmission module 1504 is configured to transmit the video data to be transmitted through the matching ports, where the matching ports are ports that encapsulate a streaming request message corresponding to the video data to be transmitted.
In this embodiment, the video transmission system with port multiplexing is substantially provided with a plurality of modules for executing the first video transmission method with port multiplexing in the foregoing embodiments, and specific functions and technical effects may refer to the foregoing method embodiments, and details are not described herein.
Referring to fig. 16, the present embodiment further provides a port multiplexing video transmission system 1600, including:
a sending module 1601, configured to send at least two pieces of stream fetching request information, where the stream fetching request information includes request stream source information and a port;
a third obtaining module 1602, configured to obtain a request information identifier of each of the stream fetching request information;
a monitoring module 1603, configured to monitor the port to receive the packaged to-be-transmitted video data, and assemble the packaged to-be-transmitted video data corresponding to each request information identifier into complete video frames, respectively, where a generation manner of the packaged to-be-transmitted video data is the generation method of the packaged to-be-transmitted video data according to any embodiment.
In this embodiment, the video transmission system with port multiplexing substantially has a plurality of modules for executing the second video transmission method with port multiplexing in the foregoing embodiment, and specific functions and technical effects may refer to the foregoing method embodiment, which is not described herein again.
Referring to fig. 17, an embodiment of the present invention further provides an electronic device 1000, which includes a processor 1001, a memory 1002, and a communication bus 1003;
the communication bus 1003 is used to connect the processor 1001 and the memory 1002;
the processor 1001 is configured to execute the computer program stored in the memory 1002 to implement the method according to one or more of the first embodiment.
Embodiments of the present invention also provide a computer-readable storage medium, having a computer program stored thereon,
the computer program is for causing a computer to perform the method as in any one of the above embodiments one.
Embodiments of the present application also provide a non-transitory readable storage medium, where one or more modules (programs) are stored in the storage medium, and when the one or more modules are applied to a device, the device may execute instructions (instructions) included in an embodiment of the present application.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
Computer program code for carrying out operations for aspects of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The foregoing embodiments are merely illustrative of the principles and utilities of the present invention and are not intended to limit the invention. Any person skilled in the art can modify or change the above-mentioned embodiments without departing from the spirit and scope of the present invention. Accordingly, it is intended that all equivalent modifications or changes which can be made by those skilled in the art without departing from the spirit and technical spirit of the present invention be covered by the claims of the present invention.

Claims (14)

1. A method of generating encapsulated video data for transmission, the method comprising:
acquiring a video stream to be transmitted and stream taking request information, and generating a request information identifier of the stream taking request information, wherein the stream taking request information comprises a request address;
generating and packaging video data to be transmitted according to the request information identification, the video stream to be transmitted and the request address,
the encapsulation of the video data to be transmitted comprises a user-defined media frame and/or a user datagram protocol, wherein the user-defined media frame comprises at least one part of frame data generated according to the video stream to be transmitted and at least one of the following frame data, a frame type, a coding type, a frame length and a time stamp;
if the packaged video data to be transmitted comprises a custom packaging format head and a custom media frame, the custom packaging format head comprises a head mark, a tail mark and a packet sequence number, and the frame data is divided into at least two sub-frame data according to the total data size when the total data size of the frame data generated by the video stream to be transmitted is larger than a preset size threshold value;
and respectively packaging the sub-frame data into sub-packaged video data to be transmitted according to the original sequence of the sub-frame data in the frame data, wherein the packaged video data to be transmitted comprises the sub-packaged video data to be transmitted, the package sequence of the packet sequence number in the sub-packaged video data to be transmitted is the same as the original sequence, the head mark in the sub-packaged video data to be transmitted with the earliest package sequence is characterized as the head, and the tail mark in the sub-packaged video data to be transmitted with the latest package sequence is characterized as the tail.
2. The method of generating encapsulated video data for transmission of claim 1, wherein said encapsulating video data for transmission includes a custom encapsulation format header, said custom encapsulation format header including at least one of:
head mark, tail mark, packet sequence number, request information mark and reserved blank byte.
3. A method for port multiplexed video transmission, the method comprising:
acquiring at least two pieces of flow acquisition request information, and generating a request information identifier of each piece of flow acquisition request information, wherein the flow acquisition request information comprises request flow source information and ports, and the ports of the at least two pieces of flow acquisition request information are the same;
determining at least one to-be-transmitted video stream corresponding to the stream taking request information according to the request stream source information of each stream taking request information;
packaging the video stream to be transmitted and a request information identifier of a stream taking request information corresponding to the video stream to be transmitted to obtain packaged video data to be transmitted corresponding to the stream taking request information;
respectively transmitting the packaged video data to be transmitted through a matching port, wherein the matching port is a port of the streaming request information corresponding to the packaged video data to be transmitted;
the streaming request information further comprises a sending address, and the generation mode of packaging the video data to be transmitted comprises the generation method of packaging the video data to be transmitted according to any one of claims 1-2.
4. The port multiplexing video transmission method according to claim 3, wherein the request stream source information includes request channel information and request code stream information, the initial stream source information includes initial channel information and initial code stream information, and the determination method of the video stream to be transmitted includes:
acquiring a video frame and initial channel information and initial code stream information of the video frame;
and if the initial stream source information of the video frame is the same as the request stream source information of at least one stream taking request information, determining the video frame as the video stream to be transmitted corresponding to the stream taking request information.
5. The method for port multiplexed video transmission according to claim 3, wherein the method further comprises:
generating an initial stream source information-request information identifier mapping relation according to the request stream source information, the request information identifiers and the initial stream source information of the equipment providing the video stream to be transmitted;
generating a port information-request information identifier mapping relation according to each request information identifier and each port information;
determining at least one to-be-transmitted video stream corresponding to the streaming request information according to the request stream source information of each piece of streaming request information respectively comprises determining at least one to-be-transmitted video stream corresponding to the streaming request information from each video frame according to an initial stream source information-request information identifier mapping relation, a port information-request information identifier mapping relation and initial stream source information of at least one video frame.
6. The port multiplexed video transmission method according to any of claims 3 to 5, wherein the streaming request information further includes a transmission address, the method further comprising:
and generating a sending address-request information identifier mapping relation according to each request information identifier and each sending address, and transmitting the obtained packaged video data to be transmitted to the corresponding sending address through the matching port according to the sending address-request information identifier mapping relation.
7. The method for port multiplexed video transmission according to any of claims 3-5, wherein before obtaining at least two fetching request messages, the method further comprises:
the method comprises the steps that a server side obtains a connection request sent by a client side, and connection between the server side and the client side is established;
and the server side acquires a login request sent by the client side and feeds a login success message back to the client side.
8. A method for port multiplexed video transmission, the method comprising:
sending at least two pieces of flow fetching request information, wherein the flow fetching request information comprises request flow source information and a port;
acquiring request information identification of each streaming request information;
monitoring the port to receive the packaged video data to be transmitted, and respectively assembling the packaged video data to be transmitted corresponding to each request information identifier into a complete video frame, wherein the generation mode of the packaged video data to be transmitted comprises the generation method of the packaged video data to be transmitted according to any one of claims 1-2.
9. The method according to claim 8, wherein if the packaged video data to be transmitted includes a plurality of sub-packaged video data to be transmitted, the assembling the packaged video data to be transmitted corresponding to each request information identifier into a complete video frame respectively comprises:
creating a mapping relation between the stream taking request information and the request information identifier according to the request information identifier and the stream taking request information;
matching corresponding stream taking request information according to the request information identification of the packaged video data to be transmitted;
assembling each sub-frame data into a complete video frame according to the packet sequence of the packet sequence number in each sub-package video data to be transmitted corresponding to the stream taking request information;
the streaming request information further comprises a sending address, and the generation mode of packaging the video data to be transmitted comprises the generation method of packaging the video data to be transmitted according to any one of claims 1-2.
10. A generation system for encapsulating video data to be transmitted, the system comprising:
the device comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring a video stream to be transmitted and stream taking request information and generating a request information identifier of the stream taking request information, and the stream taking request information comprises a request address;
the generating module is used for generating and packaging video data to be transmitted according to the request information identifier, the video stream to be transmitted and the request address, wherein the packaged video data to be transmitted comprises a user-defined media frame and/or a user datagram protocol, and the user-defined media frame comprises at least one part of frame data generated according to the video stream to be transmitted and at least one of the following frame data, frame type, coding type, frame length and timestamp;
if the packaged video data to be transmitted comprises a custom packaging format head and a custom media frame, wherein the custom packaging format head comprises a head mark, a tail mark and a packet sequence number, and the frame data is divided into at least two sub-frame data according to the total data size when the total data size of the frame data generated by the video stream to be transmitted is larger than a preset size threshold;
and respectively packaging the sub-frame data into sub-packaged video data to be transmitted according to the original sequence of the sub-frame data in the frame data, wherein the packaged video data to be transmitted comprises the sub-packaged video data to be transmitted, the package sequence of the packet sequence number in the sub-packaged video data to be transmitted is the same as the original sequence, the head mark in the sub-packaged video data to be transmitted with the earliest package sequence is characterized as the head, and the tail mark in the sub-packaged video data to be transmitted with the latest package sequence is characterized as the tail.
11. A video transmission system with port multiplexing, the system comprising:
a second obtaining module, configured to obtain at least two pieces of flow fetching request information, and generate a request information identifier of each piece of flow fetching request information, where the flow fetching request information includes request flow source information and a port, and the ports of the at least two pieces of flow fetching request information are the same;
a determining module, configured to determine, according to request stream source information of each piece of stream fetching request information, at least one to-be-transmitted video stream corresponding to the stream fetching request information;
the encapsulation module is used for encapsulating the video stream to be transmitted and a request information identifier of streaming request information corresponding to the video stream to be transmitted to obtain encapsulated video data to be transmitted corresponding to the streaming request information;
the transmission module is configured to transmit the video data to be packaged through matching ports, where the matching ports are ports of the streaming request information corresponding to the video data to be packaged, the streaming request information further includes a sending address, and the generation method of the video data to be packaged includes the generation method of the video data to be packaged according to any one of claims 1 to 2.
12. A video transmission system with port multiplexing, the system comprising:
a sending module, configured to send at least two pieces of stream fetching request information, where the stream fetching request information includes request stream source information and a port;
a third obtaining module, configured to obtain a request information identifier of each piece of stream fetching request information;
a monitoring module, configured to monitor the port to receive the packaged to-be-transmitted video data, and assemble the packaged to-be-transmitted video data corresponding to each request information identifier into complete video frames, where a generation manner of the packaged to-be-transmitted video data includes the method for generating the packaged to-be-transmitted video data according to any one of claims 1 to 2.
13. An electronic device comprising a processor, a memory, and a communication bus;
the communication bus is used for connecting the processor and the memory;
the processor is configured to execute a computer program stored in the memory to implement the method of any one of claims 1-9.
14. A computer-readable storage medium, having stored thereon a computer program,
the computer program is for causing a computer to perform the method of any one of claims 1-9.
CN202210162563.5A 2022-02-22 2022-02-22 Method, system and equipment for generating packaged video data to be transmitted and transmitting video Active CN114531606B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210162563.5A CN114531606B (en) 2022-02-22 2022-02-22 Method, system and equipment for generating packaged video data to be transmitted and transmitting video

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210162563.5A CN114531606B (en) 2022-02-22 2022-02-22 Method, system and equipment for generating packaged video data to be transmitted and transmitting video

Publications (2)

Publication Number Publication Date
CN114531606A CN114531606A (en) 2022-05-24
CN114531606B true CN114531606B (en) 2023-04-11

Family

ID=81624218

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210162563.5A Active CN114531606B (en) 2022-02-22 2022-02-22 Method, system and equipment for generating packaged video data to be transmitted and transmitting video

Country Status (1)

Country Link
CN (1) CN114531606B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102823201A (en) * 2009-12-21 2012-12-12 思科系统国际公司 Method and device for filtering media packets
CN104022829A (en) * 2014-06-17 2014-09-03 四川微迪通信技术有限公司 Ethernet optical transmission link with single Ethernet port converged outputting at center end
CN104836811A (en) * 2015-05-26 2015-08-12 武汉兴图新科电子股份有限公司 Communication port multiplexing method keeping transmission data integrity

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101155181B (en) * 2006-09-25 2010-11-24 华为技术有限公司 Data flow multiplexing method, device and system
CN102595199A (en) * 2011-01-11 2012-07-18 中兴通讯股份有限公司 Streaming media packet packaging and transmitting method, and streaming media processing device
CN106790044B (en) * 2016-12-19 2020-04-17 北京数码视讯科技股份有限公司 Method and device for converting TS (transport stream) code stream into RTP (real-time transport protocol) code stream
CN112073378B (en) * 2020-08-12 2022-07-08 福建升腾资讯有限公司 Streaming media port multiplexing method, equipment and medium based on WebRTC

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102823201A (en) * 2009-12-21 2012-12-12 思科系统国际公司 Method and device for filtering media packets
CN104022829A (en) * 2014-06-17 2014-09-03 四川微迪通信技术有限公司 Ethernet optical transmission link with single Ethernet port converged outputting at center end
CN104836811A (en) * 2015-05-26 2015-08-12 武汉兴图新科电子股份有限公司 Communication port multiplexing method keeping transmission data integrity

Also Published As

Publication number Publication date
CN114531606A (en) 2022-05-24

Similar Documents

Publication Publication Date Title
US11381625B2 (en) Apparatus and method for transmitting multimedia data in hybrid network
JP6989681B2 (en) A transmitter that transmits media packets in a broadcasting system
KR102019101B1 (en) Method of transferring media contents over single port or multiple port and apparatus for performing the same
US9635394B2 (en) Method and device for flexible MMT asset transmission and reception
CN109167960B (en) Method and system for processing video stream data
JP2014053024A (en) Streaming data content in network
US10498788B2 (en) Method and apparatus for transceiving data packet for transmitting and receiving multimedia data
WO2020125604A1 (en) Data transmission method, apparatus, device, and storage medium
CN111787026A (en) Method, device and equipment for transmitting media data and storage medium
CN105934952B (en) Method and apparatus for sending and receiving media data in multimedia system
WO2016003244A1 (en) Method and device for receiving media packets in multimedia system
CN114531606B (en) Method, system and equipment for generating packaged video data to be transmitted and transmitting video
US20190349615A1 (en) Handling advertisement placement within a decisioned advertisement
KR101757459B1 (en) Method and apparatus for processing packet
WO2017142175A1 (en) Method and device for transmitting/receiving free viewpoint broadcast
US10630745B2 (en) MMT apparatus and MMT method for processing media data
CN105704581A (en) HTTP real-time video transmission method based on MP4 file format
CN114363676A (en) Video stream transmission method, device, equipment and medium
CN117692528A (en) Data transmission method, device, computer equipment and storage medium
WO2016204442A1 (en) Mmt apparatus and mmt method for processing media data
WO2015060586A1 (en) Apparatus and method for configuring mmt payload header
KR20150044365A (en) Method for setting generic file delivery mode using generic file delivery descriptor
KR20150035857A (en) Apparatus and method for delivering multimedia data in hybrid network

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant