CN112738418A - Video acquisition method and device and electronic equipment - Google Patents

Video acquisition method and device and electronic equipment Download PDF

Info

Publication number
CN112738418A
CN112738418A CN202011561620.4A CN202011561620A CN112738418A CN 112738418 A CN112738418 A CN 112738418A CN 202011561620 A CN202011561620 A CN 202011561620A CN 112738418 A CN112738418 A CN 112738418A
Authority
CN
China
Prior art keywords
video
frames
video source
video frames
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202011561620.4A
Other languages
Chinese (zh)
Other versions
CN112738418B (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 Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and 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 Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202011561620.4A priority Critical patent/CN112738418B/en
Publication of CN112738418A publication Critical patent/CN112738418A/en
Application granted granted Critical
Publication of CN112738418B publication Critical patent/CN112738418B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N5/00Details of television systems
    • H04N5/222Studio circuitry; Studio devices; Studio equipment
    • H04N5/262Studio circuits, e.g. for mixing, switching-over, change of character of image, other special effects ; Cameras specially adapted for the electronic generation of special effects
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N5/00Details of television systems
    • H04N5/222Studio circuitry; Studio devices; Studio equipment
    • H04N5/262Studio circuits, e.g. for mixing, switching-over, change of character of image, other special effects ; Cameras specially adapted for the electronic generation of special effects
    • H04N5/265Mixing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N5/00Details of television systems
    • H04N5/222Studio circuitry; Studio devices; Studio equipment
    • H04N5/262Studio circuits, e.g. for mixing, switching-over, change of character of image, other special effects ; Cameras specially adapted for the electronic generation of special effects
    • H04N5/278Subtitling

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Television Signal Processing For Recording (AREA)

Abstract

The disclosure relates to a video acquisition method, a video acquisition device and electronic equipment, and relates to the technical field of videos. The specific implementation scheme is as follows: acquiring image data and frame extraction quantity, wherein the image data comprises a video source; determining a plurality of extraction time points according to the number of the extracted frames and the duration of the video source; decoding the video source to obtain decoded data of the video source; acquiring the plurality of video frames corresponding to the plurality of extraction time points according to the decoding data; and acquiring a target video according to the plurality of video frames. In the above, a plurality of video frames can be extracted from the decoded data obtained by one-time decoding of the video source, so that the extraction efficiency of the video frames is improved.

Description

Video acquisition method and device and electronic equipment
Technical Field
The present disclosure relates to the field of video technology in image processing technology. In particular, the invention relates to a video acquisition method, a video acquisition device and an electronic device.
Background
At present, video becomes an important way for information dissemination, and the application scenes of video are more and more extensive. The user can perform video creation through means of cutting, splicing, matching music, adding special effects, subtitles and the like on the original video.
Disclosure of Invention
The disclosure provides a video acquisition method and device and electronic equipment.
According to a first aspect of the present disclosure, there is provided a video acquisition method, performed by an electronic device, comprising:
acquiring image data and frame extraction quantity, wherein the image data comprises a video source;
determining a plurality of extraction time points according to the number of the extracted frames and the duration of the video source;
decoding the video source to obtain decoded data of the video source;
acquiring a plurality of video frames corresponding to the plurality of extraction time points according to the decoding data;
and acquiring a target video according to the plurality of video frames.
According to a second aspect of the present disclosure, there is provided a video acquisition apparatus, executed by an electronic device, comprising:
the device comprises a first acquisition module, a second acquisition module and a frame extraction module, wherein the first acquisition module is used for acquiring image data and frame extraction quantity, and the image data comprises a video source;
the determining module is used for determining a plurality of extraction time points according to the number of the extracted frames and the duration of the video source;
the decoding module is used for decoding the video source to obtain decoded data of the video source;
a second obtaining module, configured to obtain, according to the decoded data, a plurality of video frames corresponding to the plurality of extraction time points;
and the third acquisition module is used for acquiring the target video according to the plurality of video frames.
According to a third aspect of the present disclosure, there is provided an electronic device comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of the first aspects.
According to a fourth aspect of the present disclosure, there is provided a non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of any one of the first aspects.
According to a fifth aspect of the present disclosure, there is provided a computer program product comprising a computer program which, when executed by a processor, implements the method according to the first aspect.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present disclosure, nor do they limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description.
Drawings
The drawings are included to provide a better understanding of the present solution and are not to be construed as limiting the present disclosure. Wherein:
fig. 1 is a flow chart of a video acquisition method provided by an embodiment of the present disclosure;
FIG. 2a is a flowchart of decoding performed by a decoding pool provided by an embodiment of the present disclosure;
fig. 2b is a flowchart of a video source frame extraction process provided by the embodiment of the disclosure;
fig. 3 is a block diagram of a video capture device provided by an embodiment of the present disclosure;
fig. 4 is a block diagram of an electronic device for implementing a video acquisition method of an embodiment of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, in which various details of the embodiments of the disclosure are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
The video becomes an information distribution channel, how to rapidly make a video on an electronic device, such as a mobile phone, the adopted means may include cutting one or more segments of video, splicing the cut segments of video with pictures, and adding music, special effects, subtitles, and the like. When a user cuts a video, adds a special effect, and splices the video or pictures, a video axis needs to be presented for the user, and a group of frame extraction results within a time are displayed on the video axis. How to rapidly select a single-segment video, multiple-segment videos, and a mixture of videos and pictures to obtain a frame extraction result to be displayed on a video axis becomes a problem in the prior art.
The following solutions are generally adopted in the prior art to solve the above technical problems:
(1) using an open source picture loading frame, appointing a certain timestamp, and performing frame extraction and display;
(2) using a frame extraction related interface provided by a system, appointing a certain timestamp, and performing frame extraction and display;
(3) and decoding the video, comparing the time stamp of each decoded frame of video with the appointed time stamp, and performing frame extraction and display.
The three schemes have different use scenes, and the problems and the defects brought by the schemes are different:
the scheme (1) and the scheme (2) are relatively simple to implement, but the currently known open source loading frame and the frame extraction interface of the system only support inputting a timestamp and returning a video frame, and for the condition that a plurality of time frames need to be extracted, the acquisition needs to be performed for many times, the acquisition mode is low in efficiency, and the user experience is poor;
the scheme (3) can effectively solve the above scheme, but a video axis needs to be displayed under multiple scenes (for example, special effects, subtitles, etc.), and the video user is likely to perform multiple editing operations, and for the above operations, the video needs to be decoded to obtain a frame extraction result each time, and for the multi-segment video, picture and video mixing, there is no unified solution at present.
Therefore, the present disclosure provides a video acquisition method, an apparatus and an electronic device to solve the above problems.
Referring to fig. 1, fig. 1 is a flowchart of a video acquisition method provided in an embodiment of the present disclosure, and as shown in fig. 1, the embodiment provides a video acquisition method, which is executed by an electronic device and includes the following steps:
step 101, acquiring image data and frame extraction quantity, wherein the image data comprises a video source.
The video source may comprise one or more sub-videos and the image data may further comprise one or more pictures. In this embodiment, the video source may be placed in a local storage location of the electronic device, the user configures a local path for storing the image data, and the electronic device obtains the image data through the local path. The number of frames may be the number of video frames that need to be extracted from the video source, the number of frames being configured by the user.
And step 102, determining a plurality of extraction time points according to the number of the extracted frames and the duration of the video source.
In this embodiment, an average frame extraction manner may be adopted to extract video frames, for example, the duration of the video source is 9 seconds, the number of frames extracted is 3, one frame of video frame may be extracted in 0-3 seconds, one frame of video frame may be extracted in 3-6 seconds, and one frame of video frame may be extracted in 6-9 seconds, that is, according to the number of frames extracted and the duration of the video source, a plurality of frame extraction periods may be determined, and then one frame of video frame may be extracted in each frame extraction period.
In extracting the video frames, key frames of the extraction period are extracted, for example, the video frames extracted in 0 to 3 seconds are the key frames extracted in 0 to 3 seconds. If there are multiple key frames in the frame extraction period, the key frame in the frame extraction period may be extracted randomly, or the key frame with the playing timestamp closest to the middle time of the frame extraction period may be extracted, for example, for the above 0-3 second period, the key frame with the playing timestamp closest to 1.5 seconds may be extracted.
The extraction time point may be understood as a playing time stamp corresponding to the video frame to be extracted, for example, in the above example, if the video frame with the playing time stamp of 1.5 seconds is determined to be extracted, the determined extraction time point is 1.5 seconds. In this embodiment, there are a plurality of extraction time points, and each extraction time point corresponds to one play time stamp.
Further, if the image data includes at least two sub-videos, determining a sequence of the sub-videos, for example, determining according to a sequence set by a user, and regarding the at least two sub-videos as a video source (i.e., a total video source), where a sequence of each sub-video in the video source is the same as the determined sequence of each sub-video, and a duration of the video source is a sum of durations of the sub-videos.
When a plurality of extraction time points are determined, the video source can be regarded as a whole to be subjected to frame extraction, for example, if two 10-second sub-videos exist, and the number of the frames extracted is 10, the duration of the video source is 20 seconds, when a plurality of extraction time points are determined, the two sub-videos are regarded as a whole, 5 video frames are extracted from the front-ranked sub-videos, and 5 video frames are extracted from the rear-ranked sub-videos.
And 103, decoding the video source to obtain decoded data of the video source.
The decoded data can be stored in the memory of the electronic device and can also be stored in the cache of the electronic device.
And step 104, acquiring the plurality of video frames corresponding to the plurality of extraction time points according to the decoded data.
And acquiring a plurality of video frames corresponding to a plurality of extraction time points from the decoded data, wherein each extraction time point corresponds to one video frame. In this embodiment, a plurality of video frames corresponding to a plurality of extraction time points may be obtained from decoded data obtained by one decoding.
And 105, acquiring a target video according to the plurality of video frames.
The sequence of the plurality of video frames in the target video can be determined according to the time sequence of the extraction time points of the video frames in the video source. Further, the user may also filter the extracted multiple video frames, for example, delete a portion of the video frames, or adjust the sequence of the multiple video frames to obtain the target video.
In this embodiment, image data and the number of frames extracted are acquired, where the image data includes a video source; determining a plurality of extraction time points according to the number of the extracted frames and the duration of the video source; decoding the video source to obtain decoded data of the video source; acquiring the plurality of video frames corresponding to the plurality of extraction time points according to the decoding data; and acquiring a target video according to the plurality of video frames. In the above, a plurality of video frames can be extracted from the decoded data obtained by one-time decoding of the video source, so that the extraction efficiency of the video frames is improved.
In an embodiment of the present disclosure, a storage address of a decoded video frame in the memory of the electronic device in the decoded data is determined according to a play timestamp of the decoded video frame; step 104, obtaining the plurality of video frames corresponding to the plurality of extraction time points according to the decoded data, including the following steps:
determining a target storage address corresponding to a target playing time stamp, wherein the target playing time stamp is a playing time stamp corresponding to a target extraction time point;
acquiring a video frame corresponding to the target extraction time point according to the target storage address of the memory; wherein the target extraction time point is any one of the plurality of extraction time points.
In the above, the decoded video frame is the decoded data of the first video frame, and the first video frame is a frame in the video source, and is distinguished from each video frame in the extracted video frames in the description, and is referred to as the first video frame here. After the video frame is decoded to obtain the decoded data, the storage address of the decoded video frame in the memory of the electronic device can be determined according to the playing time stamp of the decoded video frame. The Presentation Time Stamp may also be referred to as a Presentation Time Stamp (PTS), which indicates a Presentation Time of a decoded video frame obtained after decoding.
The storage address of the decoded video frame in the decoded data in the memory of the electronic device is determined according to the playing time stamp of the decoded video frame, for example, an MD5(MD5 is Message-Digest Algorithm) value is calculated according to the local address stored in the video source and the playing time stamp of the decoded video frame, and the MD5 value is used as the storage address of the decoded video frame in the memory. Further, the decoded video frame may also be stored in a buffer of the electronic device, and when the decoded video frame is stored in the buffer, the MD5 value calculated in the above manner may also be used for storage.
Because the decoded data frame is determined according to the playing time stamp of the decoded data frame when being stored, the decoded data frame can be conveniently taken out from the internal memory according to the playing time stamp.
And for each extraction time point in the plurality of extraction time points, calculating a memory address for acquiring the decoded data frame according to the extraction time point, and then taking out the decoded data frame from the memory address, thereby acquiring a plurality of video frames corresponding to the plurality of extraction time points.
It should be noted that, before the video source is decoded, the MD5 value may be determined according to the playing timestamp of the video frame, and then it is determined whether the video frame exists in the memory according to the MD5 value, and if so, the result is returned; if the video frame does not exist, judging whether the video frame exists in the disk (the storage addresses of the same video frame in the memory are the same as those in the disk, namely, the storage addresses are the MD5 values obtained by calculation according to the playing time stamp of the video frame), and if the video frame exists, returning the result and adding the result into the memory; when none of the above operations exist, the decoding operation is performed, and after the decoding is completed, the decoded data is stored in the memory and the disk, and a specific flow can be shown in fig. 2 b.
In this embodiment, the storage address of the decoded video frame in the memory of the electronic device in the decoded data is determined according to the playing time stamp of the decoded video frame, so that the decoded data frame can be conveniently taken out from the memory according to the playing time stamp in the following process, and the efficiency of extracting the video frame in the video source is improved.
To improve the decoding efficiency of the video source, multiple decoders may be used to decode in parallel. In a case that the electronic device includes M decoders and the video source includes N sub-videos, step 103, decoding the video source to obtain decoded data of the video source includes: selecting N decoders from the M decoders; and respectively decoding the N sub-videos by utilizing the N decoders to obtain decoded data of the N sub-videos, wherein M and N are positive integers larger than 1, and M is larger than or equal to N.
In the foregoing, when the electronic device includes M decoders, and the video source includes N sub-videos, the N decoders are selected from the M decoders to respectively decode the N sub-videos, and one decoder decodes one sub-video, so that the purpose of parallel decoding of the video source by the multiple decoders is achieved.
In a specific implementation, a decoder pool (the decoder pool may include M decoders) may be designed to control the number of parallel decoding, when the electronic device needs to decode a video source, it is determined whether there is an available decoder in the current decoder pool, if so, decoding is performed, if there is no available decoder, the current decoder pool enters a waiting queue to wait, and if the task queue reaches an upper limit, decoding that cannot be performed is processed according to a policy, for example, a decoding task that does not enter the task queue is discarded; after waiting for a period of time, there is a decoder available, and the decoding task is executed again, and the specific execution logic is shown in fig. 2 a.
In this embodiment, under the condition that the video source includes at least two sub-videos and the electronic device includes at least two decoders, one decoder is used for decoding each sub-video, so that parallel decoding of each sub-video in the at least two sub-videos can be realized, the decoding efficiency of the video source is improved, and finally, the efficiency of extracting video frames in the video source is improved.
After the video frames are extracted, the video frames may be displayed on a display screen of the electronic device, that is, after the plurality of video frames corresponding to the plurality of extraction time points are acquired according to the decoded data in step 104, and before the target video is acquired according to the plurality of video frames in step 105, the method further includes:
and sequentially displaying the video frames on a video axis according to the time sequence of the playing time stamps corresponding to the video frames in the video frames, wherein the length of the video axis is determined according to the size of the display screen of the electronic equipment.
In this embodiment, each extracted video frame is displayed on the display screen of the electronic device, and can be uniformly displayed on the video axis when being displayed. The video axis can display a plurality of extraction time points, and the video frames corresponding to the extraction time points can be displayed at the positions corresponding to the extraction time points, so that the user can conveniently check the video frames, delete the displayed video frames, adjust the sequence among the video frames and the like.
The length of the video axis can be determined according to the size of the display screen of the electronic equipment, for example, if the video axis is displayed in a transverse screen, the length of the video axis is determined according to the transverse screen length of the display screen; and if the video axis displays in a vertical screen mode, the length of the video axis is determined according to the vertical screen length of the display screen. Further, the length of the video axis may also be determined according to the number of frames extracted and the size of the display screen, for example, the number of frames extracted is 10, the video axis displays across the screen, and five video frames may be sequentially displayed according to the length of the across screen of the display screen, so that the video axis includes two rows of sub-axes, and each sub-axis displays 5 video frames. Furthermore, each time a video frame is acquired, the corresponding position of the video frame on the video axis is displayed, so that the user experience can be improved.
In this embodiment, after the video frames are extracted, the video frames are sequentially displayed on the video axis according to the time sequence of the playing timestamps corresponding to the video frames in the plurality of video frames, so that a user can conveniently check and adjust the extracted video frames, the method is visual and convenient, and the user experience is improved.
The image data may include one or more pictures in addition to the video source, and the pictures may be stored in a local storage location of the electronic device, and the pictures and the video source may be stored in the same local storage location or different local storage locations. In addition, the electronic device can also download the pictures from the network. In the case that the image data further includes a picture, determining a plurality of extraction time points according to the number of extracted frames and the duration of the video source, in step 102, includes:
determining the plurality of extraction time points according to the number of the extracted frames, the duration of the video source and the number of the pictures;
correspondingly, the sequentially displaying the video frames on the video axis according to the sequence of the video frames in the video source comprises the following steps:
sequentially displaying a plurality of video frames of the picture and the video source on the video axis according to a preset sequence of the picture and the video source;
and for a plurality of video frames of the video source, sequentially displaying the video frames on a video axis according to the time sequence of the playing timestamps corresponding to the video frames in the video frames.
In the above, in the case where the image data includes pictures and video sources, the number of video frames extracted from the video sources may be determined according to the number of frames extracted and the number of pictures, that is, the number of pictures is subtracted from the number of frames extracted, the number of video frames to be extracted may be obtained, and the plurality of extraction time points may be determined according to the number of video frames to be extracted and the time length of the video sources. For example, if the number of frames is 5, and the image data includes 2 pictures, it is determined that 3 video frames need to be extracted from the video source, and the video frames may be extracted in an average frame extraction manner, for example, if the duration of the video source is 9 seconds, the number of frames is 3, one video frame may be extracted in 0-3 seconds, one video frame may be extracted in 3-6 seconds, and one video frame may be extracted in 6-9 seconds. That is, in the case where the image data also includes pictures, the number of frames extracted is the sum of the number of video frames that need to be extracted from the video source and the number of pictures included in the image data.
When the image data includes a picture and a video source, the sequence between the picture and the video source is determined first, and the sequence may be preset by a user or randomly determined by an electronic device, which is not limited herein. When the images are displayed on the video axis, if the sequence of the images is before the sequence of the video source, the display position of the images is before the display position of the video source on the video axis.
For a plurality of video frames in a video source, sequentially displaying the video frames on a video axis according to the time sequence of the playing timestamps corresponding to the video frames in the plurality of video frames, and uniformly displaying the video frames on the video axis during display. The video axis can display a plurality of extraction time points, and the video frames corresponding to the extraction time points can be displayed at the positions corresponding to the extraction time points, so that the user can conveniently check the video frames, delete the displayed video frames, adjust the sequence among the video frames and the like.
The length of the video axis can be determined according to the size of the display screen of the electronic equipment, for example, if the video axis is displayed in a transverse screen, the length of the video axis is determined according to the transverse screen length of the display screen; and if the video axis displays in a vertical screen mode, the length of the video axis is determined according to the vertical screen length of the display screen. Further, the length of the video axis may also be determined according to the number of frames extracted and the size of the display screen, for example, the number of frames extracted is 10, the video axis displays across the screen, and five video frames may be sequentially displayed according to the length of the across screen of the display screen, so that the video axis includes two rows of sub-axes, and each sub-axis displays 5 video frames.
In this embodiment, the image data includes a video source and a picture, and not only the video frames extracted from the video source but also the picture can be included in the target video, so that the mixed selection of the video frames and the picture in the video source can be realized, the mode of acquiring the target video is enriched, and the diversified requirements of the user can be met.
Further, the picture does not need to be decoded by a decoder, and the storage address of the picture in the memory of the electronic device may be determined according to the local address of the picture storage, for example, an MD5 value is calculated according to the local address of the picture storage, and the MD5 value is used as the storage address of the picture in the memory, or an MD5 value is calculated according to the local address of the picture storage and the name of the picture, and the MD5 value is used as the storage address of the picture in the memory of the electronic device. The pictures do not need to be acquired through a decoder, only the local pictures need to be loaded into the memory, and the same picture can be loaded only once.
Referring to fig. 3, fig. 3 is a structural diagram of a video capture apparatus provided in an embodiment of the present disclosure, and as shown in fig. 3, the embodiment provides a video capture apparatus 300, executed by an electronic device, including:
a first obtaining module 301, configured to obtain image data and a frame number, where the image data includes a video source;
a determining module 302, configured to determine a plurality of extraction time points according to the number of extracted frames and the duration of the video source;
a decoding module 303, configured to decode the video source to obtain decoded data of the video source;
a second obtaining module 304, configured to obtain, according to the decoded data, the plurality of video frames corresponding to the plurality of extraction time points;
a third obtaining module 305, configured to obtain the target video according to the plurality of video frames.
Further, the storage address of the decoded video frame in the memory of the electronic device in the decoded data is determined according to the playing time stamp of the decoded video frame;
the second obtaining module 304 includes:
the first determining submodule is used for determining a target storage address corresponding to a target playing time stamp, and the target playing time stamp is a playing time stamp corresponding to a target extraction time point;
the obtaining submodule is used for obtaining the video frame corresponding to the target extraction time point according to the target storage address of the memory;
wherein the target extraction time point is any one of the plurality of extraction time points.
Further, the electronic device includes M decoders, the video source includes N sub-videos, M and N are positive integers greater than 1, and M is greater than or equal to N;
the decoding module 303 includes:
a selection submodule for selecting N decoders from the M decoders;
and the decoding submodule is used for decoding the N sub-videos by utilizing the N decoders respectively to obtain the decoded data of the N sub-videos.
Further, the video capturing apparatus 300 further includes:
and the display module is used for sequentially displaying the video frames on a video axis according to the time sequence of the playing timestamps corresponding to the video frames in the video frames, and the length of the video axis is determined according to the size of the display screen of the electronic equipment.
Further, the image data further comprises a picture;
the determining module 302 includes:
the second determining submodule is used for determining the plurality of extracting time points according to the number of the extracted frames, the duration of the video source and the number of the pictures;
the display module includes:
the first display unit is used for sequentially displaying the pictures and a plurality of video frames of the video source on the video axis according to the preset sequence of the pictures and the video source;
and the second display unit is used for sequentially displaying the video frames of the video source on a video axis according to the time sequence of the playing timestamps corresponding to the video frames in the video frames.
The video obtaining apparatus 300 provided in this embodiment of the application can implement each process implemented by the electronic device in the method embodiment of fig. 1 and achieve the same beneficial effects, and for avoiding repetition, details are not repeated here.
The video acquisition apparatus 300 according to the embodiment of the present disclosure acquires image data and a number of frames extracted, where the image data includes a video source; determining a plurality of extraction time points according to the number of the extracted frames and the duration of the video source; decoding the video source to obtain decoded data of the video source; acquiring the plurality of video frames corresponding to the plurality of extraction time points according to the decoding data; and acquiring a target video according to the plurality of video frames. In the above, a plurality of video frames can be extracted from the decoded data obtained by one-time decoding of the video source, so that the extraction efficiency of the video frames is improved.
The present disclosure also provides an electronic device, a computer program product and a readable storage medium according to embodiments of the present disclosure.
FIG. 4 shows a schematic block diagram of an example electronic device 400 that may be used to implement embodiments of the present disclosure. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 4, the apparatus 400 includes a computing unit 401 that can perform various appropriate actions and processes according to a computer program stored in a Read Only Memory (ROM)402 or a computer program loaded from a storage unit 408 into a Random Access Memory (RAM) 403. In the RAM 403, various programs and data required for the operation of the device 400 can also be stored. The computing unit 401, ROM 402, and RAM 403 are connected to each other via a bus 404. An input/output (I/O) interface 405 is also connected to bus 404.
A number of components in device 400 are connected to I/O interface 405, including: an input unit 406 such as a keyboard, a mouse, or the like; an output unit 407 such as various types of displays, speakers, and the like; a storage unit 408 such as a magnetic disk, optical disk, or the like; and a communication unit 409 such as a network card, modem, wireless communication transceiver, etc. The communication unit 409 allows the device 400 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunication networks.
Computing unit 401 may be a variety of general and/or special purpose processing components with processing and computing capabilities. Some examples of the computing unit 401 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various dedicated Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, and so forth. The calculation unit 401 executes the respective methods and processes described above, such as the method sample image generation method. For example, in some embodiments, the method sample image generation method may be implemented as a computer software program tangibly embodied in a machine-readable medium, such as storage unit 404. In some embodiments, part or all of the computer program may be loaded and/or installed onto the device 400 via the ROM 402 and/or the communication unit 409. When the computer program is loaded into RAM 403 and executed by computing unit 401, one or more steps of the method sample image generation method described above may be performed. Alternatively, in other embodiments, the computing unit 401 may be configured to perform the method sample image generation method by any other suitable means (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), system on a chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the program codes, when executed by the processor or controller, cause the functions/operations specified in the flowchart and/or block diagram to be performed. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), the internet, and blockchain networks.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The Server may be a cloud Server, also called a cloud computing Server or a cloud host, and is a host product in a cloud computing service system, so as to solve the defects of high management difficulty and weak service extensibility in a traditional object host and a VPS service ("Virtual Private Server", or simply "VPS"). The server may also be a server of a distributed system, or a server incorporating a blockchain.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present disclosure may be executed in parallel, sequentially, or in different orders, as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved, and the present disclosure is not limited herein.
The above detailed description should not be construed as limiting the scope of the disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present disclosure should be included in the scope of protection of the present disclosure.

Claims (13)

1. A video acquisition method, performed by an electronic device, comprising:
acquiring image data and frame extraction quantity, wherein the image data comprises a video source;
determining a plurality of extraction time points according to the number of the extracted frames and the duration of the video source;
decoding the video source to obtain decoded data of the video source;
acquiring a plurality of video frames corresponding to the plurality of extraction time points according to the decoding data;
and acquiring a target video according to the plurality of video frames.
2. The method according to claim 1, wherein the storage address of the decoded video frame in the memory of the electronic device in the decoded data is determined according to the playing time stamp of the decoded video frame;
the obtaining the plurality of video frames corresponding to the plurality of extraction time points according to the decoded data includes:
determining a target storage address corresponding to a target playing time stamp, wherein the target playing time stamp is a playing time stamp corresponding to a target extraction time point;
acquiring a video frame corresponding to the target extraction time point according to the target storage address of the memory;
wherein the target extraction time point is any one of the plurality of extraction time points.
3. The method of claim 1, wherein the electronic device includes M decoders, the video source includes N sub-videos, M and N are both positive integers greater than 1, and M is greater than or equal to N;
the decoding the video source to obtain the decoded data of the video source includes:
selecting N decoders from the M decoders;
and respectively decoding the N sub-videos by utilizing the N decoders to obtain the decoded data of the N sub-videos.
4. The method of claim 1, wherein after said obtaining said plurality of video frames corresponding to said plurality of decimation time points from said decoded data, before said obtaining a target video from said plurality of video frames, said method further comprises:
and sequentially displaying the video frames on a video axis according to the time sequence of the playing time stamps corresponding to the video frames in the video frames, wherein the length of the video axis is determined according to the size of the display screen of the electronic equipment.
5. The method of claim 4, wherein the image data further comprises a picture;
determining a plurality of extraction time points according to the number of the extracted frames and the duration of the video source, wherein the determining comprises the following steps:
determining the plurality of extraction time points according to the number of the extracted frames, the duration of the video source and the number of the pictures;
the sequentially displaying the video frames on the video axis according to the sequence of the video frames in the video source comprises:
sequentially displaying a plurality of video frames of the picture and the video source on the video axis according to a preset sequence of the picture and the video source;
and for a plurality of video frames of the video source, sequentially displaying the video frames on a video axis according to the time sequence of the playing timestamps corresponding to the video frames in the video frames.
6. A video acquisition apparatus, executed by an electronic device, comprising:
the device comprises a first acquisition module, a second acquisition module and a frame extraction module, wherein the first acquisition module is used for acquiring image data and frame extraction quantity, and the image data comprises a video source;
the determining module is used for determining a plurality of extraction time points according to the number of the extracted frames and the duration of the video source;
the decoding module is used for decoding the video source to obtain decoded data of the video source;
a second obtaining module, configured to obtain, according to the decoded data, a plurality of video frames corresponding to the plurality of extraction time points;
and the third acquisition module is used for acquiring the target video according to the plurality of video frames.
7. The apparatus according to claim 6, wherein the storage address of the decoded video frame in the memory of the electronic device in the decoded data is determined according to the playing time stamp of the decoded video frame;
the second obtaining module includes:
the first determining submodule is used for determining a target storage address corresponding to a target playing time stamp, and the target playing time stamp is a playing time stamp corresponding to a target extraction time point;
the obtaining submodule is used for obtaining the video frame corresponding to the target extraction time point according to the target storage address of the memory;
wherein the target extraction time point is any one of the plurality of extraction time points.
8. The apparatus of claim 6, wherein the electronic device comprises M decoders, the video source comprises N sub-videos, M and N are both positive integers greater than 1, and M is greater than or equal to N;
the decoding module includes:
a selection submodule for selecting N decoders from the M decoders;
and the decoding submodule is used for decoding the N sub-videos by utilizing the N decoders respectively to obtain the decoded data of the N sub-videos.
9. The apparatus of claim 6, wherein the apparatus further comprises:
and the display module is used for sequentially displaying the video frames on a video axis according to the time sequence of the playing timestamps corresponding to the video frames in the video frames, and the length of the video axis is determined according to the size of the display screen of the electronic equipment.
10. The apparatus of claim 9, wherein the image data further comprises a picture;
the determining module includes:
the second determining submodule is used for determining the plurality of extracting time points according to the number of the extracted frames, the duration of the video source and the number of the pictures;
the display module includes:
the first display unit is used for sequentially displaying the pictures and a plurality of video frames of the video source on the video axis according to the preset sequence of the pictures and the video source;
and the second display unit is used for sequentially displaying the video frames of the video source on a video axis according to the time sequence of the playing timestamps corresponding to the video frames in the video frames.
11. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor;
wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-5.
12. A non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of any one of claims 1-5.
13. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any one of claims 1-5.
CN202011561620.4A 2020-12-25 2020-12-25 Video acquisition method and device and electronic equipment Active CN112738418B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011561620.4A CN112738418B (en) 2020-12-25 2020-12-25 Video acquisition method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011561620.4A CN112738418B (en) 2020-12-25 2020-12-25 Video acquisition method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN112738418A true CN112738418A (en) 2021-04-30
CN112738418B CN112738418B (en) 2022-12-06

Family

ID=75616037

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011561620.4A Active CN112738418B (en) 2020-12-25 2020-12-25 Video acquisition method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN112738418B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113015005A (en) * 2021-05-25 2021-06-22 腾讯科技(深圳)有限公司 Video clipping method, device and equipment and computer readable storage medium
CN113727191A (en) * 2021-08-30 2021-11-30 山谷网安科技股份有限公司 Portable encrypted mobile training system and device and encrypted training method
CN113824965A (en) * 2021-09-22 2021-12-21 北京百度网讯科技有限公司 Video coding method and device and electronic equipment
CN115514970A (en) * 2022-10-28 2022-12-23 重庆紫光华山智安科技有限公司 Image frame pushing method and system, electronic equipment and readable storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103780977A (en) * 2014-02-26 2014-05-07 厦门雅迅网络股份有限公司 Streaming media playing method based on frame alignment technology
CN105120321A (en) * 2015-08-21 2015-12-02 北京佳讯飞鸿电气股份有限公司 Video searching method, video storage method and related devices
CN106331833A (en) * 2016-09-29 2017-01-11 维沃移动通信有限公司 Video display method and mobile terminal
US20180181814A1 (en) * 2016-12-22 2018-06-28 Sap Se Video abstract using signed foreground extraction and fusion
CN109672902A (en) * 2018-12-25 2019-04-23 百度在线网络技术(北京)有限公司 A kind of video takes out frame method, device, electronic equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103780977A (en) * 2014-02-26 2014-05-07 厦门雅迅网络股份有限公司 Streaming media playing method based on frame alignment technology
CN105120321A (en) * 2015-08-21 2015-12-02 北京佳讯飞鸿电气股份有限公司 Video searching method, video storage method and related devices
CN106331833A (en) * 2016-09-29 2017-01-11 维沃移动通信有限公司 Video display method and mobile terminal
US20180181814A1 (en) * 2016-12-22 2018-06-28 Sap Se Video abstract using signed foreground extraction and fusion
CN109672902A (en) * 2018-12-25 2019-04-23 百度在线网络技术(北京)有限公司 A kind of video takes out frame method, device, electronic equipment and storage medium

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113015005A (en) * 2021-05-25 2021-06-22 腾讯科技(深圳)有限公司 Video clipping method, device and equipment and computer readable storage medium
CN113015005B (en) * 2021-05-25 2021-08-31 腾讯科技(深圳)有限公司 Video clipping method, device and equipment and computer readable storage medium
CN113727191A (en) * 2021-08-30 2021-11-30 山谷网安科技股份有限公司 Portable encrypted mobile training system and device and encrypted training method
CN113824965A (en) * 2021-09-22 2021-12-21 北京百度网讯科技有限公司 Video coding method and device and electronic equipment
CN115514970A (en) * 2022-10-28 2022-12-23 重庆紫光华山智安科技有限公司 Image frame pushing method and system, electronic equipment and readable storage medium

Also Published As

Publication number Publication date
CN112738418B (en) 2022-12-06

Similar Documents

Publication Publication Date Title
CN112738418B (en) Video acquisition method and device and electronic equipment
CN113163260B (en) Video frame output control method and device and electronic equipment
CN111277861B (en) Method and device for extracting hot spot segments in video
CN113453073B (en) Image rendering method and device, electronic equipment and storage medium
EP3410302A1 (en) Graphic instruction data processing method, apparatus and system
CN112532998B (en) Method, device and equipment for extracting video frame and readable storage medium
CN112866809A (en) Video processing method and device, electronic equipment and readable storage medium
CN112954391A (en) Video editing method and device and electronic equipment
CN114071190B (en) Cloud application video stream processing method, related device and computer program product
CN114422799A (en) Video file decoding method and device, electronic equipment and program product
CN114125498A (en) Video data processing method, device, equipment and storage medium
CN113873318A (en) Video playing method, device, equipment and storage medium
CN113365150A (en) Video processing method and video processing device
CN109672931B (en) Method and apparatus for processing video frames
CN116866661A (en) Video prerendering method, device, equipment and storage medium
CN113411661B (en) Method, apparatus, device, storage medium and program product for recording information
CN113873323B (en) Video playing method, device, electronic equipment and medium
CN113691835B (en) Video implantation method, device, equipment and computer readable storage medium
CN113810755A (en) Panoramic video preview method and device, electronic equipment and storage medium
CN113784217A (en) Video playing method, device, equipment and storage medium
CN113627534A (en) Method and device for identifying type of dynamic image and electronic equipment
CN113778575A (en) Image processing method and device and electronic equipment
CN113438428B (en) Method, apparatus, device and computer-readable storage medium for automated video generation
CN112584226B (en) Screen capturing method and device for sharing desktop
CN114786051B (en) Video rendering method and device, electronic equipment and storage medium

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