A video playing method and device, electronic equipment and storage medium

By stopping the writing of video data to the virtual camera node in the first buffer when switching video sources, and instead writing and playing the second video data, the stuttering and black screen problems during video source switching are solved, and the continuity and quality of video playback are improved.

CN122160537APending Publication Date: 2026-06-05GUANGZHOU SHIYUAN ELECTRONICS CO LTD +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
GUANGZHOU SHIYUAN ELECTRONICS CO LTD
Filing Date
2024-12-05
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

When switching video sources, electronic devices are prone to playback stuttering and black screen issues, resulting in a decrease in video playback quality.

Method used

When switching video sources, stop writing video data from the first buffer to the virtual camera node, and instead write and play the second video data, reading it from the virtual camera node, thus avoiding switching the virtual camera node.

Benefits of technology

It enables continuous playback of video data, avoiding playback stuttering and black screens, and improving video playback quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122160537A_ABST
    Figure CN122160537A_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a video playing method and device, electronic equipment and storage medium, which can store first video data sent by a first video source into a first buffer, and store second video data sent by a second video source into a second buffer. When the first video source is switched to the second video source, the writing of the first video data in the first buffer into a virtual camera node is stopped, the second video data is written into the virtual camera node, the second video data is read from the virtual camera node and played. In this way, when the video source is switched, the virtual camera node does not need to be switched, so that the video data can be continuously played, the problems such as video playing lag and black screen can be avoided, and the video playing quality can be effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of video playback technology, and in particular to a video playback method, apparatus, electronic device, and storage medium. Background Technology

[0002] In related technologies, an electronic device may include multiple video transmission interfaces, each of which can be connected to a video source, and each video source can send video data to the electronic device through its corresponding video transmission interface.

[0003] In electronic devices, each video transmission interface corresponds to a video data buffer and a virtual camera node. After receiving video data sent by each video source, the electronic device can write it into the corresponding buffer, and then read it from the buffer and write it into the corresponding virtual camera node.

[0004] When playing video data from the first video source, the electronic device can read the corresponding video data from the virtual camera node corresponding to the video transmission interface connected to the first video source and play it. When it needs to play video data from the second video source, the electronic device reads the corresponding video data from the virtual camera node corresponding to the video transmission interface connected to the second video source and plays it. However, when switching video sources, the electronic device often experiences playback stuttering and black screen issues, severely reducing video playback quality.

[0005] Improving video playback quality when switching video sources has become a pressing technical problem that needs to be solved. Summary of the Invention

[0006] This application provides a video playback method, apparatus, electronic device, and storage medium. When switching video sources, there is no need to switch virtual camera nodes, thus enabling continuous playback of video data and avoiding problems such as video playback stuttering and black screens, thereby effectively improving video playback quality.

[0007] In a first aspect, embodiments of this application provide a video playback method applied to a first electronic device, wherein a first video transmission interface of the first electronic device is connected to a first video source, and a second video transmission interface of the first electronic device is connected to a second video source; the first electronic device includes a virtual camera node;

[0008] The method includes: receiving first video data sent by the first video source and storing the first video data in a first buffer; receiving second video data sent by the second video source and storing the second video data in a second buffer; responding to a first playback request, reading the first video data from the first buffer and writing the first video data to the virtual camera node, reading the first video data from the virtual camera node and playing it; the first playback request is a playback request corresponding to a first video transmission interface; responding to a second playback request, stopping reading the first video data from the first buffer, reading the second video data from the second buffer and writing the second video data to the virtual camera node, reading the second video data from the virtual camera node and playing it; the second playback request is a playback request corresponding to a second video transmission interface.

[0009] Optionally, the first video data is compressed and encoded video data; receiving the first video data sent by the first video source and storing the first video data in the first buffer includes: receiving the first video data sent by the first video source, decoding the first video data to obtain decoded first video data; and storing the decoded first video data in the first buffer.

[0010] Optionally, receiving the first video data sent by the first video source and storing the first video data in the first buffer includes: receiving the first video data sent by the first video source through a first video transmission interface; obtaining a first identifier of the first video transmission interface; determining the address of the first buffer according to the first identifier and a preset mapping table; the mapping table includes a mapping relationship between the first identifier and the address of the first buffer; and storing the first video data in the first buffer according to the address of the first buffer.

[0011] Optionally, the step of reading the first video data from the first buffer in response to the first playback request includes: receiving the first playback request; parsing the first identifier of the first video transmission interface from the first playback request; determining the address of the first buffer based on the first identifier and the mapping table; and reading the first video data from the first buffer based on the address of the first buffer.

[0012] Optionally, writing the first video data to the virtual camera node includes: obtaining the file descriptor of the virtual camera node; and writing the first video data to the virtual camera node according to the file descriptor of the virtual camera node.

[0013] Optionally, the first identifier is the port number.

[0014] Secondly, embodiments of this application provide a video playback device disposed in a first electronic device, wherein a first video transmission interface of the first electronic device is connected to a first video source, and a second video transmission interface of the first electronic device is connected to a second video source; the first electronic device includes a virtual camera node;

[0015] The device includes: a storage module, configured to receive first video data sent by the first video source and store the first video data in a first buffer, and receive second video data sent by the second video source and store the second video data in a second buffer; a first playback module, configured to, in response to a first playback request, read the first video data from the first buffer and write the first video data to the virtual camera node, and read and play the first video data from the virtual camera node; the first playback request is a playback request corresponding to a first video transmission interface; and a second playback module, configured to, in response to a second playback request, stop reading the first video data from the first buffer, read the second video data from the second buffer and write the second video data to the virtual camera node, and read and play the second video data from the virtual camera node; the second playback request is a playback request corresponding to a second video transmission interface.

[0016] Thirdly, embodiments of this application provide an electronic device, including: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it causes the electronic device to implement the method described in the first aspect or various possible implementations of the first aspect.

[0017] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer instructions, which, when executed by a processor, are used to implement the method described in the first aspect or various possible implementations of the first aspect.

[0018] This application provides a video playback method, apparatus, electronic device, and storage medium. It stores first video data sent from a first video source in a first buffer and second video data sent from a second video source in a second buffer. When switching from the first video source to the second video source, writing the first video data from the first buffer to a virtual camera node is stopped, while the second video data is written to the virtual camera node. The second video data is then read from the virtual camera node and played. This eliminates the need to switch virtual camera nodes when switching video sources, allowing for continuous video playback and avoiding issues such as video playback stuttering and black screens, thus effectively improving video playback quality. Attached Figure Description

[0019] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0020] Figure 1 A schematic diagram illustrating an application scenario of the video playback method provided in an embodiment of this application;

[0021] Figure 2 A schematic flowchart of a video playback method provided in an embodiment of this application;

[0022] Figure 3 A schematic diagram illustrating the working state of a video playback method provided in an embodiment of this application;

[0023] Figure 4 A schematic diagram illustrating another working state of the video playback method provided in the embodiments of this application;

[0024] Figure 5 A schematic diagram of a video playback device provided for an embodiment of this application;

[0025] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0026] In this article, the term "and / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. The symbol " / " in this article indicates that the related objects are in an "or" relationship; for example, A / B means A or B.

[0027] The terms "first" and "second," etc., used in the specification and claims herein are used to distinguish different objects, not to describe a specific order of objects. For example, "first response message" and "second response message," etc., are used to distinguish different response messages, not to describe a specific order of response messages.

[0028] In the embodiments of this application, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design that is described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design. Specifically, the use of the terms "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.

[0029] In the description of the embodiments of this application, unless otherwise stated, "multiple" means two or more, for example, multiple processors means two or more processors, multiple elements means two or more elements, etc.

[0030] In current related technologies, an electronic device may include multiple video transmission interfaces, each of which can connect to one video source. Each video source can send video data to the electronic device through its corresponding video transmission interface. After receiving the video data from each video source, the electronic device can store it in the video data buffer corresponding to each video transmission interface.

[0031] For example, an electronic device may include a video transmission interface A and a video transmission interface B. Video transmission interface A corresponds to a video data buffer AA and a virtual camera node AAA, and video transmission interface B corresponds to a video data buffer BB and a virtual camera node BBB. After receiving video data through video transmission interface A, the electronic device can write it into the video data buffer AA. Then, the electronic device can read video data from the video data buffer AA and write the video data into the corresponding virtual camera node AAA.

[0032] Similarly, after receiving video data through video transmission interface B, the electronic device can write it into the video data buffer BB. Then, the electronic device can read video data from the video data buffer BB and write it into the corresponding virtual camera node BBB.

[0033] When an electronic device plays video data received through video transmission interface A, it can read the corresponding video data from virtual camera node AAA and play it. When it needs to play video data received through video transmission interface B, it can read the corresponding video data from virtual camera node BBB and play it. However, when switching from virtual camera node AAA to virtual camera node BBB, the electronic device cannot play the video data continuously due to the long time required to open and close virtual camera node BBB and AAA. Therefore, playback stuttering and black screens often occur during playback, severely reducing video playback quality.

[0034] Therefore, embodiments of this application provide a video playback method, apparatus, electronic device, and storage medium. First video data sent from a first video source is stored in a first buffer, and second video data sent from a second video source is stored in a second buffer. When switching from the first video source to the second video source, writing the first video data from the first buffer to the virtual camera node is stopped, and the second video data is written to the virtual camera node. The second video data is then read from the virtual camera node and played. In this way, switching video sources does not require switching the virtual camera node, thus enabling continuous playback of video data and avoiding problems such as video playback stuttering and black screens, effectively improving video playback quality.

[0035] This application provides a video playback method. Figure 1 This illustration shows an application scenario of the video playback method. The scenario includes a first electronic device 11, a first video source 12, and a second video source 13. The first electronic device 11 includes a first video transmission interface 111 and a second video transmission interface 112, which are communicatively connected to the first video source 12 and the second video source 13, respectively. Therefore, the first video source 12 can send video data (i.e., first video data) to the first electronic device 11 through the first video transmission interface 111, and the second video source 13 can send video data (i.e., second video data) to the first electronic device 11 through the second video transmission interface 112.

[0036] For example, the first video transmission interface 111 can be a High Definition Multimedia Interface (HDMI), a Video Graphics Array (VGA) interface, or a Universal Serial Bus (USB) interface, etc. Furthermore, when the first video source 12 sends video data to the first electronic device 11 via wireless screen sharing, the first video transmission interface 111 can be a wireless network card. This application embodiment does not limit the type of the first video transmission interface 111. The above description also applies to the second video transmission interface 112, and will not be detailed here.

[0037] like Figure 2 As shown, the video playback method executed by the first electronic device 11 may include the following steps:

[0038] S201, receive the first video data sent by the first video source 12, store the first video data in the first buffer, receive the second video data sent by the second video source 13, and store the second video data in the second buffer.

[0039] In this step, the first video source 12 and the second video source 13 can be video capture devices, such as cameras. Video capture devices obtain video data by capturing video from the outside world. The first video source 12 and the second video source 13 can also be electronic devices capable of storing video data, such as mobile phones or computers.

[0040] The first video source 12 can send first video data to the first electronic device 11 through the first video transmission interface 111. After receiving the first video data, the first electronic device 11 can store it in a first buffer. Similarly, the second video source 13 can send second video data to the first electronic device 11 through the second video transmission interface 112. After receiving the second video data, the first electronic device 11 can store it in a second buffer. The first buffer and the second buffer are different buffers.

[0041] A buffer is a pre-reserved storage space in memory used for temporary storage of input or output data. A buffer can be created temporarily when needed and destroyed when no longer required.

[0042] For example, video data can be video frames, which are still images in a video sequence and are the basic unit of video. Video consists of consecutive video frames, each representing a complete image at a certain point in time. During video playback, these video frames are played continuously at a certain rate, thus producing dynamic video effects.

[0043] For example, the first video data is English teaching video data, and the second video data is mathematics teaching video data.

[0044] S202, in response to the first playback request, read the first video data from the first buffer, write the first video data to the virtual camera node, read the first video data from the virtual camera node and play it; the first playback request is the playback request corresponding to the first video transmission interface 111.

[0045] In this step, when a user needs to play the first video data received by the first video transmission interface 111, they can perform a corresponding selection operation, such as clicking the button corresponding to the first video transmission interface 111 on the user interface of the first electronic device 11, thereby generating a playback request (i.e., the first playback request) corresponding to the first video transmission interface 111. After receiving the first playback request, the first electronic device 11 can read the first video data from the first buffer and write the first video data to the virtual camera node, such as... Figure 3 As shown.

[0046] Virtual camera nodes refer to the file interfaces of camera devices connected to the system. In Linux systems, these nodes are usually located in the / dev directory and are represented by specific filenames, such as / dev / vi deo0, / dev / vi deo1, etc.

[0047] The first electronic device 11 may have a video playback application (such as the Teams application) installed on it. The video playback application can read first video data from the virtual camera node and play the first video data. Continuing with the previous example, the user can play an English teaching video by selecting to play the first video data received by the first video transmission interface 111.

[0048] It's important to note that the purpose of the virtual camera node is to interface with the native Camera architecture of the Linux operating system, ensuring compatibility with third-party video playback applications. Here, "Linux operating system" includes both the Linux operating system itself and other operating systems based on the Linux kernel.

[0049] S203, in response to the second playback request, stop reading the first video data from the first buffer, read the second video data from the second buffer, write the second video data to the virtual camera node, read the second video data from the virtual camera node and play it; the second playback request is the playback request corresponding to the second video transmission interface.

[0050] In this step, when the user needs to play the second video data received by the second video transmission interface 112, they can perform a corresponding selection operation, such as clicking the button corresponding to the second video transmission interface 112 on the user interface of the first electronic device 11, thereby generating a playback request (i.e., a second playback request) corresponding to the second video transmission interface. After receiving the second playback request, the first electronic device 11 can stop reading the first video data from the first buffer, start reading the second video data from the second buffer, and write the second video data to the virtual camera node, such as... Figure 4 As shown.

[0051] Then, the video playback application can read the second video data from the virtual camera node and play it. Continuing with the previous example, the user can play a math teaching video by selecting to play the second video data received by the second video transmission interface 112.

[0052] In one specific implementation, the first electronic device 11 can create a first process and a second process. In response to a first playback request, the first electronic device 11 can write 00 (00 represents the first video transmission interface 111) to the corresponding register flag bit. The first process and the second process can poll to read the value in the flag bit. After reading the value 00 in the flag bit, the first process can read the first video data in the first buffer corresponding to the first video transmission interface 111 and write it to the virtual camera node. Similarly, in response to a second playback request, the first electronic device 11 can write 01 (01 represents the second video transmission interface) to the corresponding register flag bit. The first process and the second process can poll to read the value in the flag bit. After reading the value 01 in the flag bit, the second process can read the second video data in the second buffer corresponding to the second video transmission interface and write it to the virtual camera node.

[0053] During the switching of video sources, since there is no need to switch virtual camera nodes, the video data can be played continuously, thus avoiding problems such as video playback stuttering and black screen, and effectively improving video playback quality.

[0054] It should be noted that, Figure 1The number of video sources shown is for illustrative purposes only and does not impose any limitation on the number of video sources. There may also be three or more video sources.

[0055] This application provides a video playback method in which first video data sent from a first video source is stored in a first buffer, and second video data sent from a second video source is stored in a second buffer. When switching from the first video source to the second video source, the writing of the first video data in the first buffer to the virtual camera node is stopped, and the second video data is written to the virtual camera node and then played. In this way, when switching video sources, there is no need to switch the virtual camera node, thus enabling continuous playback of video data and avoiding problems such as video playback stuttering and black screens, effectively improving video playback quality.

[0056] In some embodiments of this application, the first video data can be compressed video data. Specifically, the first video source 12 can compress the acquired raw video data according to a specific video encoding standard to remove redundant information from the raw video data and generate the first video data. Then, the first video source 12 can send the first video data to the first electronic device 11. This can reduce the file size of the first video data and reduce the network bandwidth required for transmission. Exemplary video encoding standards include H.264, H.265, VP9, ​​etc.

[0057] After receiving the first video data sent by the first video source 12, the first electronic device 11 can decode the first video data to obtain decoded first video data. Then, the decoded first video data is stored in a first buffer. In this way, the video playback application can directly play the decoded first video data in subsequent processes.

[0058] For example, the decoded first video data can be video data in YUV format or video data in RGB format.

[0059] It should be noted that the second video data can also be compressed video data. For details, please refer to the relevant description of the first video data, which will not be elaborated here.

[0060] In some embodiments of this application, step S201, receiving the first video data sent by the first video source 12 and storing the first video data in the first buffer, may include: receiving the first video data sent by the first video source 12 through the first video transmission interface 111; obtaining the first identifier of the first video transmission interface 111; determining the address of the first buffer according to the first identifier and a preset mapping table; the mapping table includes the mapping relationship between the first identifier and the address of the first buffer; and storing the first video data in the first buffer according to the address of the first buffer.

[0061] In this embodiment, when creating the first buffer, the first electronic device 11 can establish a mapping relationship between the address of the first buffer and the first identifier of the first video transmission interface 111, and store it in a mapping table. When receiving first video data sent by the first video source 12 through the first video transmission interface 111, the first electronic device 11 can obtain the first identifier of the first video transmission interface 111. The first identifier of the first video transmission interface 111 can specifically be the port number of the first video transmission interface 111. Since the port number of the video transmission interface is unique, different video transmission interfaces can be distinguished by the port number.

[0062] Then, the first electronic device 11 can determine the address of the first buffer according to the aforementioned mapping table. The first electronic device 11 can then store the first video data into the first buffer based on that address. In this way, the first electronic device 11 can accurately store the first video data received by the first video transmission interface 111 into the first buffer, thereby avoiding incorrect storage.

[0063] It should be noted that the first electronic device 11 can also use the same method when receiving the second video data sent by the second video source 13 and storing the second video data in the second buffer, which will not be described in detail here.

[0064] In some embodiments of this application, step S202, which involves reading first video data from the first buffer in response to a first playback request, may include: receiving the first playback request; parsing the first identifier of the first video transmission interface 111 from the first playback request; determining the address of the first buffer based on the first identifier and the mapping table; and reading the first video data from the first buffer based on the address of the first buffer.

[0065] In this embodiment, the first playback request may include a first identifier of the first video transmission interface 111. After receiving the first playback request, the first electronic device 11 can parse the first identifier of the first video transmission interface 111 from the first playback request.

[0066] Then, the first electronic device 11 can determine the address of the first buffer based on the first identifier and the aforementioned mapping table. The first electronic device 11 can then read the first video data from the first buffer based on the address of the first buffer, thereby achieving accurate reading and avoiding the occurrence of reading incorrect video data.

[0067] It should be noted that the first electronic device 11 can also read the second video data from the second buffer in response to the second playback request using the same method, which will not be described in detail here.

[0068] In some embodiments of this application, the step S202 of writing the first video data to the virtual camera node may include: obtaining the file descriptor of the virtual camera node; and writing the first video data to the virtual camera node according to the file descriptor of the virtual camera node.

[0069] In this embodiment, a file descriptor is a unique identifier for files, streams, and other input / output resources in the Linux operating system. A file descriptor can be viewed as a pointer to a file; through the file descriptor, the Linux operating system can perform read and write operations on the file pointed to by the file descriptor, realizing data input and output. In the Linux operating system, a virtual camera node can also be considered a file.

[0070] When creating a virtual camera node, the first electronic device 11 can allocate a corresponding file descriptor for the virtual camera node. Then, when writing the first video data to the virtual camera node, the first electronic device 11 can first obtain the file descriptor of the virtual camera node, and then write the first video data to the virtual camera node according to the file descriptor of the virtual camera node.

[0071] Furthermore, file descriptors allow multiple processes to access the same file simultaneously, ensuring data consistency and security. In a more specific implementation, a file structure (struct file) can obtain the file descriptor of the virtual camera node. The first electronic device 11 can establish socket communication between the file structure and the first process, and between the file structure and the first process. Then, based on the established socket communication, the file structure can send the file descriptor to both the first and second processes. The first process can write first video data to the virtual camera node according to the file descriptor. Similarly, the second process can write second video data to the virtual camera node according to the file descriptor.

[0072] The following are embodiments of the apparatus described in this application, which can be used to execute the embodiments of the method described in this application. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the method described in this application.

[0073] Figure 5 A video playback device 5 provided in this application embodiment is disposed in a first electronic device. The first video transmission interface of the first electronic device is connected to a first video source, and the second video transmission interface of the first electronic device is connected to a second video source. The first electronic device includes a virtual camera node.

[0074] The video playback device 5 may include:

[0075] The storage module 51 is used to receive first video data sent by the first video source, store the first video data in the first buffer, receive second video data sent by the second video source, and store the second video data in the second buffer.

[0076] The first playback module 52 is used to respond to the first playback request by reading the first video data from the first buffer, writing the first video data to the virtual camera node, reading the first video data from the virtual camera node and playing it; the first playback request is the playback request corresponding to the first video transmission interface.

[0077] The second playback module 53 is used to respond to the second playback request by stopping reading the first video data from the first buffer, reading the second video data from the second buffer, writing the second video data to the virtual camera node, reading the second video data from the virtual camera node, and playing it; the second playback request is the playback request corresponding to the second video transmission interface.

[0078] This application provides a video playback device that stores first video data sent from a first video source in a first buffer and second video data sent from a second video source in a second buffer. When switching from the first video source to the second video source, writing the first video data in the first buffer to a virtual camera node is stopped, and the second video data is read from the virtual camera node and played. In this way, switching video sources does not require switching the virtual camera node, thus enabling continuous playback of video data and avoiding problems such as video playback stuttering and black screens, effectively improving video playback quality.

[0079] The video playback device 5 provided in this application embodiment can execute the method in any of the foregoing embodiments. Its implementation principle and technical effect are similar, and will not be described again here.

[0080] like Figure 6As shown, this application also provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and when the computer program is executed by the processor, it can implement the video playback method described above. For details, please refer to the description of the foregoing embodiments. This electronic device can be the first electronic device 11 described above.

[0081] Specifically, at the hardware level, the electronic device may include a processor, an internal bus, and memory. The memory may include main memory and non-volatile memory. The processor reads the corresponding computer program from the non-volatile memory into main memory and then executes it. Those skilled in the art will understand that... Figure 6 The structure shown is for illustrative purposes only and does not limit the structure of the electronic device described above. For example, the electronic device may also include components that are larger than... Figure 6 The components shown may include more or fewer components, such as other processing hardware like a GPU (Graphics Processing Unit) or external communication ports. Of course, this application does not exclude other implementation methods besides software implementations, such as logic devices or a combination of hardware and software.

[0082] In this embodiment, the processor may include a central processing unit (CPU) or a graphics processing unit (GPU), and may also include other microcontrollers, logic gates, integrated circuits, or appropriate combinations thereof with logic processing capabilities. The memory described in this embodiment can be a storage device for storing information. In digital systems, a device capable of storing binary data can be a memory; in integrated circuits, a circuit without physical form but with storage function can also be a memory, such as RAM, FIFO, etc.; in a system, a storage device with physical form can also be called a memory, etc. In implementation, this memory can also be implemented using a cloud storage method; the specific implementation method is not limited in this specification.

[0083] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, can implement the video playback method described above for the first electronic device 11.

[0084] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0085] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A video playback method, characterized in that, It is applied to a first electronic device, wherein the first video transmission interface of the first electronic device is connected to a first video source, and the second video transmission interface of the first electronic device is connected to a second video source; The first electronic device includes a virtual camera node; The method includes: Receive first video data sent by the first video source, store the first video data in a first buffer, receive second video data sent by the second video source, and store the second video data in a second buffer; In response to the first playback request, the first video data is read from the first buffer and written to the virtual camera node. The first video data is then read from the virtual camera node and played. The first playback request is the playback request corresponding to the first video transmission interface. In response to the second playback request, the reading of the first video data from the first buffer is stopped, the second video data is read from the second buffer, and the second video data is written to the virtual camera node. The second video data is then read from the virtual camera node and played. The second playback request is the playback request corresponding to the second video transmission interface.

2. The method according to claim 1, characterized in that, The first video data is compressed and encoded video data; Receiving first video data sent by the first video source and storing the first video data in a first buffer includes: Receive the first video data sent by the first video source, and decode the first video data to obtain the decoded first video data; The decoded first video data is stored in the first buffer.

3. The method according to claim 1, characterized in that, Receiving the first video data sent by the first video source and storing the first video data in the first buffer includes: Receive the first video data sent by the first video source through the first video transmission interface; Obtain the first identifier of the first video transmission interface; The address of the first buffer is determined based on the first identifier and a preset mapping table; the mapping table includes the mapping relationship between the first identifier and the address of the first buffer. The first video data is stored in the first buffer according to the address of the first buffer.

4. The method according to claim 3, characterized in that, The step of reading the first video data from the first buffer in response to the first playback request includes: Receive a first playback request, and parse the first identifier of the first video transmission interface from the first playback request; The address of the first buffer is determined based on the first identifier and the mapping table; The first video data is read from the first buffer based on the address of the first buffer.

5. The method according to claim 1, characterized in that, Writing the first video data to the virtual camera node includes: Obtain the file descriptor of the virtual camera node; The first video data is written to the virtual camera node according to the file descriptor of the virtual camera node.

6. The method according to claim 3 or 4, characterized in that, The first identifier is the port number.

7. A video playback device, characterized in that, The first electronic device is configured in a first electronic device, wherein the first video transmission interface of the first electronic device is connected to a first video source, and the second video transmission interface of the first electronic device is connected to a second video source. The first electronic device includes a virtual camera node; The device includes: The storage module is used to receive first video data sent by the first video source, store the first video data in a first buffer, and receive second video data sent by the second video source, store the second video data in a second buffer. The first playback module is configured to respond to a first playback request by reading the first video data from the first buffer, writing the first video data to the virtual camera node, reading the first video data from the virtual camera node, and playing it; the first playback request is a playback request corresponding to the first video transmission interface. The second playback module is configured to, in response to a second playback request, stop reading the first video data from the first buffer, read the second video data from the second buffer, write the second video data to the virtual camera node, and read and play the second video data from the virtual camera node; the second playback request is a playback request corresponding to the second video transmission interface.

8. An electronic device comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it causes the electronic device to implement the method as described in any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 6.