CN117939237A - Video processing method, device, terminal equipment and storage medium - Google Patents

Video processing method, device, terminal equipment and storage medium Download PDF

Info

Publication number
CN117939237A
CN117939237A CN202311817127.8A CN202311817127A CN117939237A CN 117939237 A CN117939237 A CN 117939237A CN 202311817127 A CN202311817127 A CN 202311817127A CN 117939237 A CN117939237 A CN 117939237A
Authority
CN
China
Prior art keywords
image
video
slice
video frame
frame
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.)
Pending
Application number
CN202311817127.8A
Other languages
Chinese (zh)
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.)
SHENZHEN CULTRAVIEW DIGITAL TECHNOLOGY CO LTD
Original Assignee
SHENZHEN CULTRAVIEW DIGITAL TECHNOLOGY CO LTD
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by SHENZHEN CULTRAVIEW DIGITAL TECHNOLOGY CO LTD filed Critical SHENZHEN CULTRAVIEW DIGITAL TECHNOLOGY CO LTD
Priority to CN202311817127.8A priority Critical patent/CN117939237A/en
Publication of CN117939237A publication Critical patent/CN117939237A/en
Pending legal-status Critical Current

Links

Landscapes

  • Television Signal Processing For Recording (AREA)

Abstract

The embodiment of the application is suitable for the technical field of computers, and provides a video processing method, a device, terminal equipment and a storage medium, wherein the method comprises the following steps: responding to a video processing instruction initiated by a user, and extracting a plurality of first image groups from the video to be processed; the video processing instruction carries loss parameters set by a user; for any first image group, discarding the first video frame in the any first image group based on the loss parameter to generate a second image group corresponding to the any first image group; and decoding a plurality of second image groups based on a preset decoding algorithm, and outputting target videos containing a plurality of mosaic pictures corresponding to the number of the lost parameters. By the method provided by the embodiment, the user can control the generation quantity of the mosaic pictures by changing the loss parameters.

Description

Video processing method, device, terminal equipment and storage medium
Technical Field
The embodiment of the application belongs to the technical field of computers, and particularly relates to a video processing method, a video processing device, terminal equipment and a storage medium.
Background
In the prior art, when a technician needs to acquire a video containing a mosaic picture, the technician typically generates the mosaic picture in a normal video stream by simulating actual signal interference during video transmission. Since the mosaic frames caused by signal interference are random, it is difficult for a technician of the existing mosaic frame generation method to accurately control the number of mosaic frames in a video.
Disclosure of Invention
In view of this, the embodiments of the present application provide a video processing method, apparatus, terminal device, and storage medium, by which a user can accurately control the number of generated mosaic frames in a video by changing a loss parameter.
A first aspect of an embodiment of the present application provides a video processing method, including:
responding to a video processing instruction initiated by a user, and extracting a plurality of first image groups from the video to be processed; the video processing instruction carries loss parameters set by a user;
For any first image group, discarding the first video frame in the any first image group based on the loss parameter to generate a second image group corresponding to the any first image group;
And decoding a plurality of second image groups based on a preset decoding algorithm, and outputting target video containing a plurality of mosaic pictures corresponding to the loss parameters.
In a possible implementation manner of the first aspect, the loss parameter includes a frame loss rate corresponding to the first video frame;
for any first image group, discarding the first video frame in the any first image group based on a preset loss parameter, and generating a second image group corresponding to the any first image group, including:
Determining the total number of video frames corresponding to the first image group;
and randomly deleting at least one first video frame in the first image group based on the frame loss rate and the total number of the video frames to obtain a second image group.
In a possible implementation manner of the first aspect, the randomly deleting at least one of the first video frames in the first image group based on the frame loss rate and the total number of video frames to obtain a second image group includes:
Inputting the frame loss rate and the total number of video frames into a first random function to generate at least one first discard number;
and deleting the first video frames corresponding to each first discarding number in the first image group to obtain a second image group.
In a possible implementation manner of the first aspect, the loss parameter further includes a slice loss rate; each video frame includes a plurality of image slices;
The step of randomly deleting at least one of the first video frames in the first image group based on the frame loss rate and the total number of video frames to obtain a second image group includes:
Determining the total number of fragments corresponding to each second video frame for a plurality of second video frames remained in the first image group after random deletion;
For any second video frame, randomly deleting at least one first image slice in the second video frame based on the slice loss rate and the total number of slices corresponding to the any second video frame, and identifying the second video frame after deleting the first image slice as a third video frame;
The second group of images is generated based on a plurality of the third video frames.
In a possible implementation manner of the first aspect, for any second video frame, randomly deleting at least one first image slice in the second video frame based on the slice loss rate and the total number of slices corresponding to the any second video frame, and identifying the second video frame after deleting the first image slice as a third video frame includes:
inputting the slice loss rate and the total number of slices into a second random function to generate a plurality of second discarding numbers;
And deleting the first image fragments corresponding to the second discarding numbers in any one of the second video frames, and identifying the second video frames after deleting the first image fragments as the third video frames.
In a possible implementation manner of the first aspect, the loss parameter further includes a block loss rate; each image slice comprises a plurality of image blocks;
for any second video frame, randomly deleting at least one first image slice in the second video frame based on the slice loss rate and the total number of slices corresponding to the any second video frame, and identifying the second video frame after deleting the first image slice as a third video frame, including:
Determining the total number of macro blocks corresponding to each second image slice for a plurality of second image slices remained in the second video frame after random deletion;
For any second image slice, randomly deleting at least one image block in any second image slice based on the block loss rate and the total number of macro blocks corresponding to the any second image slice, and identifying the second image slice after deleting the image block as a third image slice;
the third video frame is generated based on a plurality of the third image slices.
In a possible implementation manner of the first aspect, for any second image slice, the randomly deleting at least one image block in any second image slice based on the block loss rate and the total number of macro blocks corresponding to the any second image slice, and identifying the second image slice after deleting the image block as a third image slice includes:
Inputting the block loss rate and the total number of the macro blocks into a third random function to generate a plurality of third discarding numbers;
And deleting the image blocks corresponding to the third discarding numbers in any second image slice, and identifying the second image slice after deleting the image blocks as the third image slice.
A second aspect of an embodiment of the present application provides a video processing apparatus, including:
The extraction module is used for responding to a video processing instruction initiated by a user and extracting a plurality of first image groups from the video to be processed; the video processing instruction carries loss parameters set by a user;
The discarding module is used for discarding the first video frames in any first image group based on the loss parameters to generate a second image group corresponding to the any first image group;
And the decoding module is used for decoding a plurality of the second image groups based on a preset decoding algorithm and outputting target video containing a plurality of mosaic pictures corresponding to the loss parameters.
A third aspect of an embodiment of the present application provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, the processor implementing the video processing method according to the first aspect when executing the computer program.
A fourth aspect of embodiments of the present application provides a computer readable storage medium storing a computer program which, when executed by a processor, implements a video processing method as described in the first aspect above.
A fifth aspect of an embodiment of the present application provides a computer program product, which when run on a computer causes the computer to perform the video processing method of the first aspect described above.
Compared with the prior art, the embodiment of the application has the following advantages:
In the embodiment of the application, when a user needs to generate a video containing a mosaic picture or generate a video picture containing the mosaic, the user can initiate a video processing instruction to terminal equipment; the video processing instruction initiated by the user can carry the loss parameters set by the user; the terminal equipment can respond to a video processing instruction initiated by a user to extract a plurality of first image groups from the video to be processed; after extracting a plurality of first image groups, the terminal equipment can discard the first video frames in any one of the first image groups corresponding to the video to be processed according to the loss parameters in the video processing instruction so as to generate a second image group corresponding to the first image group; after the terminal device generates the second image group, the terminal device may decode the second image groups corresponding to the video to be processed according to a decoding algorithm preset by the user, so as to output a target video including a plurality of mosaic frames corresponding to the loss parameters. In this embodiment, the terminal device may discard the first video frame corresponding to the video to be processed according to the loss parameter set by the user, so as to generate the mosaic image. Therefore, by the method provided by the embodiment, the user can accurately control the generation quantity of the mosaic pictures through the loss parameters.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings that are required to be used in the embodiments or the description of the prior art. It is evident that the drawings in the following description are only some embodiments of the present application and that other drawings may be obtained from these drawings without inventive effort for a person of ordinary skill in the art.
Fig. 1 is a schematic diagram of a video processing method according to an embodiment of the present application;
fig. 2 is a flowchart of a specific implementation of a video processing method S102 according to an embodiment of the present application;
fig. 3 is a flowchart of a specific implementation of a video processing method S202 according to an embodiment of the present application;
Fig. 4 is a flowchart of a specific implementation of a video processing method S302 according to an embodiment of the present application;
FIG. 5 is a schematic diagram of a video processing process according to an embodiment of the present application;
Fig. 6 is a schematic diagram of a video processing apparatus according to an embodiment of the present application;
Fig. 7 is a schematic diagram of a terminal device according to an embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth such as the particular system architecture, techniques, etc., in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
The technical scheme of the application is described below through specific examples.
Referring to fig. 1, a schematic diagram of a video processing method provided by an embodiment of the present application may specifically include the following steps:
S101, responding to a video processing instruction initiated by a user, and extracting a plurality of first image groups from a video to be processed; the video processing instruction carries a loss parameter set by a user.
In this embodiment, when the user needs to generate a video including a mosaic frame or generate a mosaic frame corresponding to a certain video, the user may initiate a video processing instruction to the terminal device. The video processing instruction initiated by the user can carry the loss parameters set by the user and the video to be processed which needs to generate the mosaic picture. The terminal device may extract a plurality of first groups of pictures (Group of Pictures, GOP) from the video to be processed in response to a user initiated video processing instruction. The video to be processed for generating the mosaic picture may be a video of any format code Stream, such as an original format code Stream (ELEMENTARY STREAMS, ES), a display time-stamped format code Stream (Presentation TIME STAMP, PTS), a Decoding time-stamped format code Stream (Decoding TIME STAMP, DTS), a Transport format code Stream (TS), and the like. The loss parameters set by the user can be used to control the number of times a picture containing a mosaic appears in the video and the degree of appearance of the mosaic in each mosaic picture.
Specifically, the terminal device may, in response to a video processing instruction initiated by a user, import a video to be processed into video processing software preset by the user or an analysis algorithm preset by the user, so as to analyze the video to be processed through the video processing software or the analysis algorithm, and obtain a plurality of first image groups corresponding to the video to be processed. The video processing software may be any application software known to those skilled in the art, such as Adobe AFTER EFFECTS, FFmpeg, openCV, and the like, which can perform video editing on video. The parsing algorithm may be any algorithm known to those skilled in the art that can be performed on a video and extract multiple image groups from the video. The embodiments of the present application are not intended to be limited to video processing software or parsing algorithms in particular.
S102, for any first image group, discarding the first video frame in the any first image group based on the loss parameter, and generating a second image group corresponding to the any first image group.
In this embodiment, a plurality of video frames may be included in each image group. After the terminal device acquires a plurality of first image groups corresponding to the video to be processed, discarding the first image groups. For any one of the first image groups, the terminal device can discard the first video frames in the first image group according to the loss parameters in the video processing instruction so as to generate a second image group corresponding to the first image group. The loss parameters in the video processing instructions may include, among other things, a frame loss rate, a slice loss rate, and a block loss rate. Wherein a plurality of video frames may be included in the group of images. Any one video frame in an image group may be composed of a plurality of image slices. Any one image slice in a video frame may be made up of a plurality of image blocks.
The frame loss rate in the loss parameter may be used to control the number of dropped video frames in any one image group, i.e. the frame loss rate may be used to control the number of mosaic pictures that occur in any one image group. The slice loss rate in the loss parameter can be used to control the number of dropped image slices in any video frame, and since the position of the dropped image slices in the video frame generates a mosaic during decoding, the slice loss rate can be used to control the proportion of the mosaic part in any mosaic picture. The block loss rate in the loss parameter may be used to control the number of discarded image blocks in any image slice, and since the position of the discarded image block in the video frame generates a mosaic when decoding, the block loss rate may be used to control the occupancy of the mosaic portion in any mosaic picture.
Wherein, each image group in the video to be processed can contain a plurality of video frames with different encoding and decoding types. Wherein the individual video frames in the group of images may be present in the group of images in a sequence in their corresponding order. Any one group of pictures may contain one intra-coded frame (INTRA FRAME, I) of the first codec type, a plurality of forward predicted frames (PREDICTED FRAME, P) of the second codec type, and a plurality of Bi-predicted frames (Bi-PREDICTIVE FRAME, B) of the third codec type. For any intra-coded frame in the group of pictures, the terminal device can directly decode it into a video picture. For any one of the forward predicted frames in the group of pictures, the terminal device may decode in combination with an intra-coded frame or forward predicted frame preceding the frame to generate a video picture. For any one of the bi-directionally predicted frames in the group of pictures, the terminal device may decode in conjunction with an intra-coded frame or a forward predicted frame preceding the frame and a forward predicted frame following the frame to generate a video picture. The first video frame in the first image group may be a forward prediction frame of the second codec type and/or a bi-directional prediction frame of the third codec type, i.e. after the terminal device acquires the first image group, the terminal device may discard the forward prediction frame and/or the bi-directional prediction frame in the first image group to generate a mosaic picture corresponding to the video to be processed.
And S103, decoding a plurality of second image groups based on a preset decoding algorithm, and outputting target video containing a plurality of mosaic pictures corresponding to the loss parameters.
In this embodiment, after the terminal device generates a plurality of second image groups corresponding to the video to be processed, the terminal device may determine a decoding algorithm corresponding to the second image groups according to an encoding standard corresponding to the video to be processed. When the user needs to acquire the target video with the mosaic picture, the terminal device can decode the plurality of second image groups according to a decoding algorithm corresponding to the coding standard so as to output the target video containing a plurality of mosaic pictures corresponding to the loss parameters in the video processing instruction.
When the user needs to acquire the mosaic video pictures corresponding to the video to be processed, the terminal equipment can decode each second image group in sequence according to a decoding algorithm corresponding to the coding standard, and the video picture output by the last frame in each second image group is used as the mosaic video picture corresponding to the second image group. After the terminal device generates the mosaic video pictures corresponding to each second image group, the terminal device can save the generated mosaic video pictures according to a storage path preset by a user. The terminal equipment can write the mosaic video pictures into a local database where the terminal equipment is located according to the storage path for storage. The terminal device can also generate storage information to a target database in a different place in the storage path so as to write the mosaic picture into the target database in the different place for storage.
For example, when the coding standard corresponding to the video to be processed is the h.264 standard, the terminal device may decode the plurality of second image groups through the h.264 decoding algorithm. When the coding standard corresponding to the video to be processed is the H.265 standard, the terminal equipment can decode the plurality of second image groups through an H.265 decoding algorithm. The terminal device may further import the generated plurality of second image groups into a video codec preset by the user for decoding, where the video codec in the terminal device may be any codec known to those skilled in the art, such as an X264 codec, an X265 codec, and an HM codec. The embodiments of the present application are not intended to be limited to specific decoding algorithms or codecs.
In this embodiment, when a user needs to generate a mosaic video picture corresponding to a video to be processed or generate a target video including a mosaic picture, the user may initiate a video processing instruction including a loss parameter to a terminal device. The terminal device may discard the first image group in the video to be processed according to the loss parameter in the video processing instruction. Because the loss parameter set by the user can be used for controlling the discarding number of the video frames, the image slices and the image blocks when the terminal device executes the discarding process, the user can precisely control the number of the mosaic pictures in the target video and precisely control the mosaic duty ratio in each mosaic picture by the method provided by the embodiment.
In addition, since the terminal equipment generates the mosaic picture by executing the discarding action, the method provided by the embodiment can generate the mosaic picture of the video to be processed without actual signal interference, namely, the terminal equipment can directly generate the mosaic picture of the video to be processed on the video stream layer, and the terminal equipment can automatically and rapidly generate the mosaic picture in batches, so that the generation speed of the mosaic picture is greatly increased.
Fig. 2 shows a flowchart of a specific implementation of a video processing method S102 according to a second embodiment of the present application. Referring to fig. 2, compared to the embodiment shown in fig. 1, in the video processing method provided in this embodiment, S102 includes: s201 to S202 are specifically described below:
S201, determining the total number of video frames corresponding to the first image group.
In this embodiment, the first image group extracted by the terminal device may include a plurality of first video frames. Wherein the first video frames in the first group of pictures may be forward predicted frames and/or bi-predicted frames in the first group of pictures. The loss parameters in the video processing instructions may include a frame loss rate. After extracting a plurality of first image groups corresponding to the video to be processed, the terminal device may discard the first video frames in each first image group according to the frame loss rate in the loss parameter. For a first image group currently performing the discarding process, the terminal device may calculate a total number of video frames corresponding to the first image group.
S202, randomly deleting at least one first video frame in the first image group based on the frame loss rate and the total number of video frames to obtain a second image group.
In this embodiment, after determining the total number of video frames corresponding to the first image group currently performing the discarding process, the terminal device may randomly delete at least one first video frame in the current first image group according to the frame loss rate and the total number of video frames in the loss parameter, so as to obtain a second image group after the first image group performs the discarding process.
In one possible implementation manner, after determining the total number of video frames corresponding to the first image group, the terminal device may input the total number of video frames corresponding to the first image group and the frame loss rate into a first random function preset by a user to generate at least one first discard number. The first discard number may be a number corresponding to the first video frame to be deleted. After determining at least one first discarding number, the terminal device may delete the first video frame corresponding to each first discarding number in the first image group to obtain a second image group. After obtaining the second image groups, the terminal device may further generate first discarding information, and display the first discarding information corresponding to each second image group to the user. The first discard information generated by the terminal device may include a first discard number corresponding to each second image group. The terminal device can inform the user of the deleted first video frame in the video processing task through the first discarding information. The terminal device may further store each second image group and the corresponding first discarding information thereof according to a storage path preset by the user.
In one possible implementation, the first random function in the terminal device may be as follows:
frame[i]=frame[i]*randomLost(Ftotal,f,i)
f∈[0,1)
0<i<Ftotal
Wherein, ftotal in the first random function may represent a total number of video frames corresponding to the current first image group. F in the first random function may represent a frame loss rate corresponding to the current first group of images. I in the first random function may represent the video number i. frame [ i ] may represent a discard result corresponding to video number i, and frame [ i ] may be 0 or 1. The terminal device may input the frame loss rate and the total number of video frames into a first random function, so as to output a discard result corresponding to each video frame number through the first random function. The terminal device may determine at least one first discard number corresponding to the first image group from all video frame numbers according to discard results corresponding to the video frame numbers. For example, the terminal device may identify a video number with a discard result of 0 as a first discard number, and delete a first video frame corresponding to the first discard number. For example, when the discard result corresponding to the video number 1 is 1, the terminal device may reserve the first video frame corresponding to the video number 1. When the discarding result corresponding to the video number 2 is 0, the terminal device may identify the video number 2 as the first discarding number corresponding to the current first image group, and delete the video frame corresponding to the video number 2.
In this embodiment, the terminal device may randomly delete the first video frame in the first image group according to the frame loss rate in the loss parameter, and since the frame loss rate is set by the user when initiating the video processing instruction, by using the method provided in this embodiment, the user may accurately control the occurrence ratio of the mosaic image in the video. In addition, because the terminal equipment is realized by randomly deleting the first video frame when the mosaic picture is generated, the method provided by the embodiment of the application can effectively simulate the phenomenon of data packet loss in the signal transmission process, thereby realizing the generation of the mosaic picture corresponding to the video to be processed on the data layer.
Further, since the terminal device may generate the first discard number corresponding to the first video frame to be deleted by a random function when performing discard processing on the first video frame in the first image group, and generate the first discard information according to all the first discard numbers after generating the second image group. Therefore, by the method provided by the embodiment, the user can determine the video frame where the mosaic is located according to the first discard number in the first discard information while obtaining the target video including the mosaic picture. Therefore, by the method provided by the embodiment, a user can quickly and accurately locate the video frame where the mosaic is located without carrying out video analysis on the video containing the mosaic image, so that the generation efficiency of the mosaic image or the mosaic video is improved, and the locating requirement of the user when the user uses the mosaic image or the mosaic video for testing and researching can be met.
Fig. 3 shows a flowchart of a specific implementation of a video processing method S202 according to a third embodiment of the present application. Referring to fig. 3, compared to the embodiment shown in fig. 2, in a video processing method provided in this embodiment, S202 includes: s301 to S303 are specifically described below:
S301, determining the total number of fragments corresponding to each second video frame for a plurality of second video frames remained in the first image group after random deletion.
In this embodiment, each video frame in the image group may be constituted by a plurality of image slices. The loss parameters set by the user may also include a loss rate of the slice. The slice loss rate may represent a proportion of the number of image slices deleted in any video frame in the total number of slices of the video frame. The total number of slices may represent the total number of image slices contained in the current video frame. In order to further generate the mosaic frame, the terminal device may perform a random deletion operation on image slices in a plurality of second video frames remaining in the first image group after performing the random deletion operation on the first video frame in the first image group. The second video frame in the first image group may be a forward predicted frame and/or a bi-directional predicted frame remaining in the first image group after the video frame is randomly deleted. The terminal device may perform a random deletion operation of image slices on the forward predicted frames and/or the bi-directional predicted frames remaining in the first image group after the random deletion of the video frames, to further generate the mosaic picture. For the plurality of second video frames remaining in the first image group after the video frames are deleted randomly, the terminal device may determine the total number of slices corresponding to each of the second video frames.
S302, for any second video frame, randomly deleting at least one first image slice in the second video frame based on the slice loss rate and the total number of slices corresponding to the any second video frame, and identifying the second video frame after deleting the first image slice as a third video frame.
In this embodiment, after determining the total number of slices corresponding to each second video frame, the terminal device may perform a random deletion operation of image slices on each second video frame. For any one of the remaining second video frames in the first image group, the terminal device may randomly delete at least one first image slice in the current second video frame according to the total number of slices corresponding to the second video frame and the slice loss rate corresponding to the second video frame. The terminal device may identify the second video frame after randomly deleting the first image slice as a third video frame.
In one possible implementation, after determining the total number of slices corresponding to each second video frame, a random deletion operation of image slices may be sequentially performed on each second video frame. The terminal device may input the total number of slices and the slice loss rate corresponding to the second video frame currently performing the random deleting operation of the image slices into a second random function preset by the user, so as to generate at least one second discard number corresponding to the current second video frame. The second discard number may be a number corresponding to the first image slice to be deleted in the second video frame. After determining at least one second discarding number corresponding to the second video frame, the terminal device may delete the first image slices corresponding to each second discarding number in the second video frame, and generate a third video frame according to the plurality of second image slices remaining after randomly deleting the first image slices.
After generating the third video frames, the terminal device may also generate second discard information, and display discard information corresponding to each third video frame to the user. The second discard information generated by the terminal device may include a second discard number corresponding to each deleted first image slice. The terminal device can inform the user of the deleted first image fragments in each third video frame in the video processing task through the second discarding information. After the third video frame is generated, the terminal device may store the third video frame and the second discard information corresponding to the third video frame according to a storage path preset by the user.
In one possible implementation, the second random function in the terminal device may be as follows:
slice[i]=slice[i]*randomLost(Stotal,s,i)
0<i<Stotal
s∈[0,1)
The Stotal in the second random function may represent a total number of slices corresponding to the second video frame in which the random deletion operation of the image slices is currently performed. S in the second random function may represent a slice loss rate corresponding to the current second video frame. I in the random function may represent the tile number i. slice [ i ] may represent a discard result corresponding to the slice number i, and slice [ i ] may be 0 or 1. The terminal device may input the slice loss rate and the total number of slices into a random function, so as to output a discard result corresponding to each slice number through the random function. The terminal device may determine at least one second discard number corresponding to the second video frame from all the slice numbers according to discard results corresponding to the slice numbers. For example, the terminal device may identify the tile number with the discard result of 0 as the second discard number, and delete the first image tile corresponding to the second discard number. For example, when the discarding result corresponding to the slice number 1 is 1, the terminal device may reserve the first image slice corresponding to the slice number 1. When the discarding result corresponding to the slice number 2 is 0, the terminal device may identify the slice number 2 as a second discarding number corresponding to the current second video frame, and delete the image slice corresponding to the slice number 2.
S303, generating the second image group based on a plurality of third video frames.
In this embodiment, after generating a plurality of third video frames corresponding to the first image group, the terminal device may generate the second image group according to the plurality of third video frames after randomly deleting the image slices in the first image group. When the terminal device generates the second image group, the terminal device may also generate first discarding information and second discarding information corresponding to the second image group. The first discard information may include a first discard number corresponding to each first video frame deleted in the second image group, and the second discard information may include a second discard number corresponding to each first image slice deleted in each second video frame in the second image group.
In this embodiment, the terminal device may randomly delete the first image slice in the second video frame according to the slice loss rate in the loss parameter, and since the slice loss rate is set by the user when initiating the video processing instruction, by using the method provided in this embodiment, the user may accurately control the picture occupation ratio of the mosaic in each video picture.
In addition, when the terminal device performs random deletion operation on the first image slices in the second video frame, a second discarding number corresponding to the first image slices to be deleted can be generated through a random function, and after the second image group is generated, second discarding information is generated according to all the second discarding numbers. Therefore, by the method provided by the embodiment, when a user obtains the mosaic picture corresponding to the video to be processed, the image fragments discarded in each video frame can be determined according to the second discarding number, so that the position of the mosaic in each video picture can be determined. Therefore, by the method provided by the embodiment, a user can quickly and accurately locate the position of the mosaic in each video picture without carrying out video analysis on the video containing the mosaic picture, so that the generation efficiency of the mosaic picture or the mosaic video is improved, and the locating requirement of the user when testing and researching by using the mosaic picture or the mosaic video can be met.
Fig. 4 shows a flowchart of a specific implementation of a video processing method S302 according to a fourth embodiment of the present application. Referring to fig. 4, compared to the embodiment shown in fig. 3, in a video processing method provided in this embodiment, S302 includes: s401 to S403 are specifically described below:
S401, determining the total number of macro blocks corresponding to each second image slice for a plurality of second image slices remained in the second video frame after random deletion.
S402, for any second image slice, randomly deleting at least one image block in any second image slice based on the block loss rate and the total number of macro blocks corresponding to the any second image slice, and identifying the second image slice after deleting the image block as a third image slice.
In one possible implementation, the third random function in the terminal device may be as follows:
macroblock[i]=macroblock[i]*randomLost(Mtotal,m,i)
0<i<Mtotal
m∈[0,1)
Wherein Mtotal in the third random function may represent a total number of macro blocks corresponding to the current second image slice. M in the third random function may represent a block loss rate corresponding to the current second image slice. I in the third random function may represent the macroblock number i. The macroblock [ i ] may represent a discard result corresponding to the macroblock number i, and the macroblock [ i ] may be 0 or 1.
S403, generating the third video frame based on a plurality of the third image slices.
In the present embodiment, the specific contents in S401 to S403 are similar to those in S301 to S303 in the third embodiment of the present application, and the reader can understand S401 to S403 in the present embodiment with reference to the specific contents in S301 to S303 in the third embodiment.
Specifically, when understanding the present embodiment with reference to the third embodiment, the reader may understand that the first image group in the third embodiment is replaced with the second video frame in the present embodiment, the second video frame in the third embodiment is replaced with the second image slice in the present embodiment, the total number of slices in the third embodiment is replaced with the total number of macro blocks in the present embodiment, the slice loss rate in the third embodiment is replaced with the block loss rate in the present embodiment, the first image slice in the third embodiment is replaced with the image block in the present embodiment, the third video frame in the third embodiment is replaced with the third image slice in the present embodiment, and the second image group in the third embodiment is replaced with the third video frame in the present embodiment.
In this embodiment, the terminal device may randomly delete the image blocks in the second image slice according to the block loss rate in the loss parameter, and since the block loss rate is set by the user according to the user's own requirement when initiating the video processing instruction, by using the method provided in this embodiment, the user may accurately control the picture occupation ratio of the mosaic in each video picture.
In addition, when the terminal device performs random deletion operation on the image blocks in the second image slice, a third discarding number corresponding to the image block to be deleted can be generated through a random function, and after the third video frame is generated, third discarding information is generated according to all the third discarding numbers. Therefore, by the method provided by the embodiment, when a user obtains the mosaic picture corresponding to the video to be processed, the image blocks discarded in each video frame can be determined according to the third discarding number, so that the position of the mosaic in each video picture can be determined. Therefore, by the method provided by the embodiment, the user can more accurately control the duty ratio of the mosaic in the picture, and more accurately determine the appearance position of the mosaic in each video picture according to the third discarding information.
Referring to fig. 5, a schematic diagram of a video processing procedure according to an embodiment of the present application is shown. As shown in fig. 5, after a user initiates a video processing instruction to a terminal device, the terminal device may extract a plurality of image groups from a video to be processed in response to the video processing instruction initiated by the user. After extracting a plurality of image groups corresponding to the video to be processed, the terminal device can execute random discarding processing on each image group in sequence. For the image group i+1 currently performing the random discard process, the terminal device may randomly delete the video frames in the image group i+1 according to the frame loss rate in the video processing instruction. As shown in fig. 5, the terminal device may delete the randomly selected video frame i+2. For the remaining video frames in the image group i+1 after the random deletion operation, the terminal device may sequentially perform the random deletion operation of image slices on each remaining video frame according to the slice loss rate in the video processing instruction. For the video frame i+1 currently performing the random deletion operation, the terminal device may perform the random deletion operation on each image slice in the video frame i+1 according to the slice loss rate.
As shown in fig. 5, the terminal device may delete the randomly selected image slice i+1 in the video frame i+1. After the terminal device performs the random deletion operation on the image slices in any video frame, the terminal device can perform the random deletion operation on the image blocks in the remaining image slices according to the block loss rate in the video processing instruction for the remaining image slices after the random deletion in the video frame. As shown in fig. 5, the terminal device may delete the image block i+1, the image block i+4, and the image block i+7 selected at random in the image slice i+2. After the terminal device performs the random deletion operation of the image blocks, a new image slice can be generated according to the remaining image blocks, and a new video frame can be generated according to the newly generated image slices.
Finally, the terminal device may generate a new image group according to the plurality of newly generated video frames after performing the complete random deletion operation. The terminal device can execute random discarding processing on each image group corresponding to the video to be processed in sequence, and generate a plurality of new image groups corresponding to the video to be processed. After the terminal device generates a plurality of new image groups, if the target output in the video processing instruction initiated by the user is a mosaic picture, the terminal device can sequentially decode each new image group through a decoding algorithm, and take the video picture decoded by the last frame of video frame in each new image group as the target output, and output the mosaic picture. If the target output in the video processing instruction initiated by the user is mosaic video, the terminal equipment can decode a plurality of new image groups through a decoding algorithm so as to output mosaic video containing mosaic pictures.
It should be noted that, the sequence number of each step in the above embodiment does not mean the sequence of execution sequence, and the execution sequence of each process should be determined by its function and internal logic, and should not limit the implementation process of the embodiment of the present application in any way.
Referring to fig. 6, a schematic diagram of a video processing apparatus according to an embodiment of the present application may specifically include an extracting module 601, a discarding module 602, and a decoding module 603, where:
an extracting module 601, configured to extract a plurality of first image groups from a video to be processed in response to a video processing instruction initiated by a user; the video processing instruction carries loss parameters set by a user;
The discarding module 602 is configured to discard, for any first image group, a first video frame in the any first image group based on the loss parameter, and generate a second image group corresponding to the any first image group;
The decoding module 603 is configured to decode a plurality of the second image groups based on a preset decoding algorithm, and output a target video including a plurality of mosaic frames corresponding to the loss parameter.
The discarding module is further configured to determine a total number of video frames corresponding to the first image group; and randomly deleting at least one first video frame in the first image group based on the frame loss rate and the total number of the video frames to obtain a second image group.
The discarding module is further configured to input the frame loss rate and the total number of video frames into a first random function, and generate at least one first discarding number; and deleting the first video frames corresponding to each first discarding number in the first image group to obtain a second image group.
The discarding module is further configured to determine, for a plurality of second video frames remaining in the first image group after random deletion, a total number of slices corresponding to each of the second video frames; for any second video frame, randomly deleting at least one first image slice in the second video frame based on the slice loss rate and the total number of slices corresponding to the any second video frame, and identifying the second video frame after deleting the first image slice as a third video frame; the second group of images is generated based on a plurality of the third video frames.
The discarding module is further configured to input the slice loss rate and the total number of slices into a second random function, and generate a plurality of second discarding numbers; and deleting the first image fragments corresponding to the second discarding numbers in any one of the second video frames, and identifying the second video frames after deleting the first image fragments as the third video frames.
The discarding module is further configured to determine, for a plurality of second image slices remaining in the second video frame after the random deletion, a total number of macro blocks corresponding to each of the second image slices; for any second image slice, randomly deleting at least one image block in any second image slice based on the block loss rate and the total number of macro blocks corresponding to the any second image slice, and identifying the second image slice after deleting the image block as a third image slice; the third video frame is generated based on a plurality of the third image slices.
The discarding module is further configured to input the block loss rate and the total number of macro blocks into a third random function, and generate a plurality of third discarding numbers; and deleting the image blocks corresponding to the third discarding numbers in any second image slice, and identifying the second image slice after deleting the image blocks as the third image slice.
For the device embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference should be made to the description of the method embodiments.
Referring to fig. 7, a schematic diagram of a terminal device provided by an embodiment of the present application is shown. As shown in fig. 7, a terminal device 700 in an embodiment of the present application includes: a processor 710, a memory 720 and a computer program 721 stored in the memory 720 and executable on the processor 710. The processor 710, when executing the computer program 721, implements the steps of the embodiments of the video processing method described above, such as steps S101 to S103 shown in fig. 1. Or the processor 710, when executing the computer program 721, performs the functions of the modules/units in the above-described device embodiments, e.g. the functions of the modules 601 to 603 shown in fig. 6.
Illustratively, the computer program 721 may be partitioned into one or more modules/units that are stored in the memory 720 and executed by the processor 710 to accomplish the present application. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which may be used to describe the execution of the computer program 721 in the terminal device 700. For example, the computer program 721 may be divided into an extraction module, a discarding module and a decoding module, each of which functions specifically as follows:
The extraction module is used for responding to a video processing instruction initiated by a user and extracting a plurality of first image groups from the video to be processed; the video processing instruction carries loss parameters set by a user;
The discarding module is used for discarding the first video frames in any first image group based on the loss parameters to generate a second image group corresponding to the any first image group;
And the decoding module is used for decoding a plurality of the second image groups based on a preset decoding algorithm and outputting target video containing a plurality of mosaic pictures corresponding to the loss parameters.
The terminal device 700 may be the terminal device in the foregoing respective embodiments. The terminal device 700 may include, but is not limited to, a processor 710, a memory 720. It will be appreciated by those skilled in the art that fig. 7 is merely an example of a terminal device 700 and is not meant to be limiting of the terminal device 700, and may include more or fewer components than shown, or may combine certain components, or different components, e.g., the terminal device 700 may also include input and output devices, network access devices, buses, etc.
The Processor 710 may be a central processing unit (Central Processing Unit, CPU), but may also be other general purpose processors, digital signal processors (DIGITAL SIGNAL Processor, DSP), application SPECIFIC INTEGRATED Circuit (ASIC), off-the-shelf Programmable gate array (Field-Programmable GATE ARRAY, FPGA) or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 720 may be an internal storage unit of the terminal device 700, for example, a hard disk or a memory of the terminal device 700. The memory 720 may also be an external storage device of the terminal device 700, such as a plug-in hard disk, a smart memory card (SMART MEDIA CARD, SMC), a Secure Digital (SD) card, a flash memory card (FLASH CARD) or the like, which are provided on the terminal device 700. Further, the memory 720 may also include both an internal storage unit and an external storage device of the terminal device 700. The memory 720 is used for storing the computer program 721 and other programs and data required by the terminal device 700. The memory 720 may also be used to temporarily store data that has been output or is to be output.
The embodiment of the application also discloses a terminal device which comprises a memory, a processor and a computer program stored in the memory and capable of running on the processor, wherein the video processing method in each embodiment is realized when the processor executes the computer program.
The embodiments of the present application also disclose a computer readable storage medium storing a computer program which, when executed by a processor, implements the video processing method described in the foregoing embodiments.
The embodiment of the application also discloses a computer program product which, when running on a computer, causes the computer to execute the video processing method described in the previous embodiments.
The above embodiments are only for illustrating the technical solution of the present application, and are not limited thereto. Although the application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present application, and are intended to be included in the scope of the present application.

Claims (10)

1. A video processing method, comprising:
responding to a video processing instruction initiated by a user, and extracting a plurality of first image groups from the video to be processed; the video processing instruction carries loss parameters set by a user;
For any first image group, discarding the first video frame in the any first image group based on the loss parameter to generate a second image group corresponding to the any first image group;
And decoding a plurality of second image groups based on a preset decoding algorithm, and outputting target video containing a plurality of mosaic pictures corresponding to the loss parameters.
2. The method of claim 1, wherein the loss parameter comprises a frame loss rate corresponding to the first video frame;
for any first image group, discarding the first video frame in the any first image group based on a preset loss parameter, and generating a second image group corresponding to the any first image group, including:
Determining the total number of video frames corresponding to the first image group;
and randomly deleting at least one first video frame in the first image group based on the frame loss rate and the total number of the video frames to obtain a second image group.
3. The method of claim 2, wherein randomly deleting at least one of the first video frames in the first group of images based on the frame loss rate and the total number of video frames to obtain a second group of images comprises:
Inputting the frame loss rate and the total number of video frames into a first random function to generate at least one first discard number;
and deleting the first video frames corresponding to each first discarding number in the first image group to obtain a second image group.
4. The method of claim 2, wherein the loss parameters further comprise a slice loss rate; each video frame includes a plurality of image slices;
The step of randomly deleting at least one of the first video frames in the first image group based on the frame loss rate and the total number of video frames to obtain a second image group includes:
Determining the total number of fragments corresponding to each second video frame for a plurality of second video frames remained in the first image group after random deletion;
For any second video frame, randomly deleting at least one first image slice in the second video frame based on the slice loss rate and the total number of slices corresponding to the any second video frame, and identifying the second video frame after deleting the first image slice as a third video frame;
The second group of images is generated based on a plurality of the third video frames.
5. The method of claim 4, wherein for any second video frame, randomly deleting at least one first image slice in the second video frame based on the slice loss rate and the total number of slices corresponding to the any second video frame, and identifying the second video frame from which the first image slice was deleted as a third video frame comprises:
inputting the slice loss rate and the total number of slices into a second random function to generate a plurality of second discarding numbers;
And deleting the first image fragments corresponding to the second discarding numbers in any one of the second video frames, and identifying the second video frames after deleting the first image fragments as the third video frames.
6. The method according to claim 4 or 5, wherein the loss parameters further comprise a block loss rate; each image slice comprises a plurality of image blocks;
for any second video frame, randomly deleting at least one first image slice in the second video frame based on the slice loss rate and the total number of slices corresponding to the any second video frame, and identifying the second video frame after deleting the first image slice as a third video frame, including:
Determining the total number of macro blocks corresponding to each second image slice for a plurality of second image slices remained in the second video frame after random deletion;
For any second image slice, randomly deleting at least one image block in any second image slice based on the block loss rate and the total number of macro blocks corresponding to the any second image slice, and identifying the second image slice after deleting the image block as a third image slice;
the third video frame is generated based on a plurality of the third image slices.
7. The method of claim 6, wherein for any second image slice, randomly deleting at least one of the image blocks in the any second image slice based on the block loss rate and the total number of macro blocks corresponding to the any second image slice, and identifying the second image slice after deleting the image block as a third image slice, comprising:
Inputting the block loss rate and the total number of the macro blocks into a third random function to generate a plurality of third discarding numbers;
And deleting the image blocks corresponding to the third discarding numbers in any second image slice, and identifying the second image slice after deleting the image blocks as the third image slice.
8. A video processing apparatus, comprising:
The extraction module is used for responding to a video processing instruction initiated by a user and extracting a plurality of first image groups from the video to be processed; the video processing instruction carries loss parameters set by a user;
The discarding module is used for discarding the first video frames in any first image group based on the loss parameters to generate a second image group corresponding to the any first image group;
And the decoding module is used for decoding a plurality of the second image groups based on a preset decoding algorithm and outputting target video containing a plurality of mosaic pictures corresponding to the loss parameters.
9. A terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the video processing method according to any of claims 1-7 when executing the computer program.
10. A computer readable storage medium storing a computer program, wherein the computer program when executed by a processor implements the video processing method according to any one of claims 1-7.
CN202311817127.8A 2023-12-26 2023-12-26 Video processing method, device, terminal equipment and storage medium Pending CN117939237A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311817127.8A CN117939237A (en) 2023-12-26 2023-12-26 Video processing method, device, terminal equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311817127.8A CN117939237A (en) 2023-12-26 2023-12-26 Video processing method, device, terminal equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117939237A true CN117939237A (en) 2024-04-26

Family

ID=90752972

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311817127.8A Pending CN117939237A (en) 2023-12-26 2023-12-26 Video processing method, device, terminal equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117939237A (en)

Similar Documents

Publication Publication Date Title
US20210076051A1 (en) Coding apparatus, coding method, decoding apparatus, and decoding method
US11527068B2 (en) Methods and systems for video processing
US12015770B2 (en) Method for encoding video data, device, and storage medium
US20170180746A1 (en) Video transcoding method and electronic apparatus
US20200177907A1 (en) Video encoding apparatus, video decoding apparatus, video encoding method, and video decoding method
CN105430417B (en) Encoding method, decoding method, device and electronic equipment
CN110582012B (en) Video switching method, video processing device and storage medium
CN113473126B (en) Video stream processing method and device, electronic equipment and computer readable medium
CN109963176B (en) Video code stream processing method and device, network equipment and readable storage medium
US10771792B2 (en) Encoding data arrays
CN108924574B (en) Packet loss processing method, device, equipment and storage medium in recording and broadcasting system
US11922972B2 (en) Method and apparatus for video coding
CN115134629B (en) Video transmission method, system, equipment and storage medium
CN111757121A (en) Video stream reverse playing method and device
CN110784717B (en) Encoding method, encoding device, electronic equipment and storage medium
CN117939237A (en) Video processing method, device, terminal equipment and storage medium
CN112019878A (en) Video decoding and editing method, device, equipment and storage medium
CN115278307A (en) Video playing method, device, equipment and medium
TWI439137B (en) A method and apparatus for restructuring a group of pictures to provide for random access into the group of pictures
CN117135364B (en) Video decoding method and system
CN115379236B (en) Video processing method, device, medium and equipment
WO2024067736A1 (en) Video coding method and apparatus, computing device, storage medium, and program product
CN115695918B (en) Multi-camera broadcast guide control method and device, readable storage medium and terminal equipment
CN116248890A (en) Video coding method, device, computer equipment and storage medium
CN112511891A (en) Recording file processing method, device, equipment and 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