CN110113630B - Video detection method and device, electronic equipment and storage medium - Google Patents

Video detection method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN110113630B
CN110113630B CN201910530081.9A CN201910530081A CN110113630B CN 110113630 B CN110113630 B CN 110113630B CN 201910530081 A CN201910530081 A CN 201910530081A CN 110113630 B CN110113630 B CN 110113630B
Authority
CN
China
Prior art keywords
screenshot
playing
video
time
histogram
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
CN201910530081.9A
Other languages
Chinese (zh)
Other versions
CN110113630A (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.)
Beijing Dajia Internet Information Technology Co Ltd
Original Assignee
Beijing Dajia Internet Information 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 Beijing Dajia Internet Information Technology Co Ltd filed Critical Beijing Dajia Internet Information Technology Co Ltd
Priority to CN201910530081.9A priority Critical patent/CN110113630B/en
Publication of CN110113630A publication Critical patent/CN110113630A/en
Application granted granted Critical
Publication of CN110113630B publication Critical patent/CN110113630B/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/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/234Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs
    • H04N21/23418Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs involving operations for analysing video streams, e.g. detecting features or characteristics
    • 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/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
    • H04N21/44008Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving operations for analysing video streams, e.g. detecting features or characteristics in the video stream

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Debugging And Monitoring (AREA)
  • Testing, Inspecting, Measuring Of Stereoscopic Televisions And Televisions (AREA)

Abstract

The disclosure relates to a video detection method, a video detection device, an electronic device and a storage medium. According to the method, the difference between the screenshot at the first playing time and the screenshot at the second playing time and the difference between the screenshot at the first playing time or the screenshot at the second playing time and the screenshot at the third playing time are obtained, and the screenshot can represent the picture played by the video at the screenshot time, so that whether the difference exists between the played pictures at all the screenshot times can be represented based on the difference between the screenshots at all the different times, and whether the video playing is abnormal or not can be detected.

Description

Video detection method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a video detection method and apparatus, an electronic device, and a storage medium.
Background
With the development of internet technology, more and more video applications appear in the application market, but in the video playing process, due to coding or decoding errors and other reasons, the video cannot be played, so that the detection of whether the video can be played becomes an important link in the video application development.
At present, when the video playing is detected, manual operation is needed, the video is detected one by one, whether the video can be played normally is judged, the manual detection mode needs manual intervention, the operation is complex, the time consumption is long, and the detection efficiency is extremely low.
Disclosure of Invention
The present disclosure provides a video detection method, apparatus, electronic device and storage medium, so as to at least solve the problem of low video detection efficiency in the related art. The technical scheme of the disclosure is as follows:
according to a first aspect of the embodiments of the present disclosure, there is provided a video detection method, including:
circularly playing the video to be detected;
acquiring a first screenshot of a first playing moment, a second screenshot of a second playing moment and a third screenshot of a third playing moment in a circulating playing process, wherein the first playing moment and the second playing moment belong to different playing moments of the same playing in the circulating playing process, the first playing moment and the third playing moment respectively belong to different playing in the circulating playing process, and any one of the third playing moment and the first playing moment or the second playing moment corresponds to different frames of the video;
acquiring a first difference value between the first screenshot and the second screenshot and a second difference value between any one of the first screenshot or the second screenshot and the third screenshot;
and determining whether the video is abnormal or not based on the first difference value and the second difference value.
In one possible implementation manner, the obtaining a first difference value between the first screenshot and the second screenshot, and a second difference value between either the first screenshot or the second screenshot and the third screenshot includes:
acquiring a first histogram, a second histogram and a third histogram, wherein the first histogram, the second histogram and the third histogram are respectively used for representing the distribution situation of pixel values in the first screenshot, the second screenshot and the third screenshot;
acquiring a difference value between the first histogram and the second histogram as a first difference value between the first screenshot and the second screenshot;
and acquiring a difference value between any one of the first histogram or the second histogram and the third histogram as a second difference value between any one of the first screenshot or the second screenshot and the third screenshot.
In one possible implementation, the obtaining the first histogram, the second histogram, and the third histogram includes:
respectively counting pixel values in the first screenshot, the second screenshot and the third screenshot;
and respectively generating the first histogram, the second histogram and the third histogram according to the pixel values in the first screenshot, the second screenshot and the third screenshot by taking the pixel value as a horizontal axis coordinate and the number of pixel points corresponding to each pixel value as a vertical coordinate.
In one possible implementation manner, the determining whether there is an abnormality in playing the video based on the first difference value and the second difference value includes:
comparing the first difference value and the second difference value with a target threshold value respectively;
if the second difference value is larger than the target threshold value, determining that the video is not abnormal in playing;
if the second difference value is smaller than the target threshold value and the first difference value is smaller than the target threshold value, determining that the video is abnormally played;
if the second difference value is smaller than the target threshold and is not 0, and the first difference value is larger than the target threshold, it is determined that the video is abnormally played.
In a possible implementation manner, before obtaining the first screenshot at the first playing time, the second screenshot at the second playing time, and the third screenshot at the third playing time in the loop playing process, the method further includes:
acquiring the video time length of the video;
according to the video time length, respectively determining any two different playing times with the interval smaller than the video time length from the starting time of the video playing as the first playing time and the second playing time;
and determining any play time which has a time interval larger than the video time length from the video play start time as the third play time according to the video time length.
In a possible implementation manner, before obtaining the first screenshot at the first playing time, the second screenshot at the second playing time, and the third screenshot at the third playing time in the loop playing process, the method further includes:
detecting whether the third playing time and the first playing time or the second playing time correspond to the same frame of the video;
and if the third playing time and any one of the first playing time or the second playing time correspond to the same frame of the video, re-taking the value of the third playing time.
In one possible implementation, the loop playing the video to be detected includes:
based on an automatic test framework, simulating the operation of a user on a target page, and automatically and circularly playing a plurality of videos to be detected in the target page.
According to a second aspect of the embodiments of the present disclosure, there is provided a video detection apparatus including:
the playing unit is configured to play the video to be detected in a circulating manner;
the screenshot obtaining unit is configured to obtain a first screenshot of a first playing time, a second screenshot of a second playing time and a third screenshot of a third playing time in a cyclic playing process, wherein the first playing time and the second playing time are different playing times belonging to the same playing time in the cyclic playing process, the first playing time and the third playing time respectively belong to different playing times in the cyclic playing process, and any one of the third playing time and the first playing time or the second playing time corresponds to different frames of the video;
a difference value acquiring unit configured to acquire a first difference value between the first screenshot and the second screenshot, and a second difference value between either the first screenshot or the second screenshot and the third screenshot;
a determining unit configured to determine whether there is an abnormality in playing the video based on the first difference value and the second difference value.
In one possible implementation, the difference value obtaining unit is configured to:
acquiring a first histogram, a second histogram and a third histogram, wherein the first histogram, the second histogram and the third histogram are respectively used for representing the distribution situation of pixel values in the first screenshot, the second screenshot and the third screenshot;
acquiring a difference value between the first histogram and the second histogram as a first difference value between the first screenshot and the second screenshot;
and acquiring a difference value between any one of the first histogram or the second histogram and the third histogram as a second difference value between any one of the first screenshot or the second screenshot and the third screenshot.
In one possible implementation, the difference value obtaining unit is configured to:
respectively counting pixel values in the first screenshot, the second screenshot and the third screenshot;
and respectively generating the first histogram, the second histogram and the third histogram according to the pixel values in the first screenshot, the second screenshot and the third screenshot by taking the pixel value as a horizontal axis coordinate and the number of pixel points corresponding to each pixel value as a vertical coordinate.
In one possible implementation, the determining unit is configured to:
comparing the first difference value and the second difference value with a target threshold value respectively;
if the second difference value is larger than the target threshold value, determining that the video is not abnormal in playing;
if the second difference value is smaller than the target threshold value and the first difference value is smaller than the target threshold value, determining that the video is abnormally played;
if the second difference value is smaller than the target threshold and is not 0, and the first difference value is larger than the target threshold, it is determined that the video is abnormally played.
In one possible implementation, the apparatus further includes:
a duration acquisition unit configured to acquire a video duration of the video;
the first time determining unit is configured to determine any two different playing times with an interval smaller than the video time length from the starting time of the video playing as the first playing time and the second playing time respectively according to the video time length;
and the second time acquisition unit is configured to determine any play time which is spaced from the starting time of the video playing by more than the video time length as the third play time according to the video time length.
In one possible implementation, the apparatus further includes:
a detection unit configured to detect whether the third playing time and the first playing time or the second playing time correspond to the same frame of the video;
and the value taking unit is configured to take a value again for the third playing time if the third playing time and any one of the first playing time and the second playing time correspond to the same frame of the video.
In one possible implementation, the playback unit is configured to:
based on an automatic test framework, simulating the operation of a user on a target page, and automatically and circularly playing a plurality of videos to be detected in the target page.
According to a third aspect of embodiments of the present disclosure, there is provided a computer device comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the video detection method as in any one of the above.
According to a fourth aspect of embodiments of the present disclosure, there is provided a computer-readable storage medium, wherein instructions, when executed by a processor of a computer device, enable the computer device to perform the video detection method according to any one of the above.
According to a fifth aspect of embodiments of the present disclosure, there is provided a computer program product comprising executable instructions that, when executed by a processor of a computer device, enable the computer device to perform the video detection method as defined in any one of the above.
According to the technical scheme provided by the embodiment of the disclosure, the difference between the screenshot at the first playing time and the screenshot at the second playing time and the difference between the screenshot at the first playing time or the screenshot at the second playing time and the screenshot at the third playing time are obtained, and the screenshot can represent the picture played by the video at the screenshot time, so that whether the difference exists between the played pictures at all the screenshot times can be represented based on the difference between the screenshots at all the different times, and whether the video playing is abnormal or not can be detected.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure and are not to be construed as limiting the disclosure.
FIG. 1 is a flow diagram illustrating a video detection method in accordance with an exemplary embodiment;
FIG. 2 is a flow diagram illustrating a particular implementation of video detection, according to an example embodiment;
FIG. 3 is a block diagram illustrating a video detection device according to an exemplary embodiment;
FIG. 4 is a block diagram illustrating a computer device according to an example embodiment.
Detailed Description
In order to make the technical solutions of the present disclosure better understood by those of ordinary skill in the art, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the disclosure described herein are capable of operation in sequences other than those illustrated or otherwise described herein. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
Fig. 1 is a flow chart illustrating a video detection method, as shown in fig. 1, for use in a computer device, according to an exemplary embodiment, including the following steps.
In step 101, the video to be detected is played in a loop.
In step 102, a first screenshot of a first playing time, a second screenshot of a second playing time, and a third screenshot of a third playing time in a loop playing process are obtained, where the first playing time and the second playing time are different times of a same playing in the loop playing process, the first playing time and the third playing time respectively belong to different times of the playing in the loop playing process, and any one of the third playing time and the first playing time or the second playing time corresponds to a different frame of the video.
In step 103, a first difference value between the first screenshot and the second screenshot and a second difference value between any one of the first screenshot or the second screenshot and the third screenshot are obtained.
In step 104, it is determined whether there is an abnormality in the playing of the video based on the first difference value and the second difference value.
According to the embodiment provided by the disclosure, the difference between the screenshot at the first playing moment, the screenshot at the second playing moment and the screenshot at the third playing moment is obtained, and the screenshot can represent the picture played by the video at the screenshot moment, so that whether the difference exists between the played pictures at all the screenshot moments can be represented based on the difference between the screenshots at all the different moments, and therefore the video detection is realized.
In one possible implementation manner, the obtaining a first difference value between the first screenshot and the second screenshot, and a second difference value between either the first screenshot or the second screenshot and the third screenshot includes:
acquiring a first histogram, a second histogram and a third histogram, wherein the first histogram, the second histogram and the third histogram are respectively used for representing the distribution situation of pixel values in the first screenshot, the second screenshot and the third screenshot;
acquiring a difference value between the first histogram and the second histogram as a first difference value between the first screenshot and the second screenshot;
and acquiring a difference value between any one of the first histogram or the second histogram and the third histogram as a second difference value between any one of the first screenshot or the second screenshot and the third screenshot.
In one possible implementation, the obtaining the first histogram, the second histogram, and the third histogram includes:
respectively counting pixel values in the first screenshot, the second screenshot and the third screenshot;
and respectively generating the first histogram, the second histogram and the third histogram according to the pixel values in the first screenshot, the second screenshot and the third screenshot by taking the pixel value as a horizontal axis coordinate and the number of pixel points corresponding to each pixel value as a vertical coordinate.
In one possible implementation manner, the determining whether there is an abnormality in playing the video based on the first difference value and the second difference value includes:
comparing the first difference value and the second difference value with a target threshold value respectively;
if the second difference value is larger than the target threshold value, determining that the video is not abnormal in playing;
if the second difference value is smaller than the target threshold value and the first difference value is smaller than the target threshold value, determining that the video is abnormally played;
if the second difference value is smaller than the target threshold and is not 0, and the first difference value is larger than the target threshold, it is determined that the video is abnormally played.
In a possible implementation manner, before obtaining the first screenshot at the first playing time, the second screenshot at the second playing time, and the third screenshot at the third playing time in the loop playing process, the method further includes:
acquiring the video time length of the video;
according to the video time length, respectively determining any two different playing times with the interval smaller than the video time length from the starting time of the video playing as the first playing time and the second playing time;
and determining any play time which has a time interval larger than the video time length from the video play start time as the third play time according to the video time length.
In a possible implementation manner, before obtaining the first screenshot at the first playing time, the second screenshot at the second playing time, and the third screenshot at the third playing time in the loop playing process, the method further includes:
detecting whether the third playing time and the first playing time or the second playing time correspond to the same frame of the video;
and if the third playing time and any one of the first playing time or the second playing time correspond to the same frame of the video, re-taking the value of the third playing time.
In one possible implementation, the loop playing the video to be detected includes:
based on an automatic test framework, simulating the operation of a user on a target page, and automatically and circularly playing a plurality of videos to be detected in the target page.
The above-described embodiments are merely a brief introduction to embodiments of the disclosure and a brief introduction to various possible implementations. In order to reduce the human intervention degree in the video detection process and further improve the video detection efficiency, in a possible implementation manner, the computer device can use an application program automation test framework to complete the video detection process. The application program automatic testing framework is used for simulating user behaviors and automatically operating the tested application program. Before video detection is carried out, developers need to write a test script, namely a plurality of instructions required by the video detection at this time, and the application program automation test framework executes the plurality of instructions in the test script in the video detection process so as to realize automatic video detection.
In the embodiment of the present disclosure, an Application (mobile Application Programming Interface) is used for video detection, and the mobile Application Programming Interface testing framework can support cross-platform Application testing, allow developers to write codes using the same set of API (Application Programming Interface) on different platforms, and improve reusability of the codes.
As shown in fig. 2, fig. 2 is a flowchart illustrating a specific implementation of video detection according to an exemplary embodiment, which specifically includes the following steps:
in step 201, the computer device obtains a video to be detected in the target page, and cyclically plays the video to be detected.
Any application program with a video playing function can be installed on the computer equipment, and the application program can acquire videos from the server and play the videos. Taking a short video application as an example, in the process of testing the function of the short video application, when a video detection instruction is received, the computer device can respond to the video detection instruction, cyclically play the video to be detected, and execute the subsequent video detection step.
The target page may be used to provide a function of displaying video information, for example, in a short video application, the target page may be a video list page.
In one possible implementation manner, the computer device may simulate a user's operation on a target page based on an automated testing framework, and automatically and circularly play a plurality of videos to be detected in the target page. The method specifically comprises the following steps:
the method comprises the steps that firstly, the computer equipment identifies a video link in a target page through the automatic testing framework of the mobile application program, simulates the clicking operation of a user, clicks the video link, and triggers a video playing instruction.
And step two, the computer equipment receives the video playing instruction, acquires video data corresponding to the video connection from a server, decodes the video data, and converts the video data into a video which can be played on the computer equipment.
And step three, circularly playing the video to be detected by the computer equipment.
In a possible implementation manner, the loop playing may be performed by setting a target playing time, and accordingly, the process of playing the video to be detected in a loop may include: when the video to be detected is obtained, the video duration of the video to be detected is obtained, the playing time is timed while the video to be detected is played, when the timed video duration reaches the video duration, the video to be detected is played again, the above processes are repeated until the target playing times are reached, and the detection process of one video is completed. The realization mode of the circular playing can avoid the situation that the automatic circular playing cannot be carried out due to the situations of video blocking and the like, and the success rate of detection is improved.
In a possible implementation manner, the loop playing may be performed by setting a target playing duration, and accordingly, the process of playing the video to be detected in a loop may include: when the video to be detected is acquired, the video is set to be automatically played in a circulating mode, the playing time is timed, and the circulating playing is finished until the target playing time is reached, so that the detection process of one video is completed. The implementation mode of the circular playing can set an end point for detection, and the condition that the detection fails due to video jamming is avoided.
The setting mode of the target playing duration can be realized in two modes as follows:
in a first implementation manner, before the video is played, a developer sets the target playing time, that is, the target playing time is preset, and the target playing time is the same for any video with the video time. Generally, the target playing time length is longer than the video time length of the video to be detected, so as to ensure that the video to be detected can be played circularly within the target playing time length.
In a second implementation manner, the computer device may determine a target playing time length corresponding to the video in real time, that is, the target playing time length may be different according to different video time lengths of the video to be detected.
In a possible implementation manner, after the computer device obtains the video to be detected, the video duration of the video is determined, and based on the video duration, the target playing duration corresponding to the video is set, for example, the target playing duration may be set to be twice as long as the video duration. By determining the target playing time length based on the video time length, the problem that playing cannot be completed within the target playing time length due to too long video time length or repeated cyclic playing within the target playing time length due to too short video time length can be avoided, the accuracy of a detection result is ensured, and the video detection efficiency is improved.
In step 202, in the process of loop playing, the computer device obtains a first screenshot of a first playing time of the video, a second screenshot of a second playing time of the video, and a third screenshot of a third playing time of the video, where the first playing time and the second playing time are different times of the same playing in the process of loop playing, the first playing time and the third playing time respectively belong to different times of playing in the process of loop playing, and any one of the third playing time and the first playing time or the second playing time corresponds to a different frame of the video.
In the embodiment of the present disclosure, in order to detect whether the playing of the video is abnormal, that is, whether the video can be played and whether the video can be played circularly, the computer device needs to obtain screenshots of two different times played at the same time in the video circular playing process and screenshots of a certain time played at different times in the video circular playing process. The setting of the plurality of screenshot moments by the computer device may specifically include any one of the following implementation manners:
in a first implementation manner, before the video to be detected is played in a circulating manner, a developer may set a plurality of screenshot moments based on an average value of the durations of the plurality of videos to be detected, so that intervals between an initial moment of video playing and the first playing moment and between the initial moment of video playing and the second playing moment are all smaller than the average video duration, the second playing moment is behind the first playing moment to ensure that the first playing moment and the second playing moment belong to the same playing, and the interval between the initial moment of video playing and the third playing moment is larger than the video duration to ensure that the third playing moment and the first playing moment belong to different playing.
In a second implementation manner, the computer device can automatically take values of a plurality of screenshot moments according to the video duration of each video to be detected. That is, the method further includes: firstly, the computer equipment acquires the video time length of the video, then, according to the video time length, any two different playing times with the interval between the two different playing times being smaller than the video time length are respectively determined as the first playing time and the second playing time so as to ensure that the first playing time and the second playing time belong to the same playing, and finally, according to the video time length, the computer equipment determines any one time with the interval between the two different playing times being larger than the video time length as the third playing time so as to ensure that the third playing time and the first playing time belong to different playing. Taking the video duration of the video as 11 seconds as an example, first, the computer device obtains the video duration of the video, then, the computer device arbitrarily takes two moments as a first playing moment and a second playing moment between 0 second and 11 seconds, for example, 1 second may be determined as the first playing moment, 5 seconds may be determined as the second playing moment, and finally, the computer device selects a third playing moment at any moment between 11 seconds and 22 seconds, for example, 15 seconds may be determined as the third playing moment.
In order to reduce the value complexity of each screenshot time and improve the video detection efficiency, in a possible implementation manner, the computer device may determine the starting time of the video playing as the first playing time. That is, the method for determining the screenshot time includes: the computer equipment determines the starting moment of video playing as a first playing moment, determines any moment with the interval less than or equal to the video duration from the starting moment as a second playing moment, and determines any moment with the interval greater than the video duration from the starting moment and less than or equal to two times the video duration as a third playing moment.
In order to ensure the validity of the acquired multiple screenshots and improve the accuracy of the video detection result, the computer device may detect the validity of the value at the third playing time after determining the third playing time, and in a possible implementation manner, the computer device detects the value at the third playing time, specifically including the following steps:
step one, the computer equipment detects whether the third playing time and the first playing time or the second playing time correspond to the same frame of the video.
The computer equipment detects a first playing time and a second playing time obtained by the computer equipment in the video circulating playing process, compares the first playing time and the second playing time with the obtained third playing time, and judges whether the third playing time is coincident with any one of the first playing time and the second playing time.
And secondly, if the third playing time and any one of the first playing time or the second playing time correspond to the same frame of the video, the value of the third playing time is re-taken.
By detecting the value of the third playing time, the situation that the detection result is wrong due to the fact that the third screenshot is identical to the first screenshot or the second screenshot because the third screenshot is coincident with any one of the first playing time or the second playing time can be avoided, and the accuracy of the video detection result is improved.
The computer equipment automatically acquires the first screenshot, the second screenshot and the third screenshot in the video circulation playing process based on the screenshot method provided by the mobile application program automatic testing framework, and stores the acquired screenshots to a target storage position.
After obtaining the plurality of screenshots, the computer device stores the plurality of screenshots to a target storage position, and specifically comprises the following steps:
step one, the computer device names each screenshot according to the acquisition time of each screenshot.
The computer adds a timestamp mark when naming each screenshot, and the timestamp mark can be used for uniquely identifying the acquisition time of the screenshot, so that the acquired screenshot is prevented from being covered by the subsequently acquired screenshot.
And step two, the computer equipment acquires the target storage position of each screenshot and stores the named screenshot to the target storage position.
In the embodiment of the present disclosure, the computer device stores a plurality of screenshots of all video samples in the detection process to the same target storage location, where the target storage location may be a default image storage folder of the automated testing framework for the mobile application program, or a storage folder preset by a developer.
In the above embodiment, the screenshot process of the computer device and the difference value determining process based on the screenshot may be performed synchronously or asynchronously, that is, when the computer device detects a video, the multiple screenshots of the video may be stored in the target storage location, and then the difference value obtaining steps of the multiple screenshots are directly executed, and after the multiple screenshots of all the videos to be detected are stored, the subsequent difference value obtaining steps are executed based on the stored screenshots.
In step 203, the computer device obtains a first difference value between the first screenshot and the second screenshot, and a second difference value between either the first screenshot or the second screenshot and the third screenshot.
The computer equipment obtains difference values among a plurality of screenshots, and specifically comprises the following steps:
the method comprises the following steps that firstly, the computer equipment obtains a first histogram, a second histogram and a third histogram, wherein the first histogram, the second histogram and the third histogram are respectively used for representing the distribution situation of pixel values in the first screenshot, the second screenshot and the third screenshot.
The histogram may be used to represent a distribution of pixel values of the screenshot, and an abscissa of the histogram is the pixel value and an ordinate is the number of the pixel values in the screenshot.
The computer device respectively counts pixel values in the first screenshot, the second screenshot and the third screenshot, and generates the first histogram, the second histogram and the third histogram according to the pixel values in the first screenshot, the second screenshot and the third screenshot by taking the pixel value as a horizontal axis coordinate and taking the number of pixel points corresponding to each pixel value as a vertical coordinate. In a possible implementation manner, first, the computer device reads a first screenshot, a second screenshot, and a third screenshot in a target storage location, inputs the multiple captured screenshots into a PIL (Python Imaging Library) module for image processing, converts the screenshots into a multi-dimensional pixel matrix, then, the computer device counts the number of each pixel value in the multi-dimensional pixel matrix, and finally, based on a pixel value counting result, draws a histogram corresponding to the screenshot.
And step two, the computer equipment acquires a difference value between the first histogram and the second histogram as a first difference value between the first screenshot and the second screenshot.
Wherein the first difference value may be used to indicate a pixel value distribution difference between the first and second screenshots.
The computer device can obtain a difference value between the first histogram and the second histogram based on a difference value calculation method provided by the mobile application automation test framework.
And step three, the computer equipment acquires a difference value between any one histogram of the first histogram or the second histogram and the third histogram as a second difference value between any one screenshot of the first screenshot or the second screenshot and the third histogram.
The third step is similar to the second step, and will not be described herein.
In this disclosure, an execution sequence of first obtaining the first difference value and then obtaining the second difference value is used for description, but in some possible embodiments, the second difference value may be obtained first and then the first difference value is obtained, or the two steps are performed simultaneously, which is not specifically limited in this disclosure.
In step 204, the computer device determines whether there is an abnormality in the playing of the video based on the first difference value and the second difference value.
The computer device compares the first difference value and the second difference value with a target threshold value respectively. The target threshold value can be set by a developer according to a specific task scene, when the first difference value is larger than the target threshold value, the first screenshot and the second screenshot are considered to be different, namely the video can be played, otherwise, the video is considered to be not played at the second screenshot time; and when the second difference value is larger than a target threshold value, considering that any one of the first screenshot or the second screenshot is different from the third screenshot, namely the video can be played circularly, otherwise, considering that the video cannot be played at the moment of the third screenshot. That is, in the disclosed embodiment, the computer device may generate any one of the following three detection results:
(1) and if the second difference value is larger than the target threshold value, determining that the video is not abnormal in playing.
(2) And if the second difference value is smaller than the target threshold value and the first difference value is smaller than the target threshold value, determining that the video is abnormally played.
(3) If the second difference value is smaller than the target threshold and is not 0, and the first difference value is larger than the target threshold, it is determined that the video is abnormally played.
In the embodiment of the disclosure, by obtaining the difference between the screenshot at the first playing time and the screenshot at the second playing time, and the difference between the screenshot at the first playing time or the screenshot at the second playing time and the screenshot at the third playing time, since the screenshot can represent the picture played by the video at the screenshot time, based on the difference between the screenshots at different times, whether the difference exists between the played pictures at the screenshot times can be represented, so as to realize the detection of whether the video playing is abnormal, and the video detection process is executed by the computer device, developers do not need to detect the videos one by one as before, thereby greatly reducing the labor cost and time consumption in the detection process, and improving the detection efficiency.
Fig. 3 is a block diagram illustrating a video detection device according to an exemplary embodiment. As shown in fig. 3, the apparatus includes a playing unit 301, a screen capture acquiring unit 302, a difference value acquiring unit 303, and a determining unit 304.
A playing unit 301 configured to cyclically play a video to be detected;
a screenshot obtaining unit 302, configured to obtain a first screenshot of a first playing time, a second screenshot of a second playing time, and a third screenshot of a third playing time in a loop playing process, where the first playing time and the second playing time are different times of a same playing in the loop playing process, the first playing time and the third playing time respectively belong to different times of the playing in the loop playing process, and any one of the third playing time and the first playing time or the second playing time corresponds to a different frame of the video;
a difference value acquiring unit 303 configured to acquire a first difference value between the first screenshot and the second screenshot, and a second difference value between either the first screenshot or the second screenshot and the third screenshot;
a determining unit 304 configured to determine whether there is an abnormality in the playing of the video based on the first difference value and the second difference value.
In one possible implementation, the difference value obtaining unit 303 is configured to:
acquiring a first histogram, a second histogram and a third histogram, wherein the first histogram, the second histogram and the third histogram are respectively used for representing the distribution situation of pixel values in the first screenshot, the second screenshot and the third screenshot;
acquiring a difference value between the first histogram and the second histogram as a first difference value between the first screenshot and the second screenshot;
and acquiring a difference value between any one of the first histogram or the second histogram and the third histogram as a second difference value between any one of the first screenshot or the second screenshot and the third screenshot.
In one possible implementation, the difference value obtaining unit 303 is configured to:
respectively counting pixel values in the first screenshot, the second screenshot and the third screenshot;
and respectively generating the first histogram, the second histogram and the third histogram according to the pixel values in the first screenshot, the second screenshot and the third screenshot by taking the pixel value as a horizontal axis coordinate and the number of pixel points corresponding to each pixel value as a vertical coordinate.
In one possible implementation, the determining unit 304 is configured to:
comparing the first difference value and the second difference value with a target threshold value respectively;
if the second difference value is larger than the target threshold value, determining that the video is not abnormal in playing;
if the second difference value is smaller than the target threshold value and the first difference value is smaller than the target threshold value, determining that the video is abnormally played;
if the second difference value is smaller than the target threshold and is not 0, and the first difference value is larger than the target threshold, it is determined that the video is abnormally played.
In one possible implementation, the apparatus further includes:
a duration acquisition unit configured to acquire a video duration of the video;
the first time determining unit is configured to determine any two different playing times with an interval smaller than the video time length from the starting time of the video playing as the first playing time and the second playing time respectively according to the video time length;
and the second time acquisition unit is configured to determine any play time which is spaced from the starting time of the video playing by more than the video time length as the third play time according to the video time length.
In one possible implementation, the apparatus further includes:
a detection unit configured to detect that the third playing time and the first playing time or the second playing time correspond to the same frame of the video;
and the value taking unit is configured to take the value of the third playing time again if the third playing time and any one of the first playing time and the second playing time correspond to the same frame of the video.
In one possible implementation, the playing unit 301 is configured to:
based on an automatic test framework, simulating the operation of a user on a target page, and automatically and circularly playing a plurality of videos to be detected in the target page.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
FIG. 4 is a block diagram illustrating a computer device according to an example embodiment. The computer device 400 may have a relatively large difference due to different configurations or performances, and may include one or more processors (CPUs) 401 and one or more memories 402, where at least one instruction is stored in the memory 402, and is loaded and executed by the processor 401 to implement the video detection method provided by the above-mentioned method embodiments. Certainly, the computer device may further have components such as a wired or wireless network interface, a keyboard, and an input/output interface, so as to perform input and output, and the computer device may further include other components for implementing the functions of the device, which is not described herein again.
In an exemplary embodiment, a computer-readable storage medium comprising instructions, such as a memory comprising instructions, executable by a processor of a computer device to perform the above-described method is also provided. Alternatively, the storage medium may be a non-transitory computer readable storage medium, which may be, for example, a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (14)

1. A video detection method, comprising:
simulating the operation of a user on a target page based on an automatic test framework, and automatically and circularly playing a plurality of videos to be detected in the target page until the playing time of the videos to be detected reaches the target playing time, wherein the target page is used for providing a video information display function;
acquiring a first screenshot of a first playing moment, a second screenshot of a second playing moment and a third screenshot of a third playing moment in a circulating playing process, wherein the first playing moment and the second playing moment belong to different playing moments of the same playing in the circulating playing process, the first playing moment and the third playing moment respectively belong to different playing in the circulating playing process, and any one of the third playing moment and the first playing moment or the second playing moment corresponds to different frames of the video;
acquiring a first difference value between the first screenshot and the second screenshot and a second difference value between any one of the first screenshot or the second screenshot and the third screenshot;
and determining whether the video is abnormal or not based on the first difference value and the second difference value.
2. The method of claim 1, wherein the obtaining a first difference value between the first screenshot and the second screenshot, and a second difference value between either the first screenshot or the second screenshot and the third screenshot comprises:
acquiring a first histogram, a second histogram and a third histogram, wherein the first histogram, the second histogram and the third histogram are respectively used for representing the distribution situation of pixel values in the first screenshot, the second screenshot and the third screenshot;
acquiring a difference value between the first histogram and the second histogram as a first difference value between the first screenshot and the second screenshot;
and acquiring a difference value between any one of the first histogram or the second histogram and the third histogram as a second difference value between any one of the first screenshot or the second screenshot and the third histogram.
3. The video detection method of claim 2, wherein the obtaining the first histogram, the second histogram, and the third histogram comprises:
respectively counting pixel values in the first screenshot, the second screenshot and the third screenshot;
and respectively generating the first histogram, the second histogram and the third histogram according to the pixel values in the first screenshot, the second screenshot and the third screenshot by taking the pixel value as a horizontal axis coordinate and the number of pixel points corresponding to each pixel value as a vertical coordinate.
4. The method of claim 1, wherein the determining whether there is an anomaly in the playing of the video based on the first difference value and the second difference value comprises:
comparing the first difference value and the second difference value with a target threshold value respectively;
if the second difference value is larger than the target threshold value, determining that the video is not abnormal in playing;
if the second difference value is smaller than the target threshold value and the first difference value is smaller than the target threshold value, determining that the video is abnormally played;
and if the second difference value is smaller than the target threshold value and is not 0, and the first difference value is larger than the target threshold value, determining that the video is abnormally played.
5. The video detection method according to claim 1, wherein before the obtaining of the first screenshot at the first playing time, the second screenshot at the second playing time, and the third screenshot at the third playing time in the loop playing process, the method further comprises:
acquiring the video time length of the video;
according to the video time length, respectively determining any two different playing times with the interval smaller than the video time length from the starting time of the video playing as the first playing time and the second playing time;
and determining any play time which has a distance larger than the video time length from the video play starting time as the third play time according to the video time length.
6. The video detection method according to claim 1, wherein before the obtaining of the first screenshot at the first playing time, the second screenshot at the second playing time, and the third screenshot at the third playing time in the loop playing process, the method further comprises:
detecting whether the third playing time and the first playing time or the second playing time correspond to the same frame of the video;
and if the third playing time and any one of the first playing time or the second playing time correspond to the same frame of the video, re-taking the value of the third playing time.
7. A video detection apparatus, comprising:
the playing unit is configured to simulate the operation of a user on a target page based on an automatic testing frame, and automatically and circularly play a plurality of videos to be detected in the target page until the playing time of the videos to be detected reaches a target playing time, wherein the target page is used for providing a video information display function;
the screenshot obtaining unit is configured to obtain a first screenshot of a first playing time, a second screenshot of a second playing time and a third screenshot of a third playing time in a circulating playing process, wherein the first playing time and the second playing time are different playing times belonging to the same playing time in the circulating playing process, the first playing time and the third playing time respectively belong to different playing times in the circulating playing process, and any one of the third playing time and the first playing time or the second playing time corresponds to different frames of the video;
a difference value acquiring unit configured to acquire a first difference value between the first screenshot and the second screenshot, and a second difference value between either the first screenshot or the second screenshot and the third screenshot;
a determining unit configured to determine whether there is an abnormality in playing of the video based on the first difference value and the second difference value.
8. The video detection apparatus according to claim 7, wherein the disparity value acquisition unit is configured to:
acquiring a first histogram, a second histogram and a third histogram, wherein the first histogram, the second histogram and the third histogram are respectively used for representing the distribution situation of pixel values in the first screenshot, the second screenshot and the third screenshot;
acquiring a difference value between the first histogram and the second histogram as a first difference value between the first screenshot and the second screenshot;
and acquiring a difference value between any one of the first histogram or the second histogram and the third histogram as a second difference value between any one of the first screenshot or the second screenshot and the third histogram.
9. The video detection apparatus according to claim 8, wherein the disparity value acquisition unit is configured to:
respectively counting pixel values in the first screenshot, the second screenshot and the third screenshot;
and respectively generating the first histogram, the second histogram and the third histogram according to the pixel values in the first screenshot, the second screenshot and the third screenshot by taking the pixel value as a horizontal axis coordinate and the number of pixel points corresponding to each pixel value as a vertical coordinate.
10. The video detection apparatus according to claim 7, wherein the determination unit is configured to:
comparing the first difference value and the second difference value with a target threshold value respectively;
if the second difference value is larger than the target threshold value, determining that the video is not abnormal in playing;
if the second difference value is smaller than the target threshold value and the first difference value is smaller than the target threshold value, determining that the video is abnormally played;
and if the second difference value is smaller than the target threshold value and is not 0, and the first difference value is larger than the target threshold value, determining that the video is abnormally played.
11. The video detection apparatus of claim 7, wherein the apparatus further comprises:
a duration acquisition unit configured to acquire a video duration of the video;
a first time determining unit configured to determine, according to the video duration, any two different playing times having an interval smaller than the video duration from a start time of the video playing as the first playing time and the second playing time, respectively;
a second time determination unit configured to determine any one play time having an interval greater than the video duration from the start time of the video play as the third play time.
12. The video detection apparatus of claim 7, wherein the apparatus further comprises:
a detection unit configured to detect whether the third playback time and the first playback time or the second playback time correspond to the same frame of the video;
a dereferencing unit configured to dereference the third playing time again if the third playing time corresponds to the same frame of the video as any one of the first playing time and the second playing time.
13. A computer device, comprising:
one or more processors;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the video detection method of any of claims 1 to 6.
14. A computer-readable storage medium whose instructions, when executed by a processor of a computer device, enable the computer device to perform the video detection method of any of claims 1 to 6.
CN201910530081.9A 2019-06-19 2019-06-19 Video detection method and device, electronic equipment and storage medium Active CN110113630B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910530081.9A CN110113630B (en) 2019-06-19 2019-06-19 Video detection method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910530081.9A CN110113630B (en) 2019-06-19 2019-06-19 Video detection method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN110113630A CN110113630A (en) 2019-08-09
CN110113630B true CN110113630B (en) 2021-05-18

Family

ID=67495437

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910530081.9A Active CN110113630B (en) 2019-06-19 2019-06-19 Video detection method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110113630B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111246277B (en) * 2020-01-15 2022-02-22 湖南映客互娱网络信息有限公司 Method and system for live broadcast auditing partition
CN113515670B (en) * 2021-08-12 2023-09-26 极米科技股份有限公司 Film and television resource state identification method, equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002507027A (en) * 1998-03-13 2002-03-05 シーメンス コーポレイト リサーチ インコーポレイテツド Apparatus and method for creating collaborative dynamic video comment
CN105913088A (en) * 2016-04-13 2016-08-31 厦门美图移动科技有限公司 Lag identification method, lag identification device and computing equipment
CN109660805A (en) * 2017-10-10 2019-04-19 武汉斗鱼网络科技有限公司 Audio-visual synchronization optimization method, storage medium, equipment and system in decoding broadcasting

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002507027A (en) * 1998-03-13 2002-03-05 シーメンス コーポレイト リサーチ インコーポレイテツド Apparatus and method for creating collaborative dynamic video comment
CN105913088A (en) * 2016-04-13 2016-08-31 厦门美图移动科技有限公司 Lag identification method, lag identification device and computing equipment
CN109660805A (en) * 2017-10-10 2019-04-19 武汉斗鱼网络科技有限公司 Audio-visual synchronization optimization method, storage medium, equipment and system in decoding broadcasting

Also Published As

Publication number Publication date
CN110113630A (en) 2019-08-09

Similar Documents

Publication Publication Date Title
CN107509107B (en) Method, device and equipment for detecting video playing fault and readable medium
CN107025174B (en) Method, device and readable storage medium for user interface anomaly test of equipment
CN103136094B (en) A kind of page method of testing and device
CN107948640B (en) Video playing test method and device, electronic equipment and storage medium
CN106502891B (en) Automatic detection method and device for user interface
CN106303515B (en) A kind of online live video quality detecting method and device
CN107885645B (en) Method and device for calculating rendering duration of first screen of page and electronic equipment
CN110113630B (en) Video detection method and device, electronic equipment and storage medium
CN108830180B (en) Electronic attendance checking method and device and electronic equipment
CN112492294B (en) Application program testing method, device, system, network camera and medium
CN116527879A (en) Set top box testing method, device, medium and computer device
WO2017095362A1 (en) Generating application flow entities
CN112203042B (en) Cloud desktop operation response time testing method, system, equipment and medium
CN114445545A (en) Method, device, equipment, system and medium for testing rendering engine
CN111128139B (en) Non-invasive voice test method and device
CN106686371A (en) Frame rate testing method, device, equipment and system
CN116823608A (en) Page image stitching method and device, computer equipment and storage medium
CN113923443A (en) Network video recorder testing method and device and computer readable storage medium
CN107332914B (en) Terminal display method and device
CN113742152A (en) Screen projection test method, device, equipment and storage medium
CN109739752B (en) Built-in resource testing method and device, electronic equipment and readable storage medium
CN112995650A (en) Method and device for detecting video continuity of camera
CN112770110B (en) Video quality detection method, device and system
WO2021036599A1 (en) Method and apparatus for testing set top box, set top box, and computer-readable storage medium
CN112634460B (en) Outdoor panorama generation method and device based on Haar-like features

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