CN114189504A - Method and device for acquiring flow starting URL (Uniform resource locator), electronic equipment and storage medium - Google Patents

Method and device for acquiring flow starting URL (Uniform resource locator), electronic equipment and storage medium Download PDF

Info

Publication number
CN114189504A
CN114189504A CN202010859126.XA CN202010859126A CN114189504A CN 114189504 A CN114189504 A CN 114189504A CN 202010859126 A CN202010859126 A CN 202010859126A CN 114189504 A CN114189504 A CN 114189504A
Authority
CN
China
Prior art keywords
url
starting
file
stream
flow starting
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010859126.XA
Other languages
Chinese (zh)
Other versions
CN114189504B (en
Inventor
李希凡
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Uniview Technologies Co Ltd
Original Assignee
Zhejiang Uniview Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Uniview Technologies Co Ltd filed Critical Zhejiang Uniview Technologies Co Ltd
Priority to CN202010859126.XA priority Critical patent/CN114189504B/en
Publication of CN114189504A publication Critical patent/CN114189504A/en
Application granted granted Critical
Publication of CN114189504B publication Critical patent/CN114189504B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/955Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]
    • G06F16/9566URL specific, e.g. using aliases, detecting broken or misspelled links
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/60Network streaming of media packets

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computing Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The embodiment of the application discloses a method and a device for acquiring a stream starting URL (Uniform resource locator), electronic equipment and a storage medium, wherein the method comprises the following steps: after receiving the information of successfully logging in the equipment, inquiring whether an adapted file exists locally; the adapted file comprises a URL format and a flow starting parameter filling mode required by the verified equipment; and if the media stream exists, locally assembling a local URL at the client by using the adapted file and the identified streaming start parameter, and taking the local URL as the streaming start URL so as to start the media stream based on the streaming start URL. In the embodiment of the application, after the client successfully logs in the device, if the adapted file exists locally, the adapted file and the specified stream starting parameter are used for locally generating the local URL, and the local URL is used as the stream starting URL, so that the stream starting URL is prevented from being acquired from the device side, the efficiency of acquiring the stream starting URL is improved, and the speed of starting the media stream is improved after the stream starting URL is used for starting the media stream.

Description

Method and device for acquiring flow starting URL (Uniform resource locator), electronic equipment and storage medium
Technical Field
The embodiment of the application relates to the technical field of video monitoring, in particular to a method and a device for acquiring a stream starting URL, electronic equipment and a storage medium.
Background
With the development of IP monitoring technology, a media transport Protocol is widely used in NVR (Network Video Recorder) devices, and particularly, a Real Time Streaming Protocol (RTSP) Protocol has become an indispensable part of a monitoring system due to its characteristics of high expandability, resolution, safety, and Real-Time performance.
Currently, the streaming of the RTSP protocol (opening the media stream) needs to be performed through a URL (uniform resource locator), and the URL is obtained by the client by sending a URL obtaining request to the NVR device. This approach has certain disadvantages: the URL is required to be requested to the NVR equipment when the stream is started every time, and due to the limitation of a network, the URL is acquired for a long time under the environment with slow network response, so that the URL acquisition efficiency is low, and the stream starting speed is influenced.
Disclosure of Invention
The embodiment of the application provides a method and a device for acquiring a flow starting URL, electronic equipment and a storage medium, so that the efficiency of acquiring the flow starting URL is improved, and the flow starting speed is improved.
In a first aspect, an embodiment of the present application provides a method for obtaining a start-streaming URL, which is executed by a client and includes:
after receiving the information of successfully logging in the equipment, inquiring whether an adapted file exists locally; the adapted file comprises a verified URL format and a flow starting parameter filling mode required by the equipment;
if the media stream exists, entering an adapted state, locally assembling a local URL at the client by using the adapted file and the identified stream starting parameter, and taking the local URL as a stream starting URL so as to start the media stream based on the stream starting URL; wherein the adapted state represents a method of assembling the URL that has been verified.
In a second aspect, an embodiment of the present application provides a device for obtaining a start-streaming URL, configured at a client, including:
the query module is used for querying whether the matched file exists locally or not after receiving the information of successfully logging in the equipment; the adapted file comprises a verified URL format and a flow starting parameter filling mode required by the equipment;
the URL generating module is used for locally assembling a local URL at the client by using the adapted file and the identified streaming starting parameter if the query result shows that the adapted file exists, and taking the local URL as the streaming starting URL so as to start the media stream based on the streaming starting URL; wherein the adapted state represents a method of assembling the URL that has been verified.
In a third aspect, an embodiment of the present application further provides an electronic device, including:
one or more processors;
a storage device for storing one or more programs,
when executed by one or more processors, cause the one or more processors to implement a method for streamlining URL acquisition as in any embodiment of the present application.
In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the flow starting URL obtaining method according to any embodiment of the present application.
In the embodiment of the application, after the client successfully logs in the device, if the adapted file exists locally, the adapted file and the specified stream starting parameter are used for locally generating the local URL, and the local URL is used as the stream starting URL, so that the stream starting URL is prevented from being acquired from the device side, the efficiency of acquiring the stream starting URL is improved, and the speed of starting the media stream is improved after the stream starting URL is used for starting the media stream.
Drawings
FIG. 1 is a flowchart illustrating a method for obtaining a start-streaming URL according to a first embodiment of the present application;
FIG. 2 is a flowchart illustrating a method for fetching a start-streaming URL according to a second embodiment of the present application;
FIG. 3 is a flowchart illustrating a method for fetching a start-streaming URL according to a third embodiment of the present application;
FIG. 4 is a logic flow diagram of a method of fetching a start-streaming URL according to a fourth embodiment of the present application;
FIG. 5 is a schematic structural diagram of a device for retrieving a start-up URL according to a fifth embodiment of the present application;
fig. 6 is a schematic structural diagram of an electronic device in a sixth embodiment according to the present application.
Detailed Description
The present application will be described in further detail with reference to the following drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the application and are not limiting of the application. It should be further noted that, for the convenience of description, only some of the structures related to the present application are shown in the drawings, not all of the structures.
Fig. 1 is a flowchart of a method for obtaining a streaming URL according to a first embodiment of the present application, where the present embodiment is applicable to a case where a media stream is opened based on a media transport protocol, and the method may be executed by a device for obtaining a streaming URL, where the device may be implemented in software and/or hardware, and may be integrated in a client of an electronic device (e.g., a mobile terminal, a tablet computer, etc.).
As shown in fig. 1, the method for acquiring a start-streaming URL specifically includes the following steps:
s101, after receiving the information of successfully logging in the equipment, inquiring whether the local file is matched or not.
The device can be an encoding device which acquires videos of the cameras of the channels through internet connection, stores and manages the videos, and for example, the device is an NVR device. And a client installed in an electronic device (such as a mobile terminal, a tablet computer, etc.) can log in the device through a preset account and a preset password, and then view live videos of any channel camera or play back monitoring videos of a certain time period on the client. To view the live video or the playback video, the client needs to obtain a start stream URL (uniform resource locator) to start the media stream, where the media stream includes the live stream and the playback stream, and therefore, the efficiency of obtaining the start stream URL directly affects the speed of the client to start the media stream.
In the embodiment of the application, in order to avoid that the time for acquiring the start-streaming URL is too long due to network delay when the client requests the device for the start-streaming URL, the inventor creatively provides a method for automatically generating the start-streaming URL locally through an adapted file stored locally, wherein the adapted file is based on the start-streaming URL acquired from the device side in advance and performs data analysis on the start-streaming URL, if the URL format and the parameter filling mode required by the device are obtained according to the analysis result, the adapted file is generated, otherwise, the adapted file is not generated, and the start-streaming URL is acquired according to the existing method. The adapted file comprises the URL format and the flow starting parameter filling mode required by the verified equipment, namely the adapted file comprises a method for assembling the flow starting URL, and the verification is effective, so that the obtained adapted file is the method for obtaining the assembled URL which is verified.
In the embodiment of the application, if a live stream is to be started, the stream starting parameter comprises a channel number and a stream number; if the playback stream is to be started, the stream starting parameters comprise a starting time and an ending time besides a channel number and a stream number; the stream number is used to represent the type of opening live stream or playback stream, the type of stream includes main stream, auxiliary stream, third stream, etc., it should be noted that the resolution, mode, etc. of different types of streams are different; the channel number is used to characterize from which channel camera the live stream or the playback stream is started.
Illustratively, taking opening a live stream as an example, the format of the start stream URL is as follows: rtsp:/< IP > < port >/unity/< channel number >/< stream number >/live, where unity and live are fixed fields. The filling mode of the start-up stream parameter comprises a channel number and a representation mode of the stream number, for example, 1 channel is represented by a number "0", and 2 channels are represented by 1; the Main stream is denoted by Main and the auxiliary stream is denoted by second.
It should be noted here that the URL formats and the flow starting parameter filling manners required by different devices are different, so that, for different devices, the adapted files locally pre-stored in the client communicating with the device are also different, so that the client can generate the flow starting URL meeting the device requirements according to the different adapted files, thereby avoiding the compatibility problem when generating the flow starting URL using a fixed URL format, for example, when the URL format changes, a format error may be caused, and finally a flow starting failure is caused.
S102, if the media stream exists, entering an adapted state, locally assembling a local URL at the client by using the adapted file and the identified stream starting parameter, and taking the local URL as the stream starting URL so as to start the media stream based on the stream starting URL.
The identified start-up parameter refers to a start-up parameter specified by a user on the client. And if the adapted file exists, locally assembling the local URL at the client by using the adapted file and the start-up parameter specified by the user. Illustratively, for opening a live stream, the specified start stream parameter is 1 channel (denoted by "0"), and the main stream, then the generated start stream URL: rtsp://192.168.1.64:554/unicast/0/Main/live, where IP and port numbers are known. And then, the client opens the live stream by taking the local URL as a stream opening URL.
It should be noted that, if playback stream is to be started, start time and end time are also specified, wherein the start time and the end time can be represented by NTP time or UTC time. Illustratively, the playback-stream-opening URL generated locally at the client via S101-S102 is as follows: rtsp://192.168.1.64:554/0/b1593241643/e 1593245776/reproduction/type 1981/or/Main/; where b1593241643/e1593245776 represents a start time/end time.
In the embodiment of the application, after the client successfully logs in the device, if the adapted file exists locally, the adapted state is entered, wherein the adapted state represents a method for assembling the URL which passes the verification, the adapted file and the specified streaming starting parameter are utilized to locally assemble the local URL, and the local URL is used as the streaming starting URL, so that the situation that the streaming starting URL is obtained from the device side is avoided, the efficiency of obtaining the streaming starting URL is improved, and the speed of starting the media stream is improved after the media stream is started by utilizing the streaming starting URL.
Furthermore, after the client opens the media stream based on the stream start URL, in order to ensure the accuracy of stream start, the assembled local URL needs to be verified. Optionally, based on the identified start-streaming parameter, the start-streaming URL is obtained from the device side. In specific implementation, the identified stream start parameter can be combined by using an Open Network Video Interface Forum (Open Network Video Interface Forum) protocol or an SDK mode, and the stream start URL is acquired from the device side. Illustratively, a request instruction of the getURL is sent to the device based on the ONVIF protocol, the instruction includes a flow starting parameter to be requested, and then the flow starting URL is determined according to the feedback of the device.
Further, the start-streaming URL acquired from the device side is compared with the locally assembled URL by S102; if the two are completely the same, the streaming start URL locally generated at the client is accurate; if the file is not the same, for example, the URL format and/or the filling manner of the streaming start parameter of the streaming start URL acquired by the device side is different from that of the local URL, it is determined that the adapted file locally stored by the client is inaccurate, and the media stream needs to be restarted according to the streaming start URL acquired from the device side, and the adapted file is deleted. Thereby enabling further verification of the adaptation file.
Fig. 2 is a flowchart of a method for obtaining a start-streaming URL according to a second embodiment of the present application, where the present embodiment is optimized based on the foregoing embodiments, and referring to fig. 2, the method includes:
s201, after receiving the information of successfully logging in the equipment, inquiring whether the local file is matched or not.
The adapted file comprises a URL format and a starting parameter filling mode required by the verified equipment. If the adapted file exists locally, S202 is executed, and if the adapted file does not exist locally, S203 is executed.
S202, locally assembling a local URL at the client by using the adapted file and the identified streaming start parameter, and taking the local URL as the streaming start URL so as to start the media stream based on the streaming start URL.
For a detailed description, reference may be made to the above embodiments, which are not described herein again.
S203, if the matched file does not exist locally, whether the file to be matched exists locally is inquired.
The file to be adapted comprises a URL format and a flow starting parameter filling mode required by unverified equipment; that is, although the file to be adapted includes the URL format and the flow starting parameter filling method required by the device, the accuracy of the flow starting URL generated based on the file to be adapted cannot be guaranteed. Thus, the file to be adapted needs to be verified.
And S204, if the file to be adapted exists, judging whether the current flow starting task to be processed exists.
And if the file to be adapted exists, entering a state to be adapted, wherein the state to be adapted represents a method for obtaining an unverified assembly URL. When the file to be adapted is verified, it is first determined whether the client is currently in a working state, that is, whether a pending start task exists at present. If it exists, then S205-S207 are executed, and if it does not exist, then S208-S209 are executed.
And S205, if the to-be-processed stream starting task exists, acquiring a stream starting URL from the equipment side based on the identified stream starting parameter, and starting the media stream by using the stream starting URL.
Because the accuracy of the stream starting URL generated based on the file to be adapted cannot be guaranteed, when a stream starting task to be processed exists, the stream starting URL is obtained from the equipment side based on the identified stream starting parameter, for example, the stream starting URL can be obtained from the equipment side by using an ONVIF protocol or an SDK mode and combining the identified stream starting parameter, and then the media stream is started by using the stream starting URL, so that the accuracy of stream starting is guaranteed.
S206, acquiring a local URL assembled by the file to be adapted and the identified stream starting parameters.
On the basis of acquiring the URL format and the parameter filling mode required by the equipment from the file to be adapted, the local URL is locally assembled according to the flow starting parameter specified by the user, and the specific assembly process is to supplement the specified flow starting parameter to the specified position of the URL format according to the parameter filling mode.
And S207, comparing the flow starting URL with the local URL, and processing the file to be adapted according to the comparison result.
And comparing the stream starting URL with the local URL, judging whether the stream starting URL is the same as the local URL or not, if so, indicating that the local URL assembled based on the file to be adapted is inaccurate, and therefore, directly deleting the file to be adapted and switching from the state to be adapted to the state of unadapted, wherein the unadapted state represents a method for not obtaining the assembled URL. It should be noted that if the comparison result is the same, the determination may be performed multiple times according to the idle matching operation in S208, and if the comparison result is the same each time, the to-be-adapted file is rewritten and the to-be-adapted state is switched to the adapted state.
And S208, if the to-be-processed flow starting task does not exist, repeatedly executing the idle matching operation according to the preset repetition times.
In the embodiment of the application, when the flow starting task does not exist, namely the client is in an idle state, the idle matching operation is repeatedly executed according to the preset repetition times. The aim of repeatedly executing the idle matching operation is to verify the file to be adapted. Optionally, the idle matching operation includes: randomly determining a group of flow starting parameters, and acquiring a flow starting URL from the equipment side based on the flow starting parameters; locally assembling a local URL at the client by using the file to be adapted and the flow starting parameter; for a specific generation process, reference may be made to the description of the above embodiment, which is not described herein again; and comparing the stream starting URL with the local URL, and processing the file to be adapted according to the comparison result. .
S209, if the comparison result is the same, the to-be-adapted file passes the verification, and is rewritten into an adapted file, and the to-be-adapted state is switched to the adapted state.
If the comparison result is the same, the URL generated by using the file to be adapted is accurate, namely the file to be adapted passes verification, so that the file to be adapted is rewritten into the adapted file and is switched from the state to be adapted to the adapted state, so that the adapted file is directly used for generating the flow starting URL locally at the client side in the following process, the flow starting URL obtaining efficiency is improved, and the flow starting speed is improved. It should be noted that, if the comparison results are different, the file to be adapted is deleted, and the state to be adapted is switched to the unadapted state, where the unadapted state indicates that the method for assembling the URL is not obtained.
In the embodiment of the application, under the condition that the file to be adapted only exists locally, if the flow starting task exists, the URL is obtained from the equipment end to complete flow starting, so that the accuracy of flow starting is ensured. And after the stream starting is successful, comparing a local URL generated by the client based on the file to be adapted with the stream starting URL acquired from the equipment side to verify the effect of the file to be adapted. If the flow starting task does not exist, the effect of generating the local URL based on the file to be adapted is verified by repeatedly executing the idle matching operation.
Fig. 3 is a flowchart of a method for obtaining a start-streaming URL according to a third embodiment of the present application, where the present embodiment is optimized based on the foregoing embodiments, and referring to fig. 3, the method includes:
s301, after receiving the information of successfully logging in the equipment, inquiring whether the local file is matched or not.
The adapted file comprises a URL format and a starting parameter filling mode required by the verified equipment. If yes, go to step S302, otherwise go to step S303.
S302, locally assembling a local URL at the client by using the adapted file and the identified streaming start parameter, and taking the local URL as the streaming start URL so as to start the media stream based on the streaming start URL.
S303, if the matched file does not exist locally, whether the file to be matched exists locally is inquired.
S304, if the file to be adapted does not exist locally, judging whether a stream starting task to be processed exists currently.
And if the streaming starting task exists, acquiring a streaming starting URL of the specified parameter from the equipment, starting the media stream through the streaming starting URL, and reserving the streaming starting URL and the parameter after the streaming starting is successful so as to perform data analysis based on the saved streaming starting URL and the stored parameter. If there is no flow start task, S305 is executed.
S305, if the to-be-processed flow starting task does not exist, different flow starting URLs are respectively obtained from the equipment side according to the identified different flow starting parameters.
For example, for the case of opening a live stream, if the first identified user specifies that the start parameter is "1 channel" or "main stream", a start URL including "1 channel" or "main stream" is acquired from the device side; and if the user-specified flow starting parameters identified for the second time are '2 channel' and 'main stream', acquiring flow starting URLs … … including '0 channel' and 'main stream' from the equipment side, and so on, and respectively acquiring different flow starting URLs from the equipment side according to different identified flow starting parameters. In an alternative embodiment, the different restart URLs are obtained from locally stored restart URLs and parameters.
S306, performing data analysis on the obtained different flow starting URLs, determining whether a method for assembling the URLs is found out according to an analysis result, and if so, generating a file to be adapted according to the analysis result.
In an optional implementation manner, performing data analysis on the obtained different start-up URLs includes: comparing any two different start-flow URLs to determine a fixed field and a variable field; wherein, the fixed field refers to the same field in the two start flow URLs, and the variable field refers to different fields in the two start flow URLs; and determining the corresponding relation between the change field and the start-up parameter.
For example, for the case of opening a live stream, the start URL for acquiring four channels and a main stream from the device side is: rtsp://192.168.1.64: 554/unicast/3/Main/live; and acquiring the start URL of the five channels and the main stream from the equipment side as follows: rtsp://192.168.1.64: 554/unicast/4/Main/live; comparing the two start-flow URLs, finding the fixed fields as IP, port numbers (192.168.1.64: 554), unicast and live and the variable fields as 3 and 4 under the condition of ensuring that the flow number is not changed. It can be seen that, four channels are denoted by the number "3", five channels are denoted by the number "4", and the pair relationship between the change field and the channel number is: the change field is equal to the lane number minus 1. And after the channel number specified by the user is identified subsequently, subtracting 1 to obtain the value of the change field.
Similarly, keeping the channel number unchanged, and acquiring the start-stream URL of the 4 channels and the auxiliary stream from the device side as follows: rtsp://192.168.1.64: 554/unicast/3/Second/live; and acquiring the start URL of the 4 channels and the main stream from the equipment side as follows: rtsp://192.168.1.64: 554/unicast/3/Main/live. Comparing the two start-up URLs, finding out that the fixed fields are IP, port numbers (192.168.1.64: 554), unicast and live, and the variable fields are Second and Main under the condition of ensuring that the channel number is not changed. It can be seen that the pair relationship between the change field and the stream number is: the Main stream is denoted by english Main and the subsidiary stream is denoted by english Second. After the stream number specified by the user is identified, the stream number is directly expressed by corresponding English.
Further, for the startup playback stream similar to the above, with reference to the above comparison process, in the case where the channel number and the stream number are determined, the correspondence between the start time and the end time of the change field is determined, for example, as represented by UTC time; as expressed in hours, months, days, hours, minutes, seconds; such as represented by NTP time, etc.
Taking opening a live stream as an example, through the above data analysis, the URL format required by the device can be obtained as follows: rtsp:// < IP > < port >/unicast/< channel number >/< stream number >/live; the filling mode of the start flow parameter is as follows: the number corresponding to the channel number is the channel number designated by the user minus 1, and for the stream number, if the stream number is designated as the Main stream, the stream number is Main, and if the stream number is designated as the auxiliary stream, the stream number is Second. Therefore, the file to be adapted can be generated according to the analyzed URL format required by the equipment and the filling mode of the starting parameter, the file to be adapted can be verified subsequently, the verification process is referred to above, and the file to be adapted is rewritten into the adapted file after the verification is passed, so that an accurate local URL for starting the streaming can be directly generated in the local client side based on the adapted file subsequently.
It should be noted here that if the fixed field and the changed field are determined and the corresponding relationship between the changed field and the streaming start parameter is obtained according to the analysis result, generating the file to be adapted according to the analysis result includes: and determining a URL format according to the analyzed fixed field and the analyzed changed field, and determining a flow starting parameter filling mode according to the corresponding relation between the changed field and the flow starting parameter, so that a file to be adapted can be determined and generated, namely a method for assembling the local URL is found out.
Further, if a method for assembling the URL is not found according to the analysis result, that is, the format of the URL and/or the filling manner of the start-up parameter are not determined, an unadaptable state is directly performed, where the unadaptable state indicates that the method for assembling the URL is not found, and the start-up URL is not obtained from the device side any longer when the media stream needs to be opened.
In the embodiment of the application, in an idle state, the acquired stream starting URL is subjected to data analysis, the format of the stream starting URL is determined according to the analysis result, and the corresponding relation between the field and the stream starting parameter is changed, so that the adaptive file is generated, the accurate stream starting URL can be directly generated locally at the client according to the adaptive file in the subsequent process, and the stream starting URL acquisition efficiency is improved.
Fig. 4 is a logic flow diagram of a method for acquiring a start-up URL according to a fourth embodiment of the present application, where the present embodiment is optimized based on the foregoing embodiments, and referring to fig. 4, the logic flow of the method for acquiring a start-up URL is as follows:
four states are predefined in this embodiment: the adapted state, the state to be adapted, the not adapted state, and the not adapted state. The adapted state means that a specific parameter method for self-assembly of the URL is found and is valid through verification, namely that an adapted file exists locally; the state to be adapted refers to the fact that a specific parameter method for automatically assembling the URL is found, the effect to be verified is achieved, namely the file to be adapted exists locally; the unadapted state means that a specific parameter method for self-assembly URL is not found; the state of being unable to adapt refers to trying to find the assembly method many times, but not finding it.
Step 1:
after the client program successfully logs in the equipment, the equipment can be selected as NVR equipment, a corresponding adapted file is found in the local environment, if the adapted file is found, the adaptive state is entered, and the step 6 is skipped; if not, searching the file to be adapted locally, if so, entering a state to be adapted, and jumping to the step 5; and if the file to be adapted is not found, entering an unadapted state and jumping to the step 2.
Step 2:
after the client enters the non-adaptive state, two conditions exist, if the client has a to-be-processed flow starting task, the client is determined to be in a working state, otherwise, the client is determined to be in an idle state. In the working state, a stream starting URL of the specified parameters is obtained from the equipment side, the media stream is started through the stream starting URL, and the stream starting URL and the parameters are reserved after the stream starting is successful; when the client is in an idle state, the flow starting URL of different flow starting parameters can be obtained from the equipment side, data analysis is carried out by combining the URL and the parameters (if the URL and the parameters exist) which are successful in flow starting, and the corresponding relation between the variable field in the flow starting URL and the flow starting parameters and the format of the URL are determined.
And step 3:
if the analysis is successful, the URL format and the corresponding relation between the variable field in the URL and the stream starting parameter are determined, then the file to be adapted is generated, the state to be analyzed is entered, and the step 5 is skipped. If the URL assembling method cannot be found through analysis, namely the corresponding relation between the variable field in the URL and the start-stream parameter cannot be determined, and the assembling method cannot be found through multiple analyses, the method enters an unadaptable state, namely the method jumps to the step 4, otherwise, the method returns to the state to be analyzed (namely the method jumps to the step 2) to continue analysis.
And 4, step 4:
after entering the state of being unable to adapt, the client system only obtains the flow starting URL from the equipment when the flow is required to be started, and the flow starting URL of the equipment is not analyzed before the equipment is logged in next time.
And 5:
after entering a state to be adapted, when in a working state, acquiring a stream starting URL from the equipment side, starting a media stream by using the stream starting URL, automatically assembling the stream starting URL according to a file to be adapted after the stream starting is finished, and comparing whether the stream starting URL acquired from the equipment side is consistent with the locally and automatically assembled stream starting URL or not; when in an idle state, acquiring a flow starting URL from an equipment side based on randomly specified parameters, automatically assembling the URL according to the specified flow starting parameters, and comparing whether the URL acquired from the equipment side is consistent with the automatically assembled URL or not; and when the inconsistency is found, deleting the file to be adapted, returning to the unadapted state (namely jumping to the step 2), and if the inconsistency is found, writing the adapted file, deleting the file to be adapted and entering the adapted state (namely jumping to the step 6).
Step 6:
and after entering the adaptive state, when a stream starting task exists, automatically assembling a stream starting URL according to the specified parameters, and starting a live stream or a playback stream by using the stream starting URL. And after the flow starting is successful, acquiring the flow starting URL from the equipment side, and comparing the flow starting URL with the self-assembled flow starting URL. If not, the live stream or the playback stream is restarted through the stream starting URL acquired from the equipment, the adapted file is deleted, the non-adapted state is entered, and the step 2 is skipped.
In the embodiment of the application, the purpose of finally generating the flow starting URL locally at the client side by self through analyzing the flow starting URL format is achieved, the flow starting speed is improved, switching of various states is provided, the flow starting URL generated by self-assembly is guaranteed to be effective, and the error rate is reduced.
Fig. 5 is a schematic structural diagram of a flow start URL obtaining apparatus according to a fifth embodiment of the present application, where the present embodiment is applicable to a case of opening a media stream based on a media transport protocol, and referring to fig. 5, the apparatus includes:
a first query module 501, configured to query whether an adapted file exists locally after receiving information of successfully logging in a device; the adapted file comprises a URL format and a flow starting parameter filling mode required by the verified equipment;
a URL generating module 502, configured to, if the query result is yes, locally assemble a local URL at the client using the adapted file and the identified streaming start parameter, and use the local URL as a streaming start URL, so as to start a media stream based on the streaming start URL; wherein the adapted state represents a method of assembling the URL that has been verified.
On the basis of the above embodiment, optionally, the apparatus further includes:
the second query module is used for querying whether a file to be adapted exists locally or not if the adaptation file does not exist locally, wherein the file to be adapted comprises a URL format and a flow starting parameter filling mode required by unverified equipment;
the first flow starting task judging module is used for entering a state to be adapted if the query result is that the flow starting task exists, and judging whether the flow starting task to be processed exists at present; wherein the state to be adapted represents a method for obtaining an unverified assembly URL;
the first flow starting URL obtaining module is used for obtaining a flow starting URL from the equipment side based on the identified flow starting parameter if a flow starting task to be processed exists, and starting the media stream by using the flow starting URL;
the second starting-flow URL obtaining module is used for obtaining a local URL assembled by the file to be adapted and the identified starting-flow parameters;
and the first comparison module is used for comparing the start-stream URL with the local URL and processing the file to be adapted according to the comparison result. On the basis of the foregoing embodiment, optionally, the apparatus further includes:
the second query module is used for querying whether a file to be adapted exists locally or not if the adaptation file does not exist locally, wherein the file to be adapted comprises a URL format and a flow starting parameter filling mode required by unverified equipment;
the first flow starting task judging module is used for entering a state to be adapted if the query result is that the flow starting task exists, and judging whether the flow starting task to be processed exists at present; wherein the state to be adapted represents a method for obtaining an unverified assembly URL;
an idle match operation execution module to:
if the to-be-processed flow starting task does not exist, repeatedly executing idle matching operation according to preset repetition times; idle matching operations, including:
randomly determining a group of flow starting parameters, and acquiring a flow starting URL from the equipment side based on the flow starting parameters; locally assembling a local URL at the client by using the file to be adapted and the flow starting parameter;
and comparing the start-stream URL with the local URL, and processing the file to be adapted according to the comparison result.
On the basis of the above embodiment, optionally, the apparatus further includes:
the rewriting module is used for verifying the file to be adapted to pass if the comparison results are the same, rewriting the file to be adapted to the adapted file, and switching the state to be adapted to the adapted state;
and the deleting module is used for deleting the file to be adapted if the comparison result is different, and switching the state to be adapted to the unadapted state, wherein the unadapted state represents a method for not obtaining the assembly URL.
On the basis of the above embodiment, optionally, the apparatus further includes:
the second flow starting task judging module is used for judging whether a flow starting task to be processed exists at present when the file to be adapted does not exist locally;
the third flow starting URL obtaining module is used for obtaining different flow starting URLs from the equipment side respectively according to the identified different flow starting parameters when the judgment result shows that the flow starting task to be processed does not exist;
the URL analysis module is used for carrying out data analysis on the obtained different flow starting URLs and determining whether a method for assembling the URLs is found out according to an analysis result;
the to-be-adapted file generation module is used for generating an adapted file according to the analysis result if the judgment result is that the method for assembling the URL is found out;
and the state switching module is used for entering an unadaptable state if the judgment result shows that the method for assembling the URL is not found, wherein the unadaptable state represents that the method for assembling the URL cannot be found.
On the basis of the above embodiment, optionally, the URL analysis is specifically used for:
comparing any two different start-flow URLs to determine a fixed field and a variable field; wherein, the fixed field refers to the same field in the two start flow URLs, and the variable field refers to different fields in the two start flow URLs;
determining the corresponding relation between the change field and the flow starting parameter;
correspondingly, the file generation module to be adapted is specifically configured to:
and determining a URL format according to the analyzed fixed field and the analyzed changed field, and determining a flow starting parameter filling mode according to the corresponding relation between the changed field and the flow starting parameter.
On the basis of the above embodiment, optionally, the apparatus further includes:
the URL acquisition and comparison module is used for taking the local URL as a streaming start URL, acquiring the streaming start URL from the equipment side based on the identified streaming start parameter after the media stream is started, and comparing the streaming start URL acquired from the equipment side with the local URL;
and the flow restarting module is used for restarting the media flow according to the flow starting URL acquired from the equipment side and deleting the adapted file if the flow starting URL is different from the URL format and/or the filling mode of the flow starting parameter of the local URL.
The flow starting URL obtaining device provided by the embodiment of the application can execute the flow starting URL obtaining method provided by any embodiment of the application, and has corresponding functional modules and beneficial effects of the execution method.
Fig. 6 is a schematic structural diagram of an electronic device provided in a sixth embodiment of the present application. As shown in fig. 6, the electronic device provided in the embodiment of the present application includes: one or more processors 602 and memory 601; the processor 602 in the electronic device may be one or more, and one processor 602 is taken as an example in fig. 6; the memory 601 is used to store one or more programs; the one or more programs are executed by the one or more processors 602, such that the one or more processors 602 implement the method for fetching a start-streaming URL as described in any of the embodiments of the present application.
The electronic device may further include: an input device 603 and an output device 604.
The processor 602, the memory 601, the input device 603, and the output device 604 in the electronic apparatus may be connected by a bus or other means, and fig. 6 illustrates an example of connection by a bus.
The storage device 601 in the electronic device is used as a computer-readable storage medium, and can be used to store one or more programs, which may be software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the application control method provided in the embodiments of the present application. The processor 602 executes various functional applications and data processing of the electronic device by running software programs, instructions and modules stored in the storage device 601, that is, implements the flow-enabled URL obtaining method in the above method embodiment.
The storage device 601 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to use of the electronic device, and the like. Further, the memory 601 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, the memory 601 may further include memory located remotely from the processor 602, which may be connected to the device via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input device 603 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the electronic apparatus. The output device 604 may include a display device such as a display screen.
And when the one or more programs included in the electronic device are executed by the one or more processors 602, the programs perform the following operations:
after receiving the information of successfully logging in the equipment, inquiring whether an adapted file exists locally; the adapted file comprises a verified URL format and a flow starting parameter filling mode required by the equipment;
if the client side exists, entering an adapted state, locally assembling a local URL at the client side by using the adapted file and the identified streaming starting parameter, and taking the local URL as a streaming starting URL so as to start a media stream based on the streaming starting URL; wherein the adapted state represents a method of assembling the URL that has been verified.
Of course, it can be understood by those skilled in the art that when one or more programs included in the electronic device are executed by one or more processors 602, the programs can also perform related operations in the application control method provided in any embodiment of the present application.
One embodiment of the present application provides a computer-readable storage medium having stored thereon a computer program for executing, when executed by a processor, a method of fetching a start-streaming URL, the method comprising:
after receiving the information of successfully logging in the equipment, inquiring whether an adapted file exists locally; the adapted file comprises a verified URL format and a flow starting parameter filling mode required by the equipment;
if the client side exists, entering an adapted state, locally assembling a local URL at the client side by using the adapted file and the identified streaming starting parameter, and taking the local URL as a streaming starting URL so as to start a media stream based on the streaming starting URL; wherein the adapted state represents a method of assembling the URL that has been verified.
Optionally, the program, when executed by a processor, may be further configured to perform the method provided in any of the embodiments of the present application.
The computer storage media of the embodiments of the present application may take any combination of one or more computer-readable media. The 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 electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a Read Only Memory (ROM), an Erasable Programmable Read Only Memory (EPROM), a flash Memory, an optical fiber, a portable CD-ROM, an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. A computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take a variety of forms, including, but not limited to: an electromagnetic signal, an optical signal, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, Radio Frequency (RF), etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present application may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including, for example, a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present application and the technical principles employed. It will be understood by those skilled in the art that the present application is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the application. Therefore, although the present application has been described in more detail with reference to the above embodiments, the present application is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present application, and the scope of the present application is determined by the scope of the appended claims.

Claims (10)

1. A method for obtaining a start-streaming URL, the method being performed by a client, the method comprising:
after receiving the information of successfully logging in the equipment, inquiring whether an adapted file exists locally; the adapted file comprises a verified URL format and a flow starting parameter filling mode required by the equipment;
if the client side exists, entering an adapted state, locally assembling a local URL at the client side by using the adapted file and the identified streaming starting parameter, and taking the local URL as a streaming starting URL so as to start a media stream based on the streaming starting URL; wherein the adapted state represents a method of assembling the URL that has been verified.
2. The method of claim 1, wherein if no adapted file exists locally, the method further comprises:
inquiring whether a file to be adapted exists locally, wherein the file to be adapted comprises an unverified URL format and a flow starting parameter filling mode required by the equipment;
if yes, entering a state to be adapted, and judging whether a current flow starting task to be processed exists or not; wherein the state to be adapted represents a method for obtaining an unverified assembly URL;
if the to-be-processed stream starting task exists, acquiring a stream starting URL from the equipment side based on the identified stream starting parameter, and starting a media stream by using the stream starting URL;
acquiring a local URL assembled based on the file to be adapted and the identified stream starting parameters;
and comparing the flow starting URL with the local URL, and processing the file to be adapted according to a comparison result.
3. The method of claim 1, wherein if no adapted file exists locally, the method further comprises:
inquiring whether a file to be adapted exists locally, wherein the file to be adapted comprises an unverified URL format and a flow starting parameter filling mode required by the equipment;
if yes, entering a state to be adapted, and judging whether a current flow starting task to be processed exists or not; wherein the state to be adapted represents a method for obtaining an unverified assembly URL;
if the to-be-processed flow starting task does not exist, repeatedly executing idle matching operation according to preset repetition times; the idle matching operation comprises:
randomly determining a group of flow starting parameters, and acquiring a flow starting URL from the equipment side based on the flow starting parameters; locally assembling a local URL at the client by using the file to be adapted and the flow starting parameter;
and comparing the flow starting URL with the local URL, and processing the file to be adapted according to a comparison result.
4. The method according to claim 2 or 3, wherein comparing the start-streaming URL with the local URL and processing the file to be adapted according to the comparison result comprises:
if the comparison result of the flow starting URL and the local URL is the same, the to-be-adapted file passes verification, is rewritten into an adapted file, and is switched from the to-be-adapted state to the adapted state;
and if the comparison result of the flow starting URL is different from the comparison result of the local URL, deleting the file to be adapted, and switching from the state to be adapted to the state not to be adapted, wherein the state not to be adapted represents a method for not obtaining the assembly URL.
5. The method according to claim 2 or 3, wherein if the file to be adapted does not exist locally, the method further comprises:
judging whether a to-be-processed flow starting task exists at present;
if the flow starting task to be processed does not exist, respectively acquiring different flow starting URLs from the equipment side according to the identified different flow starting parameters;
performing data analysis on the obtained different flow starting URLs, and determining whether a method for assembling the URLs is found out according to an analysis result;
if yes, generating a file to be adapted according to the analysis result;
if not, entering an unadaptable state, wherein the unadaptable state indicates that the method for assembling the URL cannot be found out.
6. The method of claim 5, wherein performing data analysis on the obtained different start-up URLs comprises:
comparing any two different start-flow URLs to determine a fixed field and a variable field; the fixed field refers to the same field in the two start-up URLs, and the variable field refers to different fields in the two start-up URLs;
determining the corresponding relation between the change field and the flow starting parameter;
correspondingly, generating the file to be adapted according to the analysis result comprises:
and determining a URL format according to the analyzed fixed field and the analyzed changed field, and determining a flow starting parameter filling mode according to the corresponding relation between the changed field and the flow starting parameter.
7. The method of claim 1, wherein after the local URL is used as a start-streaming URL and the media stream is started, the method further comprises:
acquiring a flow starting URL from the equipment side based on the identified flow starting parameter, and comparing the flow starting URL acquired from the equipment side with the local URL;
and if the URL format and/or filling mode of the stream starting parameter of the stream starting URL is different from that of the local URL, restarting the media stream according to the stream starting URL acquired from the equipment side, and deleting the adapted file.
8. A device for acquiring a streaming URL, configured at a client, comprising:
the query module is used for querying whether the matched file exists locally or not after receiving the information of successfully logging in the equipment; the adapted file comprises a verified URL format and a flow starting parameter filling mode required by the equipment;
the URL generating module is used for locally assembling a local URL at the client by using the adapted file and the identified streaming starting parameter if the query result shows that the adapted file exists, and taking the local URL as a streaming starting URL so as to start a media stream based on the streaming starting URL; wherein the adapted state represents a method of assembling the URL that has been verified.
9. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the streamlining URL obtaining method as recited in any one of claims 1-7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method for fetching a start-streaming URL according to any one of claims 1 to 7.
CN202010859126.XA 2020-08-24 2020-08-24 Method and device for acquiring start-up URL, electronic equipment and storage medium Active CN114189504B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010859126.XA CN114189504B (en) 2020-08-24 2020-08-24 Method and device for acquiring start-up URL, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010859126.XA CN114189504B (en) 2020-08-24 2020-08-24 Method and device for acquiring start-up URL, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114189504A true CN114189504A (en) 2022-03-15
CN114189504B CN114189504B (en) 2024-03-08

Family

ID=80600680

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010859126.XA Active CN114189504B (en) 2020-08-24 2020-08-24 Method and device for acquiring start-up URL, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114189504B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109101564A (en) * 2018-07-16 2018-12-28 阿里巴巴集团控股有限公司 A kind of method, apparatus and electronic equipment of page resource load simultaneously
CN110166831A (en) * 2018-07-23 2019-08-23 腾讯科技(深圳)有限公司 Reset method, apparatus, storage medium and the computer equipment of files in stream media
CN111107445A (en) * 2018-10-29 2020-05-05 浙江宇视科技有限公司 Media protocol stream optimization method and system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109101564A (en) * 2018-07-16 2018-12-28 阿里巴巴集团控股有限公司 A kind of method, apparatus and electronic equipment of page resource load simultaneously
CN110166831A (en) * 2018-07-23 2019-08-23 腾讯科技(深圳)有限公司 Reset method, apparatus, storage medium and the computer equipment of files in stream media
CN111107445A (en) * 2018-10-29 2020-05-05 浙江宇视科技有限公司 Media protocol stream optimization method and system

Also Published As

Publication number Publication date
CN114189504B (en) 2024-03-08

Similar Documents

Publication Publication Date Title
US10367913B2 (en) Systems and methods for tracking user behavior using closed caption text
US10034057B2 (en) Message processing method, device, gateway, STB and IPTV
US10038872B2 (en) Systems and methods for managing video data
CN112188277B (en) Screen projection control method and device, electronic equipment and computer program medium
CN109948334B (en) Vulnerability detection method and system, electronic equipment and storage medium
US20220417302A1 (en) Peer-to-Peer Media Streaming from an Edge Data Storage Device to a Browser
CN110557672B (en) Television program sharing method, television and storage medium
CN110401858B (en) Video playing method and device, electronic equipment and storage medium
CN112040312A (en) Split-screen rendering method, device, equipment and storage medium
US11303969B2 (en) Methods and systems for implementing an elastic cloud based voice search using a third-party search provider
CN111930709A (en) Data storage method and device, electronic equipment and computer readable medium
CA3010007C (en) Systems and methods for bandwidth estimation in oscillating networks
CN114189504B (en) Method and device for acquiring start-up URL, electronic equipment and storage medium
WO2021082945A1 (en) Remote management method and system, terminal device and server
CN115357772A (en) Data processing method and device
US11250267B2 (en) Method and apparatus for processing information associated with video, electronic device, and storage medium
CN115022676B (en) Video stream pushing method and device, electronic equipment and readable medium
WO2019227431A1 (en) Template sharing method used for generating multimedia content, apparatus and terminal device
CN115866171A (en) Video playback method and system based on video monitoring platform
CN118474085A (en) Web playing method and device of camera, computer equipment and storage medium
CN110619007A (en) Data association method, device, equipment and storage medium
CN115827276A (en) Reporting method and device of embedded point information, readable storage medium and electronic equipment

Legal Events

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