A network media device status judgment method, system, device and medium

Through the network media device status judging method based on ffprobe, the metadata of the device is analyzed to determine the online status, solving the problems of inaccurate judgment and lack of universality in the prior art, and achieving efficient and accurate device status judgment.

CN118487970BActive Publication Date: 2025-02-25BEIJING SINOITS TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410670288.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-28
Publication Date
2025-02-25
Estimated Expiration
2044-05-28

AI Technical Summary

Technical Problem

When judging the status of network media devices, the prior art cannot accurately reflect the real status of the device, and lacks universality, so different SDKs are needed for different manufacturers or types of devices.

Method used

Using the ffprobe-based network media device status judging method, by configuring the ffprobe command and sending command line parameters and streaming address to the device, the metadata feedback from the device contains the streams keyword to determine the online status of the device.

Benefits of technology

It improves the efficiency of judging the status of network media devices, can accurately judge scenarios where the device can be connected but cannot be used normally, reduces the probability of accessing abnormal devices, and improves the user's device utilization efficiency and video surveillance experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118487970B_ABST
    Figure CN118487970B_ABST
Patent Text Reader

Abstract

The present invention discloses a network media device status judgment method, system, device and medium, and relates to the network device and streaming media technology field. The method comprises: configuring an ffprobe command for judging the network media device status, and sending command line parameters corresponding to the ffprobe command and a stream pulling address to the network media device to be judged; judging whether the metadata fed back by the network media device to be judged contains the streams keyword according to the stream pulling address, and determining whether the network media device to be judged is online according to the judgment result. The present invention can reduce the probability of accessing abnormal devices and improve the efficiency of users using devices and video monitoring experience.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0002] There are usually two ways to determine the status of a device. The first is to use ping to see if the other party responds to the ping. The second is to access the SDK provided by the device or write an access module to pull the stream, actively query or device callback to see if it is online. Both methods have some disadvantages. The first method cannot accurately reflect the actual status of the device, and the second method cannot be universal. Each manufacturer or type of device needs to access the SDK, which is not universal. Summary of the invention

[0003] The technical problem to be solved by the present invention is to address the deficiencies of the prior art and specifically provide a method, system, device and medium for determining the status of a network media device, as follows:

[0004] 1) In the first aspect, the present invention provides a method for determining the status of a network media device based on ffprobe, and the specific technical solution is as follows:

[0005] Configure an ffprobe command for determining the status of a network media device, and send command line parameters corresponding to the ffprobe command and a streaming address to the network media device to be determined;

[0006] According to the streaming address, a judgment is made as to whether the metadata fed back by the network media device to be judged contains the streams keyword, and based on the judgment result, it is determined whether the network media device to be judged is in an online state, wherein the metadata is data obtained when the network media device to be judged executes the command line parameters.

[0007] The beneficial effects of the network media device status determination method based on ffprobe provided by the present invention are as follows:

[0008] By pre-configuring the ffprobe command, the efficiency of judging the status of network media devices is improved, and metadata is used to accurately judge the scenarios where the device can be connected but cannot be used normally. The probability of accessing abnormal devices is reduced, and the efficiency of user use of devices and video surveillance experience are improved.

[0009] Based on the above solution, the present invention can also be improved as follows.

[0010] Furthermore, the ffprobe command is a code generated in a fixed format.

[0011] Furthermore, before determining whether the metadata fed back by the network media device to be determined contains the streams keyword, the following steps are also included:

[0012] When the network media device to be judged is in a state to be detected, it is determined whether the metadata contains the streams keyword, and the state to be detected includes: successful connection and successful protocol docking, the successful connection means that the network media device to be judged is successfully connected to the terminal configured with the ffprobe command for judging the state of the network media device, and the successful protocol docking means that the network media device to be judged and the terminal configured with the ffprobe command for judging the state of the network media device are transmitted through the rtsp protocol.

[0013] Further, the process of determining whether the network media device to be determined is in an online state according to the determination result is:

[0014] When the judgment result is yes, determining that the network media device to be judged is in an online state;

[0015] When the judgment result is no, it is determined that the network media device to be judged is in an offline state.

[0016] 2) In the second aspect, the present invention also provides a network media device status judgment system based on ffprobe, and the specific technical solution is as follows:

[0017] The configuration module is used to: configure the ffprobe command used to determine the status of the network media device, and send the command line parameters corresponding to the ffprobe command and the streaming address to the network media device to be determined;

[0018] The judgment module is used to: judge whether the metadata fed back by the network media device to be judged contains the streams keyword according to the stream pulling address, and determine whether the network media device to be judged is online according to the judgment result, and the metadata is the data obtained when the network media device to be judged executes the command line parameters.

[0019] Based on the above solution, the present invention can also be improved as follows.

[0020] Furthermore, the ffprobe command is a code generated in a fixed format.

[0021] Furthermore, before determining whether the metadata fed back by the network media device to be determined contains the streams keyword, the following steps are also included:

[0022] When the network media device to be judged is in a state to be detected, it is determined whether the metadata contains the streams keyword, and the state to be detected includes: successful connection and successful protocol docking, the successful connection means that the network media device to be judged is successfully connected to the terminal configured with the ffprobe command for judging the state of the network media device, and the successful protocol docking means that the network media device to be judged and the terminal configured with the ffprobe command for judging the state of the network media device are transmitted through the rtsp protocol.

[0023] Further, the process of determining whether the network media device to be determined is in an online state according to the determination result is:

[0024] When the judgment result is yes, determining that the network media device to be judged is in an online state;

[0025] When the judgment result is no, it is determined that the network media device to be judged is in an offline state.

[0026] 3) In a third aspect, the present invention further provides an electronic device, comprising a processor, wherein the processor is coupled to a memory, wherein at least one computer program is stored in the memory, and the at least one computer program is loaded and executed by the processor so that the electronic device implements any of the above methods.

[0027] 4) In a fourth aspect, the present invention further provides a computer-readable storage medium, wherein at least one computer program is stored in the computer-readable storage medium, and the at least one computer program is loaded and executed by a processor so that a computer implements any of the above methods.

[0028] It should be noted that the beneficial effects achieved by the technical solutions of the second to fourth aspects of the present invention and the corresponding possible implementation methods can be found in the above-mentioned technical effects of the first aspect and its corresponding possible implementation methods, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Other features, objects and advantages of the present invention will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:

[0030] Figure 1 This is one of the flow charts of a method for determining the state of a network media device based on ffprobe according to an embodiment of the present invention;

[0031] Figure 2 The second flowchart of a method for determining the state of a network media device based on ffprobe according to an embodiment of the present invention;

[0032] Figure 3This is a structural framework diagram corresponding to an electronic device of the present invention. DETAILED DESCRIPTION

[0033] To facilitate understanding of this plan, the professional terms given in this plan are explained:

[0034] ffprobe: An open source tool that is part of the FFmpeg multimedia processing tool suite. It is used to analyze the metadata of media files and provide detailed information about the files. ffprobe is mainly used to inspect and analyze the properties of files without modifying them.

[0035] Network media device: A network device with an IP address, which refers to a camera device or NVR device that can be accessed through a network protocol (such as Hikvision and Dahua digital cameras).

[0036] RTSP: It is a streaming media protocol that network media devices usually support.

[0037] Online status: The device can be pinged and can provide media streaming services normally.

[0038] Offline status: The device cannot be pinged, or the device can be connected but cannot provide media services normally.

[0039] Metadata: This refers to the descriptive information streams of the video data. The information format is standard JSON, such as the encoding format, bit rate, resolution, and other information of the video stream.

[0040] Streaming address: The streaming address here has a wide range and can be RTSP, RTMP, or HTTP.

[0041] URI: The path or parameter following the IP address.

[0042] In order to make the objectives, technical solutions and advantages of the present invention more clear, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.

[0043] like Figure 1 as well as Figure 2 As shown, a method for determining the status of a network media device based on ffprobe according to an embodiment of the present invention comprises the following steps:

[0044] S1, configuring an ffprobe command for determining the status of a network media device, and sending command line parameters corresponding to the ffprobe command and a streaming address to the network media device to be determined.

[0045] in:

[0046] The ffprobe command refers to the command that needs to be executed by the network media device to be judged, and is edited according to a fixed format, for example: ffprobe -v quiet-print_format json-show_format-show_streams.

[0047] S2, according to the stream pulling address, judging whether the metadata fed back by the network media device to be judged contains the streams keyword, and determining whether the network media device to be judged is online according to the judgment result, wherein the metadata is the data obtained when the network media device to be judged executes the command line parameters.

[0048] Before S2, it also includes: if the device is connected successfully and the rtsp protocol is successfully connected, the video stream description information of the device will be obtained.

[0049] Embodiment 1, this scheme includes 2 important elements, the first element is the configured ffprobe command: ffprobe -v quiet-print_formatjson-show_format-show_streams, the second element is the transmitted stream pull address: the stream pull address URI can be defined arbitrarily without restriction.

[0050] When the detection service starts ffprobe, it passes element 1 and element 2. ffprobe will connect to the device and obtain the corresponding metadata according to the passed stream pull address (element 2). If the device is successfully connected and the rtsp protocol is successfully connected, the device's video stream description information will be obtained. Since the description information returned by different media devices may be different, ffprobe will standardize the output metadata based on the passed parameters (element 1). The metadata information is as follows:

[0051]

[0052]

[0053] The detection service searches for streams information based on the returned metadata. If the information is found, the device is online. If the information fails, the device is offline. If the metadata is {}, the device is offline.

[0054] The design and construction of the present invention is based on ffprobe. The ffprobe multimedia processing tool suite needs to be installed before the program is started. After the program is started, the passed command parameters will be loaded, and ffpobe will be called in the program in command line mode to request the device. The program will output and filter the metadata returned after requesting the device in a standardized manner. If the streams content in the metadata can be correctly parsed, it means that the device is online and can pull video data normally.

[0055] The beneficial effects of the network media device status determination method based on ffprobe provided by the present invention are as follows:

[0056] By pre-configuring the ffprobe command, the efficiency of judging the status of network media devices is improved, and metadata is used to accurately judge the scenarios where the device can be connected but cannot be used normally. The probability of accessing abnormal devices is reduced, and the efficiency of user use of devices and video surveillance experience are improved.

[0057] Furthermore, the ffprobe command is a code generated in a fixed format.

[0058] Furthermore, before determining whether the metadata fed back by the network media device to be determined contains the streams keyword, the following steps are also included:

[0059] When the network media device to be judged is in a state to be detected, it is determined whether the metadata contains the streams keyword, and the state to be detected includes: successful connection and successful protocol docking, the successful connection means that the network media device to be judged is successfully connected to the terminal configured with the ffprobe command for judging the state of the network media device, and the successful protocol docking means that the network media device to be judged and the terminal configured with the ffprobe command for judging the state of the network media device are transmitted through the rtsp protocol.

[0060] It should be noted that when the network media device to be judged is in a non-detection state, a security check is performed on all links corresponding to the terminal configured with the ffprobe command for judging the network media device status (since the terminal configured with the ffprobe command for judging the network media device status may issue ffprobe commands to multiple network media devices to be judged at the same time, when any network media device to be judged is in a non-detection state, a security check is required for all links corresponding to the terminal, and each link connects the terminal with the network media device to be judged), and if the check is passed, S1 is repeated. When the network media device to be judged is still not in a non-detection state after repeating the security check n times, it is judged whether the network media device to be judged is in an online state through manual intervention. Among them:

[0061] The non-to-be-detected status is: connection failure and / or protocol docking failure.

[0062] The specific process of security verification is as follows:

[0063] The first step is to obtain multiple links to be checked through a crawler tool; the crawler tool can be burpsuite.

[0064] In the second step, a request is sent to the server (a terminal configured with the ffprobe command for determining the status of the network media device) according to each link to be checked, and a request result corresponding to each link to be checked is obtained.

[0065] For example, a request is sent to the server for a link found by the crawler. The returned request results may include:

[0066] Headers: return code, Server, Date, Content-Type, Connection, Vary, Accept-Encoding, location_gray, X-XSS-Protection, Referrer-Policy. Log the request and request response results.

[0067] The third step is to analyze any request result to obtain the first return value in any request result; wherein the first return value may be a "Server" return value.

[0068] The process of analyzing the request results may include the following methods:

[0069] The first method: Check whether there is a "Server:" return value in responses. If there is a return value, it means that a middleware leak has occurred, and if there is no return value, it means that no middleware leak has occurred. That is, if the "Server:" return value is not empty, there is a middleware leak, and if the return value is empty, there is no middleware leak.

[0070] The second method: Check whether the return value of "Server:" contains the version number. If leaked, the return value will contain the middleware version number and the middleware name, especially the middleware version number.

[0071] According to the judgment results of the first and second methods, intercept the request link, middleware, and version number of the responses with leaked middleware version numbers; among them, according to the Server result, the Server value is the middleware and version number. The analysis structure can be made into a script to conduct in-depth analysis of the log content.

[0072] In the fourth step, when the first return value satisfies a preset condition, a middleware leak occurs in the corresponding link to be checked.

[0073] Further, the process of determining whether the network media device to be determined is in an online state according to the determination result is:

[0074] When the judgment result is yes, determining that the network media device to be judged is in an online state;

[0075] When the judgment result is no, it is determined that the network media device to be judged is in an offline state.

[0076] In the above embodiments, although the steps are numbered S1, S2, etc., these are only specific embodiments given by the present invention. Those skilled in the art may adjust the execution order of S1, S2, etc. according to actual conditions, which is also within the protection scope of the present invention. It can be understood that in some embodiments, some or all of the above embodiments may be included.

[0077] The present invention also provides a network media device status judgment system based on ffprobe, and the specific technical solution is as follows:

[0078] The configuration module is used to: configure the ffprobe command used to determine the status of the network media device, and send the command line parameters corresponding to the ffprobe command and the streaming address to the network media device to be determined;

[0079] The judgment module is used to: judge whether the metadata fed back by the network media device to be judged contains the streams keyword according to the stream pulling address, and determine whether the network media device to be judged is online according to the judgment result, and the metadata is the data obtained when the network media device to be judged executes the command line parameters.

[0080] Based on the above solution, the present invention can also be improved as follows.

[0081] Furthermore, the ffprobe command is a code generated in a fixed format.

[0082] Furthermore, before determining whether the metadata fed back by the network media device to be determined contains the streams keyword, the following steps are also included:

[0083] When the network media device to be judged is in a state to be detected, it is determined whether the metadata contains the streams keyword, and the state to be detected includes: successful connection and successful protocol docking, the successful connection means that the network media device to be judged is successfully connected to the terminal configured with the ffprobe command for judging the state of the network media device, and the successful protocol docking means that the network media device to be judged and the terminal configured with the ffprobe command for judging the state of the network media device are transmitted through the rtsp protocol.

[0084] Further, the process of determining whether the network media device to be determined is in an online state according to the determination result is:

[0085] When the judgment result is yes, determining that the network media device to be judged is in an online state;

[0086] When the judgment result is no, it is determined that the network media device to be judged is in an offline state.

[0087] It should be noted that the beneficial effects of the network media device status judgment system based on ffprobe provided in the above embodiment are the same as the beneficial effects of the network media device status judgment method based on ffprobe, which will not be repeated here. In addition, when the system provided in the above embodiment realizes its functions, it only takes the division of the above functional modules as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the system can be divided into different functional modules according to actual conditions to complete all or part of the functions described above. In addition, the system and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.

[0088] like Figure 3 As shown, an electronic device 300 according to an embodiment of the present invention includes a processor 320, the processor 320 is coupled to a memory 310, and the memory 310 stores at least one computer program 330, and the at least one computer program 330 is loaded and executed by the processor 320, so that the electronic device 300 implements any of the above methods, specifically:

[0089] The electronic device 300 may have relatively large differences due to different configurations or performances, and may include one or more processors 320 (Central Processing Units, CPU) and one or more memories 310, wherein the one or more memories 310 store at least one computer program 330, and the at least one computer program 330 is loaded and executed by the one or more processors 320, so that the electronic device 300 implements a network media device status judgment method based on ffprobe provided in the above embodiment. Of course, the electronic device 300 may also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output, and the electronic device 300 may also include other components for realizing device functions, which will not be repeated here.

[0090] A computer-readable storage medium according to an embodiment of the present invention stores at least one computer program, and the at least one computer program is loaded and executed by a processor so that a computer implements any one of the above methods.

[0091] Optionally, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, and the like.

[0092] In an exemplary embodiment, a computer program product or a computer program is also provided, the computer program product or the computer program comprising computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the electronic device performs any of the above methods.

[0093] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects and represent the definition of a specific order or sequence. The order of use of similar objects can be interchanged where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than the order shown or described.

[0094] Those skilled in the art know that the present invention can be implemented as a system, method or computer program product. Therefore, the present disclosure can be specifically implemented in the following forms, namely: it can be complete hardware, it can be complete software (including firmware, resident software, microcode, etc.), or it can be a combination of hardware and software, which is generally referred to as "circuit", "module" or "system" herein. In addition, in some embodiments, the present invention can also be implemented in the form of a computer program product in one or more computer-readable media, and the computer-readable medium contains computer-readable program code.

[0095] Any combination of one or more computer-readable media may be used. A computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, device, or device.

[0096] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present invention.

Claims

1. A method for determining the status of a network media device based on ffprobe, characterized in that: include: Configure an ffprobe command for determining the status of a network media device, and send command line parameters corresponding to the ffprobe command to the network media device to be determined, and send a stream pull address to the network media device to be determined; According to the streaming address, a judgment is made as to whether the metadata fed back by the network media device to be judged contains streams information, and based on the judgment result, it is determined whether the network media device to be judged is in an online state, wherein the metadata is data obtained when the network media device to be judged executes the command line parameters.

2. A method for determining the status of a network media device based on ffprobe according to claim 1, characterized in that: The ffprobe command is a code generated in a fixed format.

3. The method for determining the status of a network media device based on ffprobe according to claim 1, characterized in that: Before determining whether the metadata fed back by the to-be-determined network media device contains streams information, the method further includes: When the network media device to be judged is in a state to be detected, it is determined whether the metadata contains streams information, and the state to be detected includes: successful connection and successful protocol docking, the successful connection means that the network media device to be judged is successfully connected with the terminal configured for the ffprobe command for judging the state of the network media device, and the successful protocol docking means that the network media device to be judged and the terminal configured for the ffprobe command for judging the state of the network media device are transmitted through the rtsp protocol.

4. The method for determining the status of a network media device based on ffprobe according to claim 1, characterized in that: The process of determining whether the network media device to be determined is in an online state according to the determination result is as follows: When the judgment result is yes, determining that the network media device to be judged is in an online state; When the judgment result is no, it is determined that the network media device to be judged is in an offline state.

5. A network media device status judgment system based on ffprobe, characterized in that: include: The configuration module is used to: configure the ffprobe command for determining the status of the network media device, and send the command line parameters corresponding to the ffprobe command to the network media device to be determined, and send the stream pull address to the network media device to be determined; The judgment module is used to: judge whether the metadata fed back by the network media device to be judged contains streams information according to the stream pulling address, and determine whether the network media device to be judged is online based on the judgment result, and the metadata is the data obtained when the network media device to be judged executes the command line parameters.

6. The network media device status judgment system based on ffprobe according to claim 5 is characterized in that: The ffprobe command is a code generated in a fixed format.

7. The network media device status judgment system based on ffprobe according to claim 5 is characterized in that: Before determining whether the metadata fed back by the to-be-determined network media device contains streams information, the method further includes: When the network media device to be judged is in a state to be detected, it is determined whether the metadata contains streams information, and the state to be detected includes: successful connection and successful protocol docking, the successful connection means that the network media device to be judged is successfully connected with the terminal configured for the ffprobe command for judging the state of the network media device, and the successful protocol docking means that the network media device to be judged and the terminal configured for the ffprobe command for judging the state of the network media device are transmitted through the rtsp protocol.

8. The network media device status judgment system based on ffprobe according to claim 5 is characterized in that: The process of determining whether the network media device to be determined is in an online state according to the determination result is as follows: When the judgment result is yes, determining that the network media device to be judged is in an online state; When the judgment result is no, it is determined that the network media device to be judged is in an offline state.

9. An electronic device, characterized in that: The electronic device comprises a processor, the processor is coupled to a memory, at least one computer program is stored in the memory, and the at least one computer program is loaded and executed by the processor so that the electronic device implements the method according to any one of claims 1 to 4.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one computer program, and the at least one computer program is loaded and executed by a processor so that a computer implements the method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Network connectivity diagnosis method and device, terminal and storage medium

    CN111314181A

  • Streaming media file processing method and device

    CN111447490A