Video switching method and device
By judging the size change of network video files in the display terminal, automatically switching to local video solves the problem of live video network interruption in rail transit, improving user experience and video switching efficiency.
Patent Information
- Application Number
- CN202411006662.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-25
- Publication Date
- 2024-10-01
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In rail transit, live video is highly dependent on the network. When the network connection is interrupted or the streaming media server stops sending video data, the display terminal needs to manually switch to playing local video, which affects the passenger experience.
By creating a target data file for storing network videos in the display terminal, it is determined whether the file size changes within a preset time interval. If the file size does not change, it will automatically switch to the local video to avoid manual switching.
It realizes automatic switching to local video playback when the network connection is interrupted or the streaming media server stops sending videos, which improves user experience and video switching efficiency and shortens interruption time.
Smart Images

Figure CN118741020A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a video switching method. The present invention also relates to a video switching device, a computing device, a computer-readable storage medium, and a computer program product. Background Art
[0002] The PIS (Passenger Information System) system belongs to rail transit communication equipment. It mainly includes multimedia network equipment, display terminals, control systems, communication equipment, etc. The display terminal is used to display information to passengers. The display terminal mainly displays train information, text information, video information, etc. Video information includes different video sources, such as local video, cable TV video, etc. For the display terminal, different videos are mainly divided into two categories, one is local video and the other is live video. Live video is used most of the time during train operation, but live video is highly dependent on the network. When the network connection is interrupted or the streaming media server stops sending video data, the display terminal will stay at the last frame interface. It is necessary to manually switch to playing local video, which affects the passenger experience. Therefore, there is an urgent need for a method to solve the above technical problems, which is crucial for the display terminal to realize automatic video switching function. Summary of the invention
[0003] In view of this, the embodiments of this specification provide a video switching method. One or more embodiments of this specification also relate to a video switching device, a computing device, a computer-readable storage medium and a computer program product to solve the technical defects existing in the prior art.
[0004] According to a first aspect of an embodiment of this specification, a video switching method is provided, including:
[0005] Determine a target file size of a target data file and a video type of a current video, wherein the target data file is used to store network video data of a network video;
[0006] Determining whether the size of the target file changes within a preset time interval;
[0007] When the video type of the current video is an online video and the size of the target file does not change, the local video to be played is played.
[0008] According to a second aspect of an embodiment of this specification, a video switching device is provided, including:
[0009] A determination module is configured to determine a target file size of a target data file and a video type of a current video, wherein the target data file is used to store network video data of a network video;
[0010] A determination module is configured to determine whether the size of the target file changes within a preset time interval;
[0011] The playing module is configured to play the local video to be played when the video type of the current video is an online video and the size of the target file has not changed.
[0012] According to a third aspect of an embodiment of this specification, a video switching method is provided, which is applied to a train control center, including:
[0013] Determine a target file size of a target data file and a video type of a current video, wherein the target data file is used to store network video data of a network video;
[0014] Determining whether the size of the target file changes within a preset time interval;
[0015] When the video type of the current video is an online video and the size of the target file does not change, determining a local video to be played;
[0016] The local video to be played is output to a display terminal.
[0017] According to a fourth aspect of the embodiments of this specification, a video switching device is provided, which is applied to a train control center, including:
[0018] A file determination module is configured to determine a target file size of a target data file and a video type of a current video, wherein the target data file is used to store network video data of a network video;
[0019] A file determination module, configured to determine whether the size of the target file changes within a preset time interval;
[0020] A video determination module, configured to determine a local video to be played when the video type of the current video is an online video and the size of the target file does not change;
[0021] The output module is configured to output the local video to be played to the display terminal.
[0022] According to a fifth aspect of an embodiment of this specification, a computing device is provided, including:
[0023] Memory and processor;
[0024] The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer programs / instructions are executed by the processor, the steps of the above-mentioned video switching method are implemented.
[0025] According to a sixth aspect of the embodiments of this specification, a computer-readable storage medium is provided, which stores a computer program / instruction, and when the computer program / instruction is executed by a processor, the steps of the above-mentioned video switching method are implemented.
[0026] According to a seventh aspect of the embodiments of this specification, a computer program product is provided, including a computer program / instruction, which implements the steps of the above-mentioned video switching method when executed by a processor.
[0027] An embodiment of the present specification realizes the creation of a target data file for storing network video data of a network video, by determining whether the target file size of the target data file changes within a preset time interval. If it changes, it means that the network video data stored in the target data file has changed, that is, the network video has been received; if it does not change, it means that the network video data stored in the target data file has not changed, that is, the network video has not been received or the network video has stopped being sent. At this time, in order to ensure that the video is not interrupted, the local video to be played can be determined in the stored local video and played. Therefore, when the network connection is interrupted or the streaming media server stops sending the network video, the played network video can be automatically switched to the local video, without the need for manual video switching, thereby improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 This is a schematic diagram of an application scenario of a video switching method provided by an embodiment of this specification;
[0029] Figure 2 is a flow chart of a video switching method provided by an embodiment of this specification;
[0030] Figure 3 is a process flow chart of a video switching method provided by an embodiment of the present specification;
[0031] Figure 4 is a structural schematic diagram of a video switching device provided by an embodiment of this specification;
[0032] Figure 5 is a flow chart of another video switching method provided by an embodiment of this specification;
[0033] Figure 6 is a structural schematic diagram of another video switching device provided by an embodiment of this specification;
[0034] Figure 7 It is a structural block diagram of a computing device provided by an embodiment of this specification. DETAILED DESCRIPTION
[0035] Many specific details are described in the following description to facilitate a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of this specification, so this specification is not limited to the specific implementation disclosed below.
[0036] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.
[0037] It should be understood that although the terms first, second, etc. may be used to describe various information in one or more embodiments of this specification, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0038] In addition, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of this specification are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0039] First, the terms involved in one or more embodiments of this specification are explained.
[0040] PIS: Passenger Information System, passenger information system, it is an information service system based on multimedia network technology and with computer system as the core.
[0041] UDP (User Datagram Protocol) multicast port: It is an important identifier in multicast communication. It helps data reach the correct services and applications, and also allows multiple services to coexist on the same machine and handle different multicast streams.
[0042] Tcpdump: is a command-line network analysis tool widely used on Unix and Linux operating systems for capturing (packet capture) and analyzing network traffic. It is a network packet sniffer that can monitor and record data packets passing through a network interface, helping network administrators, developers, and security experts diagnose network problems, analyze network protocols, monitor network activities, and troubleshoot problems.
[0043] UDP socket: is an abstract concept that represents an endpoint or programming interface in network communication. In computer network programming, a socket allows a program to send or receive data across a network.
[0044] The PIS system is a rail transit communication equipment. It mainly includes multimedia network equipment, display terminals, control systems, communication equipment, etc. The display terminal is used to display information to passengers. The display terminal mainly displays train information, text information, video information, etc. Video information includes different video sources, such as local video, cable TV video, etc. For the display terminal, different videos are mainly divided into two categories, one is local video and the other is live video. Live video is used most of the time during train operation, but live video is highly dependent on the network. When the network connection is interrupted or the streaming media server stops sending video data, the display terminal will stay on the last frame interface. It is necessary to manually switch to playing local video, which affects the passenger experience.
[0045] In this specification, a video switching method is provided. This specification also relates to a video switching device, a computing device, a computer-readable storage medium and a computer program product, which are described in detail one by one in the following embodiments.
[0046] See also Figure 1 , Figure 1 FIG. 1 is a schematic diagram showing an application scenario of a video switching method provided according to an embodiment of the present specification. Figure 1 As shown, the train driving scenario is used as an example for explanation. In the actual application of the train driving scenario, multiple display devices are often installed in the train compartments to play videos to passengers. The videos played to passengers through the display devices include different video sources, such as local videos, cable TV videos, online transmission videos or live broadcast videos. During the operation of the train, live videos, online transmission videos, etc. sent by the streaming media server are often played to passengers first ( Figure 1Taking live video as an example), when the playback of live video sent by the streaming media server, online transmission video, etc. is interrupted or completed, the played video is switched to the local video stored in the display device, thereby ensuring the continuous playback of the video on the display device.
[0047] Based on this, in the video switching method provided in this specification, a file for storing video data such as live video or online transmission video sent by a streaming media server can be created in the display device, and by judging whether the file size of the file has changed, it can be determined whether the display device continues to receive the video data sent by the streaming media server. If the file size of the file has not changed, it means that the video data sent by the streaming media server is interrupted and the display device has not received the video data. At this time, the display device can determine the local video to be played from the stored local video. If the file size of the file has changed, it means that the display device continues to receive the video data sent by the streaming media server. At this time, the display device continues to play the video corresponding to the video data sent by the streaming media server.
[0048] The video switching method provided in this specification determines whether the display device has received the video data sent by the streaming media server by judging whether the file size used to store the video data sent by the streaming media server has changed, and further determines whether video switching is required. In this way, when the video data received by the display device is interrupted, the local video is automatically switched for playback without manual switching, thereby improving the efficiency of video switching. Moreover, the display device automatically switches the video, which can shorten the interruption time after the video is interrupted and improve the user experience of users watching videos.
[0049] It should be noted that the above train running scene is only used as an example to explain the video switching method, and the video switching method is not limited to the above train running scene. The video switching method can also be applied to waiting room scenes, train entry scenes, and scenes of watching network videos using a client. For example, a streaming media server can send live video to a display device in a waiting room or a display device next to a train track, and the display device switches the video based on the above video switching method.
[0050] See also Figure 2 , Figure 2 A flowchart of a video switching method provided according to an embodiment of the present specification is shown, which specifically includes the following steps:
[0051] Step 202: Determine a target file size of a target data file and a video type of a current video, wherein the target data file is used to store network video data of a network video.
[0052] In actual applications, live videos or online videos are often highly dependent on the network when being played. When the network connection is interrupted or the sender of the video data stops sending the video data, the video screen of the terminal receiving the video data will remain at the last frame interface. At this time, manual video switching is often required, for example, switching the played video to the local video.
[0053] Based on this, in one or more embodiments provided in this specification, the video switching method is applied to the video data receiver, which may specifically include a client, a server or a train control center. The video data receiver may judge the reception of the video data and automatically switch the video, thereby avoiding manual video switching. In practical applications, the client may specifically include but is not limited to: smart phones, tablet computers, laptops, PDAs, personal computers, smart home devices, vehicle-mounted devices, etc. The server or train control center can be used to collect, process, dispatch and distribute information. In this specification, the train control center is mainly used to receive and process video data, and distribute the video data to display terminals installed in stations, waiting rooms, trains, etc., so that the display terminals can play the video.
[0054] Among them, the target data file refers to a file for storing network video data of network videos. The target data file is stored in the video data recipient, such as a client, a server, or a train control center. The target file size is the file size of the target data file. Network video refers to a video transmitted from a video data sender to a video data recipient and played, which may specifically include online transmission video or live broadcast video. Current video refers to the video currently being played by the video data recipient. Video type refers to the video type of the video, which may specifically include network video or local video.
[0055] Specifically, the video data receiver can determine whether it has received the network video sent by the video data sender by determining the target file size of the target data file stored locally, and determine the video type of the current video currently being played by the video data receiver, so as to determine whether video switching is required or switch the video to a certain video type in the subsequent process.
[0056] Since the target data file for storing the network video data is the basis for obtaining the target file size, before determining the target file size, it is also necessary to create the target data file for storing the network video data.
[0057] In a specific implementation manner provided in this specification, before determining the target file size of the target data file, the method further includes:
[0058] Create a target data file and monitor the network video data of the target multicast port;
[0059] The network video data is stored in the target data file.
[0060] Among them, the target multicast port refers to the multicast port for receiving network video data. The target multicast port can specifically be a UDP multicast port. Specifically, create a target data file, and determine the target multicast port for receiving network video data. Receive the network video data sent by the video data sender by monitoring the target multicast port, and store the network video data in the created target data file. In actual applications, the target multicast port can be monitored by tcpdump software. Specifically, "sudo tcpdump udp port port number -W 1-C 2 -w file name & command" can be used to obtain network video data through the target multicast port.
[0061] The video switching method provided in this specification creates a target data file for storing network video data in the video data receiver, obtains the network video data sent by the video data sender by monitoring the network video data of the target multicast port, and stores the obtained network video data in the target data file, thereby realizing the process of monitoring the target multicast port through the application background running without occupying application resources.
[0062] Step 204: Determine whether the target file size changes within a preset time interval.
[0063] After determining the target file size of the target data file, it is possible to determine whether the video data receiver continues to receive network video data within the preset time interval by judging whether the target file size changes within the preset time interval. In actual applications, the preset time interval can be customized in advance, for example, the preset time interval is set to 2s, 3s, 5s, etc. The setting of the preset time interval can be set according to the actual application situation. For example, to prevent the screen from freezing when the video is switched, the preset time interval can be set shorter, such as 1s, 2s, etc.; to prevent the video data receiver from misjudging the target file size within the preset time interval, resulting in video switching errors, the preset time interval can be set longer, for example, 3s, 5s, etc. This manual does not limit the specific setting of the preset time interval.
[0064] Step 206: When the video type of the current video is an online video and the size of the target file has not changed, the local video to be played is played.
[0065] After determining the change in the target file size of the target data file and determining the video type of the video currently played by the video data recipient, it can be determined whether video switching is required and the video type that requires video switching based on the change in the target file size and the video type of the current video.
[0066] Specifically, if it is determined that the video type of the current video is an online video and it is determined that the target file size has not changed, it means that the online video data received by the video data receiver is interrupted or received, and the currently played online video needs to be switched to a local video.
[0067] The local video to be played refers to the local video waiting to be played after the video is switched. Since a large number of local videos are often stored in the local storage space of the video data receiver, after determining that the current video needs to be switched to the local video, it is necessary to determine the video to be played after the video is switched from the large number of local videos.
[0068] In a specific implementation manner provided in this specification, playing a local video to be played includes:
[0069] Searching for an initial local video in a local video collection, and determining whether the initial local video has been played;
[0070] In the case that the initial local video has not been played completely, determining the initial local video as the local video to be played, and playing the initial local video;
[0071] When the initial local video is played, a local video to be played is determined in the local video set, and the local video to be played is played.
[0072] The local video set refers to a set for storing local videos, and the initial local video refers to the local video played before switching to the network video.
[0073] In actual applications, since network video, i.e., online transmission video or live video, is highly dependent on the network, after receiving the network video data through the target multicast port, the video data receiver will give priority to switching the current video to the network video for playback. Therefore, when the current video is switched to the network video, the playback of the current video may be interrupted. Based on this, the video to be played after the video is switched again can be determined according to the playback status of the initial local video.
[0074] Specifically, after determining that the video type of the current video is a network video and determining that the target file size has not changed, the initial local video can be queried in the local video collection, and it can be determined whether the initial local video has been played when the initial local video is switched. If it is determined that the initial local video has not been played, the initial local video can be determined as the local video to be played, and the initial local video can continue to be played, that is, the local video to be played can continue to be played. If it is determined that the initial local video has been played, the local video to be played can be re-determined in the local video collection, and the re-determined local video to be played can be played. It should be noted that the re-determined local video to be played can be the initial local video that has been played, or it can be other local videos in the local video collection except the initial local video.
[0075] For example, if the current video is network video V1, and before playing network video V1, the local video played is local video V2, and if it is determined that the target file size has not changed, that is, the playback of network video V1 is interrupted or finished, then the local video V2 is queried in the local video collection, and it is determined whether the local video V2 has been played before playing network video V1. If the local video V2 has not been played, the local video V2 can be played after the local video V2 is queried; if the local video V2 has been played, the local video V3 to be played can be re-determined in the local video collection for playback, or the local video V2 can be played again.
[0076] In the video switching method provided in this specification, by determining the playback status of the initial local video, the local video to be played that needs to be played is further determined in the local video set, and the integrity of the local video playback is guaranteed on the basis of video switching.
[0077] In a specific implementation provided in this specification, the method further includes:
[0078] When the video type of the current video is an online video and the size of the target file changes, the current video continues to be played.
[0079] Specifically, if it is determined that the video type of the current video is a network video, and it is determined that the target file size has changed, it means that the video data receiver is continuously receiving the network video data sent by the video data sender, and there is no need to switch the currently played network video, and the current network video can be continued to be played. It should be noted that when the video data receiver is a server or a train control center, since the server and the train control center do not have the function of video playback, it is also necessary to output the video waiting to be played to the corresponding display terminal so that the display terminal can play the video waiting to be played. In actual applications, the display terminal can specifically be a display, a display screen, etc.
[0080] Furthermore, the video type of the current video may also be a local video, that is, the video data recipient is currently playing a local video. At this time, it is also possible to determine whether the video data recipient has received the network video data based on the target file size and switch the currently playing local video.
[0081] In a specific implementation provided in this specification, the method further includes:
[0082] When the video type of the current video is a local video and the size of the target file changes, playing the target network video corresponding to the network video data;
[0083] When the video type of the current video is a local video and the size of the target file has not changed, the current video continues to be played.
[0084] The target network video refers to a network video composed of network video data received by a video data receiver, and is used for playing at the video data receiver or a display terminal of the video data receiver.
[0085] Specifically, if it is determined that the video type of the current video is a local video, and it is determined that the target file size has changed, it means that the target data file has stored new network video data, that is, the video data receiver has received the network video data. At this time, it is necessary to switch the video of the currently played local video, so the target network video corresponding to the network video data received by the video data receiver can be played. If it is determined that the video type of the current video is a local video, and it is determined that the target file size has not changed, it means that the video data receiver has not received the network video data. At this time, the current local video can continue to be played.
[0086] In one or more embodiments provided in this specification, the target multicast port is monitored by tcpdump software to obtain network video data. Therefore, if no network video data is monitored, the target multicast port can be released so that the target multicast port can continue to be monitored in the subsequent process.
[0087] Therefore, in a specific embodiment provided in this specification, the method further includes:
[0088] When the target file size does not change, the target multicast port is released, and the process returns to the step of monitoring the network video data of the target multicast port.
[0089] If it is determined that the target file size has not changed, it means that the video data receiver has not received the network video data. Therefore, no matter whether the video type of the current video is determined to be a local video or a network video, the target multicast port needs to be released and the target multicast port needs to be listened to again to obtain the network video data. Specifically, after releasing the target multicast port, a UDP socket can be established to receive the network video data, and the tcpdump software can be restarted to continue to listen to the target multicast port, so as to continue to perform the step of storing the obtained network video data in the target data file.
[0090] The video switching method provided in this specification obtains network video data by monitoring the target multicast port, and releases the target multicast port when it is determined that the target file size has not changed, so as to restart the tcpdump software to continue monitoring the target multicast port to obtain new network video data, thereby reducing the occupancy of application resources.
[0091] In actual applications, in order to save the local storage space of the video data receiver, it is also possible to directly determine whether the video data receiver has received the network video data by monitoring the target multicast port, thereby eliminating the need to create a target data file in the local storage space of the video data receiver. The implementation method is as follows:
[0092] In a specific implementation provided in this specification, the method further includes:
[0093] Monitor the target multicast port to see if it receives network video data;
[0094] When the target multicast port receives the network video data, the target network video data corresponding to the network video data is output to the display terminal.
[0095] The display terminal is a display terminal used by the video data receiver to play the video, which can be a display or a display screen, etc. For example, if the video data receiver is a client (taking a laptop as an example), the corresponding display terminal is the display screen of the laptop; for another example, if the video data receiver is a server (taking a desktop computer host as an example), the corresponding display terminal is a computer display connected to the desktop computer host; for another example, if the video data receiver is a train control center, the corresponding display terminal is a display screen at a station, a display screen in a waiting room, a display screen installed on a train, etc.
[0096] Specifically, you can directly monitor the target multicast port to see if the network video data is obtained. If the target multicast port is monitored to obtain the network video data, the target network video corresponding to the network video data can be output to the display terminal of the video data receiver and played; if the target multicast port is not monitored to obtain the network video data, continue to play the local video.
[0097] Furthermore, since directly monitoring the target multicast port to determine whether the video data receiver has received the network video data will occupy application resources, the above implementation method can be used to determine whether the video data receiver has received the network video data when the application resources are less occupied or sufficient. However, since the target multicast port is monitored directly, the target data file is not created in the local storage space of the video data receiver, and the received network video data is not stored in the target data file, so this implementation method can greatly save local storage space.
[0098] The video switching method provided in this specification includes: determining a target file size of a target data file and a video type of a current video, wherein the target data file is used to store network video data of a network video; judging whether the target file size changes within a preset time interval; and playing a local video to be played when the video type of the current video is a network video and the target file size has not changed.
[0099] An embodiment of the present specification realizes that a target data file for storing network video data of a network video is created in a video data receiver, by judging whether the target file size of the target data file changes within a preset time interval. If it changes, it means that the network video data stored in the target data file has changed, that is, the video data receiver has received the network video; if it does not change, it means that the network video data stored in the target data file has not changed, that is, the video data receiver has not received the network video or the network video sent to the video data receiver has stopped sending. At this time, in order to ensure that the video data receiver can continue to output the video, the local video to be played can be determined in the local video stored by the video data receiver, and played. Thus, when the network connection is interrupted or the video data sender stops sending the network video, the video data receiver can automatically switch the played network video to the local video, without the need for manual video switching, thereby improving the user experience.
[0100] The following combination Figure 3 , taking the application of the video switching method provided in this specification in the automatic switching scenario between live video and local video as an example, the video switching method is further described. Figure 3 FIG. 1 shows a process flow chart of a video switching method provided by an embodiment of the present specification. Figure 3 As shown, Figure 1Taking the train driving scene shown as an example, after the display device is started, the multicast address for playing the multicast live video is set, and the UDP multicast port for receiving the live video data is determined. The train control center starts the tcpdump software, monitors the UDP multicast port, receives the live video data sent by the video data sender (hereinafter referred to as a streaming media server), and stores the received live video data in the pre-created target data file. Determine whether the target file size of the target data file changes within 5s (with the preset time interval of 5s as an example). If so, it means that there is live video data in the monitored UDP multicast port, that is, the train control center receives the live video data sent by the streaming media server. At this time, the live video can be played in the display device through the set multicast address; if not, it means that there is no live video data in the monitored UDP multicast port, that is, the train control center does not receive the live video data sent by the streaming media server. At this time, the local video to be played can be determined in the local video set, and the determined local video to be played can be played in the display device. Furthermore, in the absence of live video data, the UDP multicast port is released, and a UDP socket is established to continue receiving the live video data in the UDP multicast port, and the tcpdump software is restarted to continue monitoring the UDP multicast port to continue executing the step of receiving the live video data and storing it in the target data file.
[0101] One embodiment of the present specification realizes that a target data file for storing live video data of live video is created in the train control center, by judging whether the target file size of the target data file changes within a preset time interval. If it changes, it means that the live video data stored in the target data file has changed, that is, the train control center has received the live video; if it does not change, it means that the live video data stored in the target data file has not changed, that is, the train control center has not received the live video or the live video sent to the train control center has stopped sending. At this time, in order to ensure that the train control center can continue to output video to the display device, the local video to be played can be determined in the local video stored in the train control center, and played in the display device. Thus, when the network connection is interrupted or the streaming media server stops sending live video, the train control center can automatically switch the live video played by the display device to the local video, without manual video switching, thereby improving the user experience. At the same time, the tcpdump software is used to run in the background and monitor the UDP multicast port to reduce the occupation of application resources.
[0102] Corresponding to the above method embodiment, this specification also provides a video switching device embodiment, Figure 4FIG. 2 shows a schematic diagram of the structure of a video switching device provided by an embodiment of the present specification. Figure 4 As shown, the device comprises:
[0103] The determination module 402 is configured to determine a target file size of a target data file and a video type of a current video, wherein the target data file is used to store network video data of a network video;
[0104] The determination module 404 is configured to determine whether the target file size changes within a preset time interval;
[0105] The playing module 406 is configured to play the local video to be played when the video type of the current video is an online video and the size of the target file has not changed.
[0106] Optionally, the device further comprises:
[0107] A monitoring module is configured to create a target data file and monitor network video data of a target multicast port;
[0108] The storage module is configured to store the network video data into the target data file.
[0109] Optionally, the device further comprises:
[0110] A first playing module is configured to play a target network video corresponding to the network video data when the video type of the current video is a local video and the size of the target file changes;
[0111] The second playing module is configured to continue playing the current video when the video type of the current video is a local video and the size of the target file has not changed.
[0112] Optionally, the device further comprises:
[0113] The release module is configured to release the target multicast port when the target file size does not change, and return to the step of monitoring the network video data of the target multicast port.
[0114] Optionally, the device further comprises:
[0115] The third playing module is configured to continue playing the current video when the video type of the current video is an online video and the size of the target file changes.
[0116] Optionally, the playing module 406 is further configured to:
[0117] Searching for an initial local video in a local video collection, and determining whether the initial local video has been played;
[0118] In the case that the initial local video has not been played completely, determining the initial local video as the local video to be played, and playing the initial local video;
[0119] When the initial local video is played, a local video to be played is determined in the local video set, and the local video to be played is played.
[0120] Optionally, the device further comprises:
[0121] A data monitoring module is configured to monitor whether a target multicast port receives network video data;
[0122] The output module is configured to output target network video data corresponding to the network video data to the display terminal when the target multicast port receives the network video data.
[0123] The video switching device provided in this specification includes: a determination module, configured to determine the target file size of a target data file and the video type of a current video, wherein the target data file is used to store network video data of a network video; a judgment module, configured to judge whether the target file size changes within a preset time interval; and a playback module, configured to play a local video to be played when the video type of the current video is a network video and the target file size has not changed.
[0124] An embodiment of the present specification realizes that a target data file for storing network video data of a network video is created in a video data receiver, by judging whether the target file size of the target data file changes within a preset time interval. If it changes, it means that the network video data stored in the target data file has changed, that is, the video data receiver has received the network video; if it does not change, it means that the network video data stored in the target data file has not changed, that is, the video data receiver has not received the network video or the network video sent to the video data receiver has stopped sending. At this time, in order to ensure that the video data receiver can continue to output the video, the local video to be played can be determined in the local video stored by the video data receiver, and played. Thus, when the network connection is interrupted or the video data sender stops sending the network video, the video data receiver can automatically switch the played network video to the local video, without the need for manual video switching, thereby improving the user experience.
[0125] The above is a schematic scheme of a video switching device of this embodiment. It should be noted that the technical scheme of the video switching device and the technical scheme of the above video switching method belong to the same concept, and the details not described in detail in the technical scheme of the video switching device can be referred to the description of the technical scheme of the above video switching method.
[0126] See also Figure 5 , Figure 5 A flowchart of another video switching method provided according to an embodiment of the present specification is shown, which specifically includes the following steps:
[0127] Step 502: Determine a target file size of a target data file and a video type of a current video, wherein the target data file is used to store network video data of a network video.
[0128] Step 504: Determine whether the target file size changes within a preset time interval.
[0129] Step 506: When the video type of the current video is an online video and the target file size has not changed, determine a local video to be played.
[0130] Step 508: Output the local video to be played to a display terminal.
[0131] In a specific implementation provided in this specification, the method further includes:
[0132] When the video type of the current video is an online video and the size of the target file changes, continue to output the current video to the display terminal;
[0133] When the video type of the current video is a local video and the target file size changes, outputting the target network video received based on the target multicast port to the display terminal;
[0134] When the video type of the current video is a local video and the size of the target file has not changed, continue to output the current video to the display terminal.
[0135] It should be noted that the video switching method is a video switching method applied to the above-mentioned video switching method in a train scene, for example, a train running scene, a waiting room scene, a train entering a station scene, etc. The video switching method is applied to a train control center, and its specific implementation process is similar to the above-mentioned video switching method. The specific implementation process of the video switching method can be referred to the implementation process of the above-mentioned video switching method, and this specification will not repeat it here.
[0136] An embodiment of the present specification realizes that a target data file for storing network video data of network video is created in the train control center, by judging whether the target file size of the target data file changes within a preset time interval. If it changes, it means that the network video data stored in the target data file has changed, that is, the train control center has received the network video; if it does not change, it means that the network video data stored in the target data file has not changed, that is, the train control center has not received the network video or the network video sent to the train control center has stopped sending. At this time, in order to ensure that the train control center can continue to output the video, the local video to be played can be determined in the local video stored in the train control center, and the local video to be played can be played in each display terminal corresponding to the train control center. Thereby, when the network connection is interrupted or the sender of the video data stops sending the network video, the train control center can automatically switch the played network video to the local video, without the need for manual video switching, thereby improving the user experience.
[0137] Corresponding to the above method embodiment, this specification also provides a video switching device embodiment, Figure 6 FIG. 2 shows a schematic diagram of the structure of another video switching device provided by an embodiment of the present specification. Figure 6 As shown, the device is applied to a train control center and includes:
[0138] The file determination module 602 is configured to determine a target file size of a target data file and a video type of a current video, wherein the target data file is used to store network video data of a network video;
[0139] The file determination module 604 is configured to determine whether the size of the target file changes within a preset time interval;
[0140] The video determination module 606 is configured to determine the local video to be played when the video type of the current video is an online video and the size of the target file has not changed;
[0141] The output module 608 is configured to output the local video to be played to a display terminal.
[0142] Optionally, the device further includes a video switching and playing module, which is configured to:
[0143] When the video type of the current video is an online video and the size of the target file changes, continue to output the current video to the display terminal;
[0144] When the video type of the current video is a local video and the target file size changes, outputting the target network video received based on the target multicast port to the display terminal;
[0145] When the video type of the current video is a local video and the size of the target file has not changed, continue to output the current video to the display terminal.
[0146] An embodiment of the present specification realizes that a target data file for storing network video data of network video is created in the train control center, by judging whether the target file size of the target data file changes within a preset time interval. If it changes, it means that the network video data stored in the target data file has changed, that is, the train control center has received the network video; if it does not change, it means that the network video data stored in the target data file has not changed, that is, the train control center has not received the network video or the network video sent to the train control center has stopped sending. At this time, in order to ensure that the train control center can continue to output the video, the local video to be played can be determined in the local video stored in the train control center, and the local video to be played can be played in each display terminal corresponding to the train control center. Thereby, when the network connection is interrupted or the sender of the video data stops sending the network video, the train control center can automatically switch the played network video to the local video, without the need for manual video switching, thereby improving the user experience.
[0147] The above is a schematic scheme of another video switching device of this embodiment. It should be noted that the technical scheme of the video switching device and the technical scheme of the above video switching method belong to the same concept, and the details not described in detail in the technical scheme of the video switching device can be referred to the description of the technical scheme of the above video switching method.
[0148] Figure 7 The structure block diagram of a computing device 700 provided according to an embodiment of the present specification is shown. The components of the computing device 700 include but are not limited to a memory 710 and a processor 720. The processor 720 is connected to the memory 710 via a bus 730, and the database 750 is used to store data.
[0149] The computing device 700 also includes an access device 740, which enables the computing device 700 to communicate via one or more networks 760. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 740 may include one or more of any type of network interface (e.g., a network interface card (NIC)) of wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a world-wide interoperability for microwave access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC) interface, and the like.
[0150] In one embodiment of the present specification, the above components of the computing device 700 and Figure 7 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Figure 7 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.
[0151] The computing device 700 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 700 may also be a mobile or stationary server.
[0152] The processor 720 implements the steps of the video switching method when executing the computer program / instructions.
[0153] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the above video switching method belong to the same concept, and the details not described in detail in the technical scheme of the computing device can be referred to the description of the technical scheme of the above video switching method.
[0154] An embodiment of the present specification further provides a computer-readable storage medium storing a computer program / instruction. When the computer program / instruction is executed by a processor, the steps of the video switching method described above are implemented.
[0155] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the above video switching method belong to the same concept, and the details not described in detail in the technical scheme of the storage medium can be referred to the description of the technical scheme of the above video switching method.
[0156] An embodiment of the present specification also provides a computer program product, including a computer program / instruction, which implements the steps of the above-mentioned video switching method when executed by a processor.
[0157] The above is a schematic solution of a computer program product of this embodiment. It should be noted that the technical solution of the computer program product and the technical solution of the above video switching method belong to the same concept, and the details not described in detail in the technical solution of the computer program product can be referred to the description of the technical solution of the above video switching method.
[0158] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0159] The computer program / instruction includes a computer program code, which may be in source code form, object code form, executable file or some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc.
[0160] It should be noted that, for the convenience of description, the aforementioned method embodiments are all described as a series of action combinations, but those skilled in the art should be aware that this specification is not limited by the order of the actions described, because according to this specification, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this specification.
[0161] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0162] The preferred embodiments of this specification disclosed above are only used to help explain this specification. The optional embodiments do not describe all the details in detail, nor do they limit the invention to only the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of this specification, so that technicians in the relevant technical field can well understand and use this specification. This specification is limited only by the claims and their full scope and equivalents.
Claims
1. A video switching method, characterized in that: include: Determine a target file size of a target data file and a video type of a current video, wherein the target data file is used to store network video data of a network video; Determining whether the size of the target file changes within a preset time interval; When the video type of the current video is an online video and the size of the target file does not change, the local video to be played is played.
2. The method according to claim 1, characterized in that Before determining the target file size of the target data file, the method further includes: Create a target data file and monitor the network video data of the target multicast port; The network video data is stored in the target data file.
3. The method according to claim 1, characterized in that The method further comprises: When the video type of the current video is a local video and the size of the target file changes, playing the target network video corresponding to the network video data; When the video type of the current video is a local video and the size of the target file has not changed, the current video continues to be played.
4. The method according to claim 3, characterized in that The method further comprises: When the target file size does not change, the target multicast port is released, and the process returns to the step of monitoring the network video data of the target multicast port.
5. The method according to claim 1, characterized in that The method further comprises: When the video type of the current video is an online video and the size of the target file changes, the current video continues to be played.
6. The method according to claim 1, characterized in that Play the local video to be played, including: Searching for an initial local video in a local video collection, and determining whether the initial local video has been played; In the case that the initial local video has not been played completely, determining the initial local video as the local video to be played, and playing the initial local video; When the initial local video is played, a local video to be played is determined in the local video set, and the local video to be played is played.
7. The method according to claim 1, characterized in that The method further comprises: Monitor the target multicast port to see if it receives network video data; When the target multicast port receives the network video data, the target network video data corresponding to the network video data is output to the display terminal.
8. A video switching method, characterized in that: Applied in train control centers, including: Determine a target file size of a target data file and a video type of a current video, wherein the target data file is used to store network video data of a network video; Determining whether the size of the target file changes within a preset time interval; When the video type of the current video is an online video and the size of the target file does not change, determining a local video to be played; The local video to be played is output to a display terminal.
9. The method according to claim 8, characterized in that The method further comprises: When the video type of the current video is an online video and the size of the target file changes, continue to output the current video to the display terminal; When the video type of the current video is a local video and the target file size changes, outputting the target network video received based on the target multicast port to the display terminal; When the video type of the current video is a local video and the size of the target file has not changed, continue to output the current video to the display terminal.
10. A video switching device, characterized in that: include: A determination module is configured to determine a target file size of a target data file and a video type of a current video, wherein the target data file is used to store network video data of a network video; A determination module is configured to determine whether the size of the target file changes within a preset time interval; The playing module is configured to play the local video to be played when the video type of the current video is an online video and the size of the target file has not changed.
11. A video switching device, characterized in that: Applied in train control centers, including: A file determination module is configured to determine a target file size of a target data file and a video type of a current video, wherein the target data file is used to store network video data of a network video; A file determination module, configured to determine whether the size of the target file changes within a preset time interval; A video determination module, configured to determine a local video to be played when the video type of the current video is an online video and the size of the target file does not change; The output module is configured to output the local video to be played to the display terminal.
12. A computing device comprising: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. It is characterized in that when the computer program / instructions are executed by the processor, the steps of the method described in any one of claims 1 to 9 are implemented.
13. A computer-readable storage medium storing a computer program / instruction, characterized in that: When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.
14. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.
Citation Information
Patent Citations
Systems and methods for switching from streaming content to local content
CN102265578A
Vehicle-mounted equipment and music playing method and playing device thereof
CN103093790A
Unmanned aerial vehicle video playing device and method
CN107306359A
Video lagging detection method and device
CN110300326A
Video code stream adjusting method, device and system
CN114222194A
