Disclosure of Invention
In order to solve the above-mentioned deficiencies of the prior art, the present invention provides a synchronous switching method and system, which can implement synchronous decoding between the decoding devices participating in switching in the video matrix, and the frames embodied on the multiple display devices at the back end are synchronously switched.
The technical problem to be solved by the invention is realized by the following technical scheme:
a synchronous switching method of video matrix includes steps:
the coding equipment participating in the switching sends the formed coding signal to each decoding equipment participating in the switching through the matrix network equipment;
after receiving the coding signals, each decoding device participating in switching sends feedback signals to the coding devices participating in switching through the matrix network device;
after receiving feedback signals of all decoding devices participating in switching, the coding device participating in switching encodes one frame of video frame received by the coding device into a switching frame;
and each decoding device participating in switching respectively identifies the coded signals, and after the switching frame is identified in the coded signals, the coded signals are decoded from the same key frame.
Further, before the coding device participating in the switching sends the formed coding signal to each decoding device participating in the switching through the matrix network device, the method further comprises the following steps:
the switching control equipment respectively sends switching signals to each decoding equipment participating in switching;
and after receiving the switching signal, each decoding device participating in switching accesses the coding device participating in switching through the matrix network device.
Further, before the coding device participating in the switching sends the formed coding signal to each decoding device participating in the switching through the matrix network device, the method further comprises the following steps:
the switching control equipment sends a switching signal to coding equipment participating in switching;
and after receiving the switching signal, the coding equipment participating in the switching waits for each decoding equipment participating in the switching to be accessed through the matrix network equipment.
Further, the switching control device simultaneously transmits the device information of the respective decoding devices participating in the switching when transmitting the switching signal to the encoding device participating in the switching.
Furthermore, the switching frame has a switching identifier for identifying each decoding device participating in switching, and each decoding device participating in switching detects each frame in the encoded signal and judges whether the switching frame exists in the encoded signal by identifying the switching identifier.
Further, if the switching frame is a switching key frame, each decoding device participating in switching decodes the encoded signal from the switching frame.
Further, the encoding device participating in the switching encodes the next frame of video frame received by the encoding device participating in the switching into the switching key frame after receiving the feedback signals of all the decoding devices participating in the switching.
Further, if the switching frame is a switching normal frame, each decoding device participating in switching starts decoding the encoded signal from the key frame in the next video group after recognizing the switching frame.
A system for synchronized switching of video matrices, comprising:
a plurality of encoding devices for receiving the plurality of channels of video signals, encoding the received plurality of channels of video signals, and outputting a plurality of channels of encoded signals;
a plurality of decoding devices for receiving the plurality of encoded signals, decoding the received plurality of encoded signals, and outputting a plurality of decoded signals;
the matrix network equipment is used for forwarding signals between the plurality of encoding equipment and the plurality of decoding equipment and is in communication connection between the plurality of encoding equipment and the plurality of decoding equipment.
Further, still include:
and the switching control equipment is used for controlling the signal switching between the plurality of coding equipment and the plurality of decoding equipment and is respectively in communication connection with the plurality of coding equipment and the plurality of decoding equipment.
The invention has the following beneficial effects: after receiving the coding signal, each decoding device participating in switching in the synchronous switching method and system does not immediately start decoding from the next key frame, but waits for the switching frame, and starts decoding from the same key frame after recognizing the switching frame, so that the problem of asynchronous decoding caused by different time for accessing each decoding device participating in switching to the coding device participating in switching can be solved, synchronous decoding is realized among the decoding devices participating in switching, picture synchronous switching of a plurality of display devices is shown on a plurality of display devices at the rear end, and the switching speed is improved.
Detailed Description
The present invention will be described in detail below with reference to the accompanying drawings and examples.
Example one
As shown in fig. 1, a method for synchronous switching of video matrix is applied to a synchronous switching system.
The synchronous switching system includes:
a plurality of encoding devices for receiving the plurality of channels of video signals, encoding the received plurality of channels of video signals, and outputting a plurality of channels of encoded signals;
a plurality of decoding devices for receiving the plurality of encoded signals, decoding the received plurality of encoded signals, and outputting a plurality of decoded signals;
the matrix network equipment is used for forwarding signals between the plurality of encoding equipment and the plurality of decoding equipment and is in communication connection between the plurality of encoding equipment and the plurality of decoding equipment;
and the switching control equipment is used for controlling the signal switching between the plurality of coding equipment and the plurality of decoding equipment and is respectively in communication connection with the plurality of coding equipment and the plurality of decoding equipment.
The source equipment which is respectively in communication connection with the plurality of coding equipment at the front end can be a PC (personal computer), a set-top box or a game machine and the like; the display device which is respectively connected with the plurality of decoding devices in a communication way at the back end can be a display, a projector, a television or the like.
As shown in fig. 2, the synchronous handover method includes:
s101: the switching control device sends switching signals to the decoding devices participating in switching respectively, and the switching control device sends switching signals to the encoding devices participating in switching;
in this step S101, the switching control device may be, but not limited to, a control server located in the cloud, and respectively sends the switching signal to each decoding device participating in the switching and the encoding device participating in the switching through the internet.
The switching control device also simultaneously transmits device information of the respective decoding devices participating in the switching when transmitting the switching signal to the encoding device participating in the switching. The device information is used for the encoding device participating in the handover to identify each decoding device participating in the handover in the subsequent steps, and may include an IP address or a device ID of the corresponding decoding device.
S102: after receiving the switching signal, the coding equipment participating in switching waits for each decoding equipment participating in switching to access through the matrix network equipment, and after receiving the switching signal, each decoding equipment participating in switching accesses the coding equipment participating in switching through the matrix network equipment;
in step S102, each decoding device participating in the handover accesses the coding device participating in the handover in a multicast manner, specifically: after receiving the switching signal, each decoding device participating in switching is added into a multicast group where the coding device participating in switching is located through the matrix network device so as to access the coding device participating in switching.
S103: the coding equipment participating in the switching sends the formed coding signals to each decoding equipment participating in the switching through the matrix network equipment;
in step S103, after accessing the coding device participating in the handover, each decoding device participating in the handover can acquire the coded signal output by the coding device participating in the handover from the matrix network device, but at this time, each decoding device participating in the handover does not decode the coded signal immediately.
The coded signal adopts an H264 coding format, the frame rate is not limited, a plurality of video frames form a video Group (GOP), the first frame video frame in each video group is a key frame, and the rest video frames are common frames. For example, the frame rate of the encoded signal is 60 frames/s, each video group is composed of 60 frames of video frames, the first frame of video frame is a key frame, and the remaining 59 frames of video frames are all normal frames.
S104: after receiving the coding signals, each decoding device participating in switching sends feedback signals to the coding devices participating in switching through the matrix network device;
in step S104, after receiving the encoded signal, each decoding device participating in the handover sends the feedback signal to the encoding device participating in the handover through the matrix network device alone; the feedback signal is used to inform the encoding devices involved in the handover that the corresponding decoding devices have received the encoded signal.
S105: after receiving feedback signals of all decoding devices participating in switching, the coding device participating in switching encodes one frame of video frame received by the coding device into a switching frame;
in this step 105, the switching frame has a switching identifier that can be recognized by each decoding device participating in the switching.
The switching frame may be a key frame or a normal frame.
In the optimal scheme, after receiving all feedback signals, the coding device participating in switching always codes the next frame of video frame received by the coding device into a switching key frame (both switching frames and key frames) regardless of whether the coding of all video frames in the original video group is finished or not, and the switching key frame is used as the key frame of a new video group, so as to improve the switching speed of each display device at the rear end.
In two preferred schemes, after receiving all feedback signals, the coding device participating in switching codes the next frame of video frame received by the coding device as a switching frame, if the coding of all video frames in the original video group is not completed yet, the next frame of video frame is a common frame in the original video group, the switching frame is a switching common frame (both a switching frame and a common frame), and if the coding of all video frames in the original video group is just completed, the next frame of video frame is just a key frame in a new video group, the switching frame is a switching key frame.
Of course, the switching frame does not necessarily adopt the next frame of video frame received by the coding device participating in the switching after receiving all the feedback signals, and may also adopt the video frame received after several frames apart, depending on the specific requirement.
And the coding equipment participating in the switching identifies the decoding equipment corresponding to the feedback information through the equipment information attached in the feedback information. And the coding device participating in the switching encodes and generates the switching frame only after identifying the device information of all decoding devices participating in the switching, which is sent by the switching control device in advance, so as to determine that all the decoding devices participating in the switching have received the coding signals of the decoding devices. There are at least two decoding devices involved in the handover.
S106: each decoding device participating in switching respectively identifies the coded signals, and after the switching frame is identified in the coded signals, the coded signals are decoded from the same key frame;
in this step S106, each decoding device involved in switching detects each frame in the encoded signal, and determines whether the switching frame exists in the encoded signal by identifying the switching flag.
If the switching frame is a switching key frame, each decoding device participating in switching starts decoding the coded signal from the switching frame, and if the switching frame is a switching common frame, each decoding device participating in switching starts decoding the coded signal from a key frame in the next video group after identifying the switching frame.
Certainly, each decoding device participating in the switching does not necessarily start decoding from the switching key frame or the key frame in the next video group, and may start decoding from the key frame in the corresponding video group after a plurality of video groups are separated, depending on the specific requirements.
After receiving the coding signal, each decoding device participating in switching in the synchronous switching method and system does not immediately start decoding from the next key frame, but waits for the switching frame, and starts decoding from the same key frame after recognizing the switching frame, so that the problem of asynchronous decoding caused by different time for accessing each decoding device participating in switching to the coding device participating in switching can be solved, synchronous decoding is realized among the decoding devices participating in switching, picture synchronous switching of a plurality of display devices is shown on a plurality of display devices at the rear end, and the switching speed is improved.
Example two
A decoding method capable of realizing synchronous switching of video matrixes is applied to decoding equipment.
The decoding device comprises a processor and a memory connected with the processor, wherein a computer program executed by the processor is stored in the memory; when the processor executes the computer program, the decoding method capable of realizing synchronous switching of the video matrix is carried out.
As shown in fig. 3, the decoding method includes the steps of:
s101: receiving a switching signal;
in this step S101, the switching signal is transmitted by the switching control device; the switching control device may be, but is not limited to, a control server located in a cloud, and sends the switching signal to the decoding device through the internet.
S102: and accessing the coding equipment participating in the switching after receiving the switching signal.
In step S102, the decoding device may access the coding device participating in the handover through the matrix network device, preferably, access the coding device participating in the handover through a multicast mode, specifically: after receiving the switching signal, the decoding device joins the multicast group where the coding device participating in the switching is located through the matrix network device to access the coding device participating in the switching.
S103: receiving an encoding signal output by an encoding device participating in switching;
in step S103, the decoding device can acquire the encoded signal output by the encoding device participating in the handover from the matrix network device immediately after accessing the encoding device participating in the handover, but at this time, the decoding device does not decode the encoded signal immediately.
The coded signal adopts an H264 coding format, the frame rate is not limited, a plurality of video frames form a video Group (GOP), the first frame video frame in each video group is a key frame, and the rest video frames are common frames. For example, the frame rate of the encoded signal is 60 frames/s, each video group is composed of 60 frames of video frames, the first frame of video frame is a key frame, and the remaining 59 frames of video frames are all normal frames.
S104: after receiving the coding signal, sending a feedback signal to coding equipment participating in switching;
in step S104, after receiving the encoded signal, the decoding device sends the feedback signal to the encoding device participating in the switching through the matrix network device; the feedback signal is used to inform the encoding device involved in the handover that the decoding device has received the encoded signal it outputs.
The coding device participating in the handover identifies the decoding device through device information attached in the feedback information, where the device information is used for the coding device participating in the handover to identify the decoding device, and may include an IP address or a device ID of the decoding device. And the device information of all decoding devices participating in the handover has been previously transmitted to the encoding device participating in the handover by the handover control device.
S105: identifying the coded signal, and decoding the coded signal from a preset key frame after a switching frame is identified in the coded signal, wherein the switching frame is generated by coding one frame of video frames received by the coding equipment participating in switching after receiving feedback signals sent by all decoding equipment participating in switching;
in step S105, the switching frame has a switching identifier that can be identified by the decoding apparatus, the decoding apparatus detects each frame in the encoded signal, and determines whether the switching frame exists in the encoded signal by identifying the switching identifier. The predetermined key frame refers to the same key frame which is preset and starts to be decoded after each decoding device participating in switching receives the switching frame.
The switching frame may be a key frame or a normal frame.
In the optimal scheme, after receiving all feedback signals, the coding device participating in switching always codes the next frame of video frame received by the coding device into a switching key frame (both switching frames and key frames) regardless of whether the coding of all video frames in the original video group is finished or not, and the switching key frame is used as the key frame of a new video group, so as to improve the switching speed of each display device at the rear end.
In two preferred schemes, after receiving all feedback signals, the coding device participating in switching codes the next frame of video frame received by the coding device as a switching frame, if the coding of all video frames in the original video group is not completed yet, the next frame of video frame is a common frame in the original video group, the switching frame is a switching common frame (both a switching frame and a common frame), and if the coding of all video frames in the original video group is just completed, the next frame of video frame is just a key frame in a new video group, the switching frame is a switching key frame.
Of course, the switching frame does not necessarily adopt the next frame of video frame received by the coding device participating in the switching after receiving all the feedback signals, and may also adopt the video frame received after several frames apart, depending on the specific requirement.
And the coding device participating in the switching generates the switching frame only after identifying the device information of all decoding devices participating in the switching, which is sent by the switching control device in advance, so as to determine that all the decoding devices participating in the switching have received the coding signals of the decoding devices. There are at least two decoding devices involved in the handover.
And if the switching frame is a switching key frame, the decoding equipment starts decoding the coded signal from the switching frame, and if the switching frame is a switching common frame, the decoding equipment starts decoding the coded signal from a key frame in the next video group after the switching frame is identified.
Of course, the decoding device does not necessarily start decoding from the switching key frame or the key frame in the next video group, and may start decoding from the key frame in the corresponding video group after several video groups are separated, depending on the specific requirements.
When the decoding method and the decoding equipment are switched, the decoding is not started from the next key frame immediately after the coded signal is received, but the switching frame is waited, and the decoding is started from the preset key frame after the switching frame is identified, so that the problem of asynchronous decoding caused by different time of accessing the coding equipment participating in the switching of each decoding equipment can be solved, the synchronous decoding among the decoding equipment is realized, the synchronous switching of pictures of a plurality of display equipment is shown on a plurality of display equipment at the rear end, and the switching speed is improved.
A readable storage medium, which stores a computer program for execution by a processor, wherein when the computer program is executed by the processor, the processor performs the decoding method for implementing video matrix synchronous switching.
EXAMPLE III
An encoding device capable of realizing synchronous switching of video matrixes is applied to an encoding device.
The coding device comprises a processor and a memory connected with the processor, wherein a computer program executed by the processor is stored in the memory; when the processor executes the computer program, the encoding method capable of realizing synchronous switching of the video matrix is carried out.
As shown in fig. 4, the encoding method includes the steps of:
s101: receiving a switching signal;
in this step S101, the switching signal is transmitted by the switching control device; the switching control device may be, but is not limited to, a control server located in a cloud, and sends the switching signal to the encoding device through the internet.
Wherein the encoding device further receives device information of the respective decoding devices participating in the handover from the handover control device at the same time when receiving the handover signal. The device information is used for the encoding device to identify each decoding device participating in the switching in the subsequent steps, and may include an IP address or a device ID of the corresponding decoding device, and the like.
S102: after receiving the switching signal, waiting for each decoding device participating in switching to access;
in step S102, the switching control device sends the switching signal to each decoding device participating in the switching, and each decoding device participating in the switching accesses the encoding device through the matrix network device after receiving the switching signal.
Preferably, the coding device is accessed by the coding device participating in the handover in a multicast mode. The method specifically comprises the following steps: after receiving the switching signal, each decoding device participating in the switching joins in a multicast group where the encoding device is located through the matrix network device to access the encoding device.
S103: transmitting the formed coded signals to each decoding device participating in the switching;
in step S103, after accessing the encoding device, each decoding device participating in the handover can acquire the encoded signal output by the encoding device from the matrix network device, but at this time, each decoding device participating in the handover does not decode the encoded signal immediately.
The coded signal adopts an H264 coding format, the frame rate is not limited, a plurality of video frames form a video Group (GOP), the first frame video frame in each video group is a key frame, and the rest video frames are common frames. For example, the frame rate of the encoded signal is 60 frames/s, each video group is composed of 60 frames of video frames, the first frame of video frame is a key frame, and the remaining 59 frames of video frames are all normal frames.
S104: receiving feedback signals sent by each decoding device participating in switching, wherein the feedback signals are sent by each decoding device participating in switching after receiving the coding signals;
in step S104, after receiving the encoded signal, each decoding device participating in the switching forwards the feedback signal to the encoding device through the matrix network device; the feedback signal is used to inform the encoding device that the respective decoding device participating in the handover has received the encoded signal it outputs.
Wherein the encoding device identifies the corresponding decoding device by device information attached to the feedback information.
S105: after receiving feedback signals of all decoding devices participating in switching, encoding one frame of video frames received by the decoding devices into a switching frame, wherein the switching frame is used for identifying each decoding device participating in switching, and after each decoding device participating in switching identifies the switching frame in the encoded signals, decoding the encoded signals from the same key frame;
in step S105, the switching frame has a switching identifier for identifying each decoding device participating in the switching, and each decoding device participating in the switching detects each frame in the encoded signal and determines whether the switching frame exists in the encoded signal by identifying the switching identifier.
The switching frame may be a key frame or a normal frame.
In the optimal scheme, after receiving all feedback signals, the encoding device always encodes the next frame of video frame received by the encoding device into a switching key frame (both switching frames and key frames) regardless of whether the encoding of all video frames in the original video group is completed or not, and the switching key frame is used as the key frame of the new video group, so that the switching speed of each display device at the rear end is increased.
In two preferred schemes, after receiving all feedback signals, the encoding device encodes the next frame of video frame received by the encoding device into a switching frame, if the encoding of all video frames in the original video group is not completed yet, the next frame of video frame is a common frame in the original video group, the switching frame is a switching common frame (both the switching frame and the common frame), and if the encoding of all video frames in the original video group is just completed, the next frame of video frame is just a key frame in a new video group, the switching frame is a switching key frame.
Of course, the switching frame does not necessarily adopt the next frame of video frame received by the encoding device after receiving all the feedback signals, and may also adopt the video frame received after several frames, depending on the specific requirements.
And the coding device generates the switching frame only after identifying the device information of all decoding devices participating in switching, which is sent by the switching control device in advance, so as to determine that all the decoding devices participating in switching have received the coding signals of the decoding devices. There are at least two decoding devices involved in the handover.
If the switching frame is a switching key frame, each decoding device participating in switching starts decoding the coded signal from the switching frame, and if the switching frame is a switching common frame, each decoding device participating in switching starts decoding the coded signal from a key frame in the next video group after identifying the switching frame.
Certainly, each decoding device participating in the switching does not necessarily start decoding from the switching key frame or the key frame in the next video group, and may start decoding from the key frame in the corresponding video group after a plurality of video groups are separated, depending on the specific requirements.
When the coding method and the coding equipment are switched, after all decoding equipment participating in switching is confirmed to be accessed through the feedback signal, the switching frame is generated in the coding signal so that each decoding equipment participating in switching starts to decode from the same key frame after being identified, the problem of asynchronous decoding caused by different time of accessing each coding equipment of each decoding equipment participating in switching can be solved, synchronous decoding is realized among the decoding equipment participating in switching, the synchronous switching of pictures of a plurality of display equipment is shown on a plurality of display equipment at the rear end, and the switching speed is improved.
A readable storage medium storing a computer program for execution by a processor; when the processor executes the computer program, the coding method capable of realizing synchronous switching of the video matrix is carried out.
The above-mentioned embodiments only express the embodiments of the present invention, and the description is more specific and detailed, but not understood as the limitation of the patent scope of the present invention, but all the technical solutions obtained by using the equivalent substitution or the equivalent transformation should fall within the protection scope of the present invention.