CN109218839B - Video playing method and device - Google Patents

Video playing method and device Download PDF

Info

Publication number
CN109218839B
CN109218839B CN201710552518.XA CN201710552518A CN109218839B CN 109218839 B CN109218839 B CN 109218839B CN 201710552518 A CN201710552518 A CN 201710552518A CN 109218839 B CN109218839 B CN 109218839B
Authority
CN
China
Prior art keywords
video
video data
request
data packet
browser
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.)
Active
Application number
CN201710552518.XA
Other languages
Chinese (zh)
Other versions
CN109218839A (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.)
Hangzhou Hikvision Digital Technology Co Ltd
Original Assignee
Hangzhou Hikvision Digital Technology 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 Hangzhou Hikvision Digital Technology Co Ltd filed Critical Hangzhou Hikvision Digital Technology Co Ltd
Priority to CN201710552518.XA priority Critical patent/CN109218839B/en
Publication of CN109218839A publication Critical patent/CN109218839A/en
Application granted granted Critical
Publication of CN109218839B publication Critical patent/CN109218839B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/47End-user applications
    • H04N21/478Supplemental services, e.g. displaying phone caller identification, shopping application
    • H04N21/4782Web browsing, e.g. WebTV
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/238Interfacing the downstream path of the transmission network, e.g. adapting the transmission rate of a video stream to network bandwidth; Processing of multiplex streams
    • H04N21/2387Stream processing in response to a playback request from an end-user, e.g. for trick-play
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/47End-user applications
    • H04N21/472End-user interface for requesting content, additional data or services; End-user interface for interacting with content, e.g. for content reservation or setting reminders, for requesting event notification, for manipulating displayed content
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/80Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
    • H04N21/85Assembly of content; Generation of multimedia applications
    • H04N21/858Linking data to content, e.g. by linking an URL to a video object, by creating a hotspot

Abstract

The invention discloses a video playing method and device, which are applied to video acquisition equipment and belong to the field of video monitoring. The method comprises the following steps: receiving a video playing request sent by a browser, wherein the video playing request carries a video identifier; acquiring a video data packet corresponding to a video based on the video identifier, wherein the video comprises a plurality of video data packets, and the plurality of video data packets are obtained by dividing according to a preset strategy; when each video data packet is acquired, the video data packet is sent to a browser through a websocket interface, and the browser decodes and renders the video data packet through a preset decoder so as to play the video. According to the method and the device, the acquired video data packet can be sent to the browser through the websocket interface, so that the browser plays the video, the operation that the video data packet is sent to the browser by the video acquisition equipment under the condition that the browser disables the plug-in is realized, and the application range of the video acquisition equipment is further expanded.

Description

Video playing method and device
Technical Field
The present invention relates to the field of video monitoring, and in particular, to a video playing method and apparatus.
Background
With the development of the technology, the functions of the browser are more and more enriched, and the application range of playing videos through the browser is wider and wider. For example, in the field of security video monitoring, a browser may be used to play a monitoring video collected by a video collecting device, or a browser may be used to play a monitoring video collected by a video collecting device within a certain time period.
At present, when a browser needs to play a video acquired by a video acquisition device, the browser can send a video playing request to the video acquisition device through a page scripting language javascript; when the video acquisition equipment receives the video playing request, a plug-in downloading notification can be sent to the browser; the browser can download plug-ins such as NPAPI or ActiveX from the video acquisition device according to the plug-in download notification, and sends the download completion notification to the video acquisition device after the download is completed, so that the video acquisition device can send acquired video data to the browser through the plug-ins, the browser reads the video data through the plug-ins such as NPAPI or ActiveX, and then data decoding and rendering are carried out to play the video data.
However, with the development of browsers and security considerations, plug-ins such as NPAPI or ActiveX are disabled by mainstream browsers, that is, downloading of plug-ins by browsers is prohibited, but video playing operations by browsers are completed based on plug-ins, when the plug-ins are disabled, video data cannot be sent to the browsers by video capture devices, and the browsers cannot play videos, so that the application ranges of the video capture devices and the browsers are reduced.
Disclosure of Invention
In order to enable video acquisition equipment to send a video data packet to a browser for video playing under the condition that the browser disables a plug-in, and to increase the application range of the video acquisition equipment and the browser, the embodiment of the invention provides a video playing method and device. The technical scheme is as follows:
in one aspect, a video playing method is provided, which is applied to a video acquisition device, and the method includes:
receiving a video playing request sent by a browser, wherein the video playing request carries a video identifier;
acquiring a video data packet corresponding to a video based on the video identifier, wherein the video comprises a plurality of video data packets, and the video data packets are obtained by dividing according to a preset strategy;
when each video data packet is acquired, the video data packet is sent to the browser through a websocket interface, and the browser decodes and renders the video data packet through a preset decoder so as to play the video.
Optionally, the video playing request further carries a start time and an end time;
the acquiring of the video data packet of the corresponding video based on the video identifier includes:
determining a video corresponding to the video identifier;
and traversing the video corresponding to the video identification to acquire the video data packet of the video from the starting time until the ending time is reached.
Optionally, after the sending the video data packet to the browser through a websocket interface, the method further includes:
detecting whether a control request for the video is received at specified time intervals;
when the control request is detected, controlling the sending of the video data packet based on the control request type.
Optionally, the controlling the sending of the video data packet based on the control request type includes:
when the control request is a pause request, stopping sending the video data packet of the video;
and when the control request is a fast playing request or a slow playing request, controlling the time interval for sending the video data packet based on the acceleration factor carried in the fast playing request or the slow playing request so as to reduce or increase the time interval for sending the video data packet.
Optionally, the controlling, based on an acceleration factor carried in the fast-forward request or the slow-play request, a time interval for sending video data packets to decrease or increase the time interval for sending video data packets includes:
based on the acceleration factor carried in the fast forward request or the slow play request, controlling the time interval for sending the video data packets by the following formula to reduce or increase the time interval for sending the video data packets:
Figure BDA0001344835530000021
wherein, T isAFor the time interval during which video data packets are transmitted, the T1And said T2And the rate is the acceleration factor, and is the sending time point corresponding to each of two adjacent video data packets in the video.
Optionally, the preset decoder is a page scripting language decoder.
In another aspect, a video playing apparatus is provided, which is applied to a video capturing device, and the apparatus includes:
the receiving module is used for receiving a video playing request sent by a browser, wherein the video playing request carries a video identifier;
the acquisition module is used for acquiring a video data packet corresponding to a video based on the video identifier, wherein the video comprises a plurality of video data packets, and the video data packets are obtained by dividing according to a preset strategy;
and the sending module is used for sending the video data packet to the browser through a websocket interface when each video data packet is obtained, and the browser decodes and renders the video data packet through a preset decoder so as to play the video.
Optionally, the video playing request further carries a start time and an end time;
the acquisition module is further configured to:
determining a video corresponding to the video identifier;
and traversing the video corresponding to the video identification to acquire the video data packet of the video from the starting time until the ending time is reached.
Optionally, the apparatus further comprises:
the detection module is used for detecting whether a control request for the video is received or not at specified time intervals;
and the control module is used for controlling the sending of the video data packet based on the type of the control request when the control request is detected.
Optionally, the control module is further configured to:
when the control request is a pause request, stopping sending the video data packet of the video;
and when the control request is a fast playing request or a slow playing request, controlling the time interval for sending the video data packet based on the acceleration factor carried in the fast playing request or the slow playing request so as to reduce or increase the time interval for sending the video data packet.
Optionally, the control module is further configured to:
based on the acceleration factor carried in the fast forward request or the slow play request, controlling the time interval for sending the video data packets by the following formula to reduce or increase the time interval for sending the video data packets:
Figure BDA0001344835530000031
wherein, T isAFor the time interval during which video data packets are transmitted, the T1And said T2And the rate is the acceleration factor, and is the sending time point corresponding to each of two adjacent video data packets in the video.
Optionally, the preset decoder is a page scripting language decoder.
The technical scheme provided by the embodiment of the invention has the following beneficial effects: in the embodiment of the invention, when the video data packet is acquired, the video data packet can be sent to the browser through the websocket interface so as to enable the browser to play the video, so that the browser is not required to download the plug-in from the video acquisition equipment, and the video acquisition equipment is not required to send the video data packet to the browser through the plug-in, the operation that the browser plays the video from the video acquisition equipment under the condition that the plug-in is forbidden by the browser is realized, and the application range of the video acquisition equipment and the browser is further improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1A is a schematic diagram of a video playing system according to an embodiment of the present invention;
fig. 1B is a schematic structural diagram of a websocket service module according to an embodiment of the present invention;
fig. 2 is a flowchart of a video playing method according to an embodiment of the present invention;
fig. 3 is a flowchart of a method for controlling transmission of video data packets according to an embodiment of the present invention;
fig. 4A is a block diagram of a video playing apparatus according to an embodiment of the present invention;
fig. 4B is a block diagram of another video playing apparatus according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a video capture device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
Before explaining the embodiments of the present invention in detail, terms, application scenarios and system architectures related to the embodiments of the present invention are explained separately.
First, terms related to embodiments of the present invention will be described.
javascript
Javascript, js for short, is an object-and event-driven, relatively secure, interpreted scripting language. Meanwhile, the script Language is widely used for client Web (Web) development, and is often used to add dynamic functions to an HTML (hypertext markup Language) Web page, for example, to respond to various operations of a user.
websocket
The websocket is a new feature of HTML5 for implementing an efficient two-way communication mechanism between a server and a client, enabling free two-way messaging over one connection.
SSL (secure sockets layer)
SSL is a security protocol for providing security and data integrity for network communication, and encrypts network connection in a transmission layer, so that the security of data transmission can be guaranteed, and the data cannot be intercepted and eavesdropped in the transmission process on the network.
Next, an application scenario related to the embodiment of the present invention is described.
At present, a browser generally needs to download a corresponding plug-in from a video acquisition device in order to play a video from the video acquisition device, but with the development of the browser and the consideration of safety, the mainstream browser prohibits downloading the plug-in, so that the video acquisition device cannot send video data to the browser through the plug-in, the browser cannot play the video acquired by the video acquisition device, and the application range of the video acquisition device and the browser is reduced. Therefore, the embodiment of the invention provides a video playing method, which can enable video acquisition equipment to send acquired videos to a browser for playing without a plug-in, thereby improving the application range of the video acquisition equipment and the browser and improving the video playing efficiency.
It should be noted that the video playing method provided by the embodiment of the present invention can be applied to various application scenarios, for example, in the field of security video monitoring such as public security and traffic. In the field of safety video monitoring, video is usually acquired through a monitoring camera, and when a user needs to check the video acquired by the monitoring camera, a video playing request can be sent to the monitoring camera by means of a browser; when the monitoring camera receives the video playing request, the video data packet of the stored video can be sent to the browser through the websocket interface, and the browser can decode and render the video data packet when receiving the video data packet, so that the video is played, and a user can watch the video collected by the monitoring camera.
In the embodiment of the present invention, the description is given only by taking the above application scenarios as an example, and the embodiment of the present invention is not limited.
Finally, a system architecture according to an embodiment of the present invention is described.
Fig. 1A is a schematic diagram of a video playing system according to an embodiment of the present invention, and referring to fig. 1A, the system includes a browser 1 and a video capture device 2, where the browser 1 may communicate with the video capture device 2 through a network. For convenience of description, fig. 1A of the embodiment of the present invention illustrates an example in which a browser 1 is installed in a terminal 1. The browser 1 may send a video playing request to the video capture device 2, and when the video capture device 2 receives the video playing request, the video data packet may be sent to the browser 1, so that the browser 1 decodes and renders the video data packet to play the video.
In addition, under the condition that the browser disables the plug-in, in order to enable the video capture device to send the video data packet to the browser for video playing, the websocket service module may be integrated in the video capture device. Referring to fig. 1B, the websocket service module adopts a layered design, wherein a bottom layer of the websocket service module includes an open source library libwebsocket, SSL, socket (socket), and pthread (posixtread, POSIX thread) to realize parsing and packaging of websocket protocol data; the websocket service module internally comprises a software platform function tool set (function tool), websocket session management of an application layer and the like; the upper layer of the websocket service module can provide a set of websocket read-write API (Application Programming Interface) to the outside, and the video acquisition equipment can exchange data with other equipment through the read-write API; and also includes a proprietary SDK (software development kit) protocol by which received requests can be processed.
It should be noted that, in the embodiment of the present invention, the video capture device 2 may be a monitoring camera or other video capture devices with higher processing capability.
In the embodiment of the present invention, when the video acquisition device acquires a video, the acquired video may be stored, and the stored video is divided into a plurality of video data packets according to a preset policy, and the following description will be given of an operation of dividing the acquired video into a plurality of video data packets by the video acquisition device according to the preset policy.
It should be noted that the preset policy may be set in advance, for example, the preset policy may be that the size of the video data packet sent each time is a specified bit, for example, the size of the video data packet sent each time is 50 bits (bits), 60 bits, 100 bits, and the like. Alternatively, the preset policy may be to divide the video into a specified number of video data packets, where the specified number may be 100, 200, and so on.
As can be seen from the above description, the video capture device may send the video data packet to the browser when receiving the video playing request sent by the browser, and therefore, the video capture device may divide the captured video into a plurality of video data packets according to the preset policy before receiving the video playing request, or may divide the captured video into a plurality of video data packets according to the preset policy when receiving the video playing request. However, when the video acquisition device divides the acquired video into a plurality of video data packets according to the preset strategy before receiving the video playing request, the video is divided into a plurality of video data packets in advance, and then when the video acquisition device acquires the video data packets, the video data packets corresponding to the video can be directly acquired, so that the operation of dividing the video data packets is not needed, and the efficiency of acquiring the video data packets is improved. Therefore, in general, the video capture device may divide the captured video into a plurality of video data packets according to a preset policy before receiving the video play request.
In addition, when the video capture device divides the captured video into a plurality of video data packets according to a preset policy before receiving the video play request, if the preset policy is that the size of the video data packet sent each time is a designated bit, the video capture device may divide the video into a plurality of video data packets according to the preset policy in the process of capturing the video, that is, the video capture device may divide one video data packet every time the video with the designated bit is captured, or divide one video frame according to the preset policy every time the video frame is captured, for example, when the preset policy is that the size of the video data packet sent each time is 100 bits, and the size of the video frame captured by the video capture device is 1000 bits, the video frame is divided into 10 video data packets with the size of 100 bits. In practical application, the video capture device may further divide the video into a plurality of video data packets according to a preset policy when the video capture is completed. For example, when the preset policy is that the size of a video data packet sent each time is 100 bits, and the size of a video acquired by the video acquisition device is 10000 bits, the video acquisition device divides the video frame into 100 video data packets with the size of 100 bits. When the preset strategy is to divide the video into a plurality of designated video data packets, the video acquisition device needs to divide the video according to the preset strategy after the video acquisition is completed.
It should be noted that, for each video data packet, the video data packet may include information such as a video playing time length of a video indicated by the video data packet, a start time of the video, and the like. For example, when the video data packet indicates a video with a duration of 10s and a start time of 20 o 'clock 08 min 10 sec, the video data packet may include a video playing duration of 10s (sec) and a start time of 20 o' clock 08 min 10 sec.
In the embodiment of the invention, the video acquisition equipment divides the acquired video into the plurality of video data packets according to the preset strategy in advance, so that when the video acquisition equipment needs to acquire the video data packets, the video data packets corresponding to the video can be directly acquired without dividing the video data packets, and the efficiency of acquiring the video data packets is improved.
As can be seen from the above description, when a user needs to play a video in the video capture device through the browser, a video play request may be sent to the video capture device to obtain the video in the video capture device, so as to play the video. The following describes, with reference to fig. 2, an operation of playing a video in a video capture device by a browser, which specifically includes the following steps.
Step 201: the video acquisition equipment receives a video playing request sent by the browser, wherein the video playing request carries a video identifier.
Due to the variety of video capture devices, a plurality of different types of videos may be included in one video capture device. For example, when the video capture device is a dome camera, because the dome camera can change the angle of capturing the video, when the video capture is performed by the dome camera, videos at a plurality of different angles may be obtained, and in order to facilitate subsequent distinction of the video at each shooting angle, in general, a video identifier may be respectively allocated to the videos shot at the plurality of different shooting angles. Therefore, when a user needs to watch a shot video at a certain angle, in order to quickly and accurately acquire the video to be played, the video playing request sent by the browser can carry a video identifier.
It should be noted that the video identifier is used to uniquely identify the video, and the video identifier may be a name, a number, or the like of the video. Certainly, in practical application, the video playing request may carry not only the video identifier, but also the start time, the end time, and the like.
Step 202: and the video acquisition equipment acquires the video data packet of the corresponding video based on the video identification.
As can be seen from the above description, the video capture device may divide the captured video into a plurality of video data packets according to a preset policy before receiving the video playing request, and therefore, the video capture device may directly obtain the video data packet of the corresponding video based on the video identifier.
In addition, the video playing request can carry not only the video identifier but also the start time and the end time, so that when the video playing request carries the start time and the end time, the video acquisition device can determine the video corresponding to the video identifier; and traversing the video corresponding to the video identifier to acquire the video data packet of the video from the starting time until the ending time is reached.
Each video data packet can include information such as video playing time length of a video indicated by the video data packet, starting time of the video, and the like, so that when the video acquisition device passes through the video corresponding to the video identifier, when it is detected that the starting time of the video included in the video data packet is the same as the starting time carried in the video playing request, the video data packet is obtained from the video data packet including the starting time, and when it is detected that the starting time of the video indicated in the video data packet is the same as the ending time carried in the video playing request, the video data packet is stopped being obtained.
In addition, the video playing request can also carry the starting time, but not the ending time. When the video playing request carries the start time and does not carry the end time, the video acquisition device may start to acquire the video data packets of the video from the start time until all the video data packets after the start time in the video are acquired, or stop acquiring the video data packets when the playing end request is received in the process of acquiring the video data packets.
It should be noted that, because the websocket service module is integrated in the video capture device, the websocket service module includes a private SDK protocol, and the received request can be processed through the private SDK protocol, in this embodiment of the present invention, the video capture device may execute the operation in step 202 through the private SDK protocol.
Step 203: when the video acquisition equipment acquires a video data packet, the video data packet is sent to the browser through the websocket interface.
Therefore, the websocket service module provides a read-write API (websocket interface) to the outside, and data interaction between the video acquisition device and other devices can be realized through the API, so that when the video acquisition device acquires a video data packet, the video data packet can be sent to the browser through the websocket interface.
It should be noted that the websocket interface may be embodied by a websocket function, for example, a websocket _ write _ data function, which may also be another websocket function in practical application. Therefore, when the video capture device sends the video data packet through the websocket interface, the video data packet is sent through the websocket _ write _ data function.
And step 204, when the browser receives the video data, decoding and rendering the video data packet through a preset decoder so as to play the video.
It should be noted that the preset decoder may be a page script language decoder (JS decoder). Of course, other JS-related decoders are also possible in practical applications.
In addition, the operation of decoding and rendering the video data packet by the browser to play the video may refer to related technologies, which is not described in detail herein.
In the embodiment of the invention, when the video data packet is acquired by the video acquisition equipment, the video data packet can be sent to the browser through the websocket interface so that the browser can play the video, so that the browser is not required to download a plug-in from the video acquisition equipment, and the video acquisition equipment is not required to send the video data packet to the browser through the plug-in, the operation that the browser plays the video from the video acquisition equipment under the condition that the plug-in is forbidden by the browser is realized, and the application range of the video acquisition equipment and the browser is further improved. Meanwhile, the browser can play the video in the video acquisition equipment without downloading the plug-in from the video acquisition equipment, so that the video playing efficiency of the browser is improved.
In the embodiment of the invention, as the user possibly needs to pause the video, or fast play the video, or slow play the video for some reasons in the process of playing the video through the browser, at this time, the user can trigger a corresponding control instruction through specified operation, when the browser receives the control instruction, the browser can send a control request to the video acquisition equipment according to the control instruction, and the video acquisition equipment can control the sending of the video data packet according to the control request. The following describes, with reference to fig. 3, an operation of controlling sending of a video data packet by a video capture device, which specifically includes the following steps.
Step 301: it is detected at regular intervals whether a control request for the video is received.
It should be noted that the control request is sent by the browser when receiving a control instruction triggered by a user through a specified operation, where the specified operation may be a click operation, a slide operation, a voice operation, and so on.
Step 302: when the control request is detected, the transmission of the video data packet is controlled based on the type of the control request.
Specifically, when the control request is a pause request, stopping sending the video data packet of the video; and when the control request is a fast play request or a slow play request, controlling the time interval for sending the video data packets based on the acceleration factor carried in the fast play request or the slow play request so as to reduce or increase the time interval for sending the video data packets.
Since the playing time length of the video (the time length of the video indicated by the video data packet) is equal to the sum of the time interval of sending two adjacent video data packets by the video capture device and the time length of actually sending the video data packets, the speed of playing the video can be adjusted by changing the time interval of sending the two adjacent video data packets, and therefore, when the control request is a fast play request or a slow play request, the video capture device can control the time interval of sending the video data packets to reduce or increase the time interval of sending the video data packets by the following formula based on the acceleration factor carried in the fast play request or the slow play request:
Figure BDA0001344835530000101
wherein the content of the first and second substances,in the above formula (1), TATime interval, T, for transmitting video data packets1And T2The rate is the acceleration factor, and is the sending time point corresponding to each of two adjacent video data packets in the video.
It should be noted that, in the embodiment of the present invention, when the sum of the time interval and the sending time is greater than the playing time of the video, the speed of sending the video data packet by the video capture device is slow, the browser plays the video slowly, when the sum of the time interval and the sending time is less than the playing time of the video, the speed of sending the video data packet by the video capture device is fast, and the browser plays the video quickly.
It should be noted that in the above formula (1), 45 represents a clock frequency of 45KHz, but in practical applications, other clock frequencies may be used, such as 50KHz, 60KHz, and so on.
Furthermore, after the video capture device stops sending the video data packet of the video, if the playback resuming request is continuously received, the video capture device may continue sending the video data packet to the browser from the video data packet whose sending is suspended.
It should be noted that, because the websocket service module is integrated in the video capture device, the websocket service module includes a private SDK protocol, and the received request can be processed through the private SDK protocol, in this embodiment of the present invention, the video capture device may execute the operation in step 302 through the private SDK protocol.
In the embodiment of the invention, the video acquisition equipment can process the received control request through the private SDK protocol, thereby realizing the flexible control of video playing and improving the flexibility of video playing.
Fig. 4A is a block diagram of a video playing apparatus according to an embodiment of the present invention, referring to fig. 4A, the video playing apparatus may be implemented by software, hardware, or a combination of the two. The device includes: a receiving module 401, an obtaining module 402 and a sending module 403.
A receiving module 401, configured to receive a video playing request sent by a browser, where the video playing request carries a video identifier;
an obtaining module 402, configured to obtain a video data packet corresponding to a video based on the video identifier, where the video includes multiple video data packets, and the multiple video data packets are obtained by dividing according to a preset policy;
the sending module 403 is configured to, when each video data packet is obtained, send the video data packet to the browser through the websocket interface, and the browser decodes and renders the video data packet through a preset decoder to play the video.
Optionally, the video playing request further carries a start time and an end time;
the obtaining module 401 is further configured to:
determining a video corresponding to the video identifier;
and traversing the video corresponding to the video identification to acquire the video data packet of the video from the starting time until the ending time is reached.
Optionally, referring to fig. 4B, the apparatus further comprises:
a detecting module 404, configured to detect whether a control request for the video is received at specified time intervals;
a control module 405, configured to control sending of the video data packet based on the control request type when the control request is detected.
Optionally, the control module 405 is further configured to:
when the control request is a pause request, stopping sending the video data packet of the video;
and when the control request is a fast playing request or a slow playing request, controlling the time interval for sending the video data packet based on the acceleration factor carried in the fast playing request or the slow playing request so as to reduce or increase the time interval for sending the video data packet.
Optionally, the control module 405 is further configured to:
based on the acceleration factor carried in the fast forward request or the slow play request, controlling the time interval for sending the video data packets by the following formula to reduce or increase the time interval for sending the video data packets:
Figure BDA0001344835530000121
wherein, T isAFor the time interval during which video data packets are transmitted, the T1And said T2And the rate is the acceleration factor, and is the sending time point corresponding to each of two adjacent video data packets in the video.
Optionally, the preset decoder is a page scripting language decoder.
In summary, in the embodiment of the present invention, when acquiring a video data packet, a video capture device may send the video data packet to a browser through a websocket interface, so that the browser performs video playing, so that the browser is not required to download a plug-in from the video capture device, and the video capture device is not required to send the video data packet to the browser through the plug-in, thereby implementing an operation of playing a video from the video capture device by the browser under a condition that the plug-in is disabled by the browser, and thus, the application ranges of the video capture device and the browser are improved. Meanwhile, the browser can play the video in the video acquisition equipment without downloading the plug-in from the video acquisition equipment, so that the video playing efficiency of the browser is improved.
It should be noted that: in the video playing provided by the above embodiment, only the division of the above functional modules is taken as an example for illustration, and in practical applications, the above function distribution may be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the above described functions. In addition, the video playing apparatus and the video playing method provided by the above embodiments belong to the same concept, and specific implementation processes thereof are detailed in the method embodiments and are not described herein again.
Fig. 5 is a block diagram illustrating a video capture device 500 according to an example embodiment. For example, the video capture device 500 may be a surveillance camera or the like.
Referring to fig. 5, video capture device 500 may include one or more of the following components: processing component 502, memory 504, power component 506, multimedia component 508, audio component 510, input/output (I/O) interface 512, sensor component 514, and communication component 516.
The processing component 502 generally controls the overall operation of the video capture device 500, such as operations associated with display, data communication, camera operations, and recording operations. The processing components 502 may include one or more processors 520 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 502 can include one or more modules that facilitate interaction between the processing component 502 and other components. For example, the processing component 502 can include a multimedia module to facilitate interaction between the multimedia component 508 and the processing component 502.
Memory 504 is configured to store various types of data to support operation at video capture device 500. Examples of such data include instructions, messages, pictures, videos, etc. for any application or method operating on video capture device 500. The memory 504 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
Power supply component 506 provides power to the various components of video capture device 500. Power components 506 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for video capture device 500.
Multimedia component 508 includes a screen that provides an output interface between the video capture device 500 and a user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 508 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the video capture device 500 is in an operating mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 510 is configured to output and/or input audio signals. For example, audio component 510 includes a Microphone (MIC) configured to receive external audio signals when video capture device 500 is in an operational mode, such as a recording mode. The received audio signals may further be stored in the memory 504 or transmitted via the communication component 516. In some embodiments, audio component 510 further includes a speaker for outputting audio signals.
The I/O interface 512 provides an interface between the processing component 502 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
Sensor assembly 514 includes one or more sensors for providing various aspects of status assessment for video capture device 500. For example, sensor assembly 514 may detect an open/closed state of video capture device 500, the relative positioning of components, such as a display and keypad of video capture device 500, the change in position of video capture device 500 or a component of video capture device 500, the presence or absence of user contact with video capture device 500, the orientation or acceleration/deceleration of video capture device 500, and the change in temperature of video capture device 500. The sensor assembly 514 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 514 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 514 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
Communication component 516 is configured to facilitate communication between video capture device 500 and other devices in a wired or wireless manner. Video capture device 500 may access a wireless network based on a communication standard, such as WiFi, 2G, or 3G, or a combination thereof. In an exemplary embodiment, the communication component 516 receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 516 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the video capture device 500 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors, or other electronic components for performing the methods provided by the embodiments of fig. 2 or 3 described above.
In an exemplary embodiment, a non-transitory computer-readable storage medium comprising instructions, such as the memory 504 comprising instructions, executable by the processor 520 of the video capture device 500 to perform the above-described method is also provided. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
A non-transitory computer readable storage medium having instructions therein that, when executed by a processor of a video capture device, enable the video capture device to perform the method of fig. 2 or 3 described above.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (8)

1. A video playing method is applied to video acquisition equipment, and is characterized by comprising the following steps:
receiving a video playing request sent by a browser, wherein the video playing request carries a video identifier;
acquiring a video data packet corresponding to a video based on the video identifier, wherein the video comprises a plurality of video data packets, and the video data packets are obtained by dividing according to a preset strategy, and the preset strategy is that the size of each sent video data packet is a designated bit, or the preset strategy is that the video is divided into a designated plurality of video data packets;
when a video data packet is obtained, sending the video data packet to the browser through a webpage socket interface, and decoding and rendering the video data packet through a preset decoder by the browser so as to play the video;
detecting whether a control request for the video is received at intervals of a specified time, wherein the control request is sent when the browser receives a control instruction triggered by a user through a specified operation, and the control request comprises a pause request, a fast play request and a slow play request;
when the control request is the pause request, stopping sending the video data packet of the video;
and when the control request is the fast playing request or the slow playing request, controlling the time interval for sending the video data packet based on an acceleration factor carried in the fast playing request or the slow playing request so as to reduce or increase the time interval for sending the video data packet.
2. The method of claim 1, wherein the video playing request further carries a start time and an end time;
the acquiring of the video data packet of the corresponding video based on the video identifier includes:
determining a video corresponding to the video identifier;
and traversing the video corresponding to the video identification to acquire the video data packet of the video from the starting time until the ending time is reached.
3. The method of claim 1, wherein the controlling the time interval for sending video data packets to decrease or increase the time interval for sending video data packets based on the acceleration factor carried in the fast play request or the slow play request comprises:
based on the fast playing request or the acceleration factor carried in the slow playing request, controlling the time interval for sending the video data packets by the following formula to reduce or increase the time interval for sending the video data packets:
Figure FDA0003174048840000021
wherein, T isAFor the time interval during which video data packets are transmitted, the T1And said T2And the rate is the acceleration factor, and is the sending time point corresponding to each of two adjacent video data packets in the video.
4. A method according to any one of claims 1 to 3, wherein the pre-set decoder is a page script language decoder.
5. A video playing device is applied to video acquisition equipment, and is characterized in that the device comprises:
the receiving module is used for receiving a video playing request sent by a browser, wherein the video playing request carries a video identifier;
the acquisition module is used for acquiring a video data packet corresponding to a video based on the video identifier, wherein the video comprises a plurality of video data packets, the video data packets are obtained by dividing according to a preset strategy, and the preset strategy is that the size of each sent video data packet is a designated bit, or the preset strategy is that the video is divided into a designated plurality of video data packets;
the sending module is used for sending the video data packet to the browser through a webpage socket interface when each video data packet is obtained, and the browser decodes and renders the video data packet through a preset decoder so as to play the video;
the detection module is used for detecting whether a control request for the video is received or not at specified time intervals, wherein the control request is sent when the browser receives a control instruction triggered by a user through specified operation, and the control request comprises a pause request, a fast play request and a slow play request;
the control module is used for stopping sending the video data packet of the video when the control request is the pause request; and when the control request is the fast playing request or the slow playing request, controlling the time interval for sending the video data packet based on an acceleration factor carried in the fast playing request or the slow playing request so as to reduce or increase the time interval for sending the video data packet.
6. The apparatus of claim 5, wherein the video playing request further carries a start time and an end time;
the acquisition module is further configured to:
determining a video corresponding to the video identifier;
and traversing the video corresponding to the video identification to acquire the video data packet of the video from the starting time until the ending time is reached.
7. The apparatus of claim 5, wherein the control module is further to:
based on the fast playing request or the acceleration factor carried in the slow playing request, controlling the time interval for sending the video data packets by the following formula to reduce or increase the time interval for sending the video data packets:
Figure FDA0003174048840000031
wherein, T isAFor the time interval during which video data packets are transmitted, the T1And said T2And the rate is the acceleration factor, and is the sending time point corresponding to each of two adjacent video data packets in the video.
8. The apparatus of any one of claims 5-7, wherein the pre-set decoder is a page scripting language decoder.
CN201710552518.XA 2017-07-07 2017-07-07 Video playing method and device Active CN109218839B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710552518.XA CN109218839B (en) 2017-07-07 2017-07-07 Video playing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710552518.XA CN109218839B (en) 2017-07-07 2017-07-07 Video playing method and device

Publications (2)

Publication Number Publication Date
CN109218839A CN109218839A (en) 2019-01-15
CN109218839B true CN109218839B (en) 2021-09-03

Family

ID=64991402

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710552518.XA Active CN109218839B (en) 2017-07-07 2017-07-07 Video playing method and device

Country Status (1)

Country Link
CN (1) CN109218839B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109819315A (en) * 2019-03-21 2019-05-28 广州华多网络科技有限公司 Playback method, device, terminal and the storage medium of HEVC video
CN111428080B (en) * 2019-04-25 2024-02-27 杭州海康威视数字技术股份有限公司 Video file storage method, video file search method and video file storage device
CN110121112A (en) * 2019-05-14 2019-08-13 重庆商勤科技有限公司 A kind of video playing control method based on browser, system and device
CN110708609A (en) * 2019-08-05 2020-01-17 青岛海信传媒网络技术有限公司 Video playing method and device
CN110460618B (en) * 2019-08-26 2022-06-07 南京国电南自轨道交通工程有限公司 Safe communication method in integrated monitoring system based on EN50159 standard
CN112437076A (en) * 2020-11-18 2021-03-02 广州供电局有限公司 Power grid video live broadcast platform and power grid video live broadcast method
CN113810767B (en) * 2021-09-13 2024-02-13 南京国电南自电网自动化有限公司 Video real-time monitoring method and system based on websocket
CN117041500B (en) * 2023-10-08 2024-01-02 四川省公路规划勘察设计研究院有限公司 Video access method applied to field highway engineering

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104080014A (en) * 2013-03-28 2014-10-01 浙江大华技术股份有限公司 Real-time video processing method and device
CN104243520A (en) * 2013-06-18 2014-12-24 华为终端有限公司 Remote monitoring method, device and system
CN105915394A (en) * 2016-06-20 2016-08-31 河南派亚尼尔自动化设备有限公司 Visual monitoring platform based on HTML5 and application method
CN106060674A (en) * 2016-06-27 2016-10-26 武汉斗鱼网络科技有限公司 System and method for achieving intelligent video live broadcast on front end
CN106162062A (en) * 2015-04-10 2016-11-23 深圳市视高电子技术有限公司 Obtain the method and system of monitor video
CN106506632A (en) * 2016-10-27 2017-03-15 上海幻电信息科技有限公司 A kind of audio frequency and video live broadcasting method based on HTML5 browsers
CN106506525A (en) * 2016-11-29 2017-03-15 北京旷视科技有限公司 For playing the method and device of video flowing on a web browser
CN106899872A (en) * 2017-03-10 2017-06-27 深圳市合互联技术有限责任公司 A kind of information displaying method of real-time interactive

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6271203B2 (en) * 2013-09-30 2018-01-31 株式会社東芝 Electronic device, program, and information control method

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104080014A (en) * 2013-03-28 2014-10-01 浙江大华技术股份有限公司 Real-time video processing method and device
CN104243520A (en) * 2013-06-18 2014-12-24 华为终端有限公司 Remote monitoring method, device and system
CN106162062A (en) * 2015-04-10 2016-11-23 深圳市视高电子技术有限公司 Obtain the method and system of monitor video
CN105915394A (en) * 2016-06-20 2016-08-31 河南派亚尼尔自动化设备有限公司 Visual monitoring platform based on HTML5 and application method
CN106060674A (en) * 2016-06-27 2016-10-26 武汉斗鱼网络科技有限公司 System and method for achieving intelligent video live broadcast on front end
CN106506632A (en) * 2016-10-27 2017-03-15 上海幻电信息科技有限公司 A kind of audio frequency and video live broadcasting method based on HTML5 browsers
CN106506525A (en) * 2016-11-29 2017-03-15 北京旷视科技有限公司 For playing the method and device of video flowing on a web browser
CN106899872A (en) * 2017-03-10 2017-06-27 深圳市合互联技术有限责任公司 A kind of information displaying method of real-time interactive

Also Published As

Publication number Publication date
CN109218839A (en) 2019-01-15

Similar Documents

Publication Publication Date Title
CN109218839B (en) Video playing method and device
JP6423445B2 (en) Multimedia data reproduction method, apparatus and system
EP3188066B1 (en) A method and an apparatus for managing an application
EP3136648B1 (en) Method and device for determining control authority on user device
KR101777693B1 (en) Screen projection method, apparatus, system, program and recording medium
CN106911961B (en) Multimedia data playing method and device
JP6626440B2 (en) Method and apparatus for playing multimedia files
JP6363304B2 (en) Method, apparatus, program and recording medium for broadcasting information in delay
US10425403B2 (en) Method and device for accessing smart camera
WO2017035990A1 (en) Method and apparatus for installing smart device plug-in
JP6062117B2 (en) LIGHT APP OFFLINE UPDATE METHOD, DEVICE, TERMINAL, PROGRAM, AND RECORDING MEDIUM
WO2022028234A1 (en) Live broadcast room sharing method and apparatus
US10945019B2 (en) Video uploading method, camera apparatus and storage medium
KR102591803B1 (en) Video interaction methods, devices, electronic equipment and storage media
CN111031332B (en) Data interaction method, device, server and storage medium
WO2021249318A1 (en) Screen projection method and terminal
RU2673560C1 (en) Method and system for displaying multimedia information, standardized server and direct broadcast terminal
RU2666626C1 (en) Playback state controlling method and device
JP2016537904A (en) WI-FI network connection method, apparatus, program, and recording medium
CN112312222A (en) Video sending method and device and electronic equipment
CN112822431B (en) Method and equipment for private audio and video call
CN104639977A (en) Program playing method and device
WO2024056088A1 (en) Live-streaming reservation method and apparatus, and device, medium and product
CN110769275B (en) Method, device and system for processing live data stream
WO2019000191A1 (en) System message receiving method and system message receiving device

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