# US 2024/0202886 A1 · Video processing method and apparatus, device, storage medium, and program product

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2024/0202886 A1
- Document ID: US20240202886A1
- Status: Published application
- Kind: A1
- Application number: 18/589,330
- Filed: 2024-02-27
- Published: 2024-06-20
- Earliest claimed: 2022-05-19
- Assignees: Tencent Technology (Shenzhen) Company Limited
- Applicants: Tencent Technology (Shenzhen) Company Limited
- Inventors: Ligeng ZHONG; Yunquan ZHU; Ruizhi QIAO
- Web page: https://patentgrep.com/patent/US20240202886A1

## CPC

- G06T 5/77: Retouching; Inpainting; Scratch removal
- G06T 3/40: Scaling of whole images or parts thereof, e.g. expanding or contracting
- G06T 5/60: using machine learning, e.g. neural networks
- H04N 21/23424: {involving splicing one content stream with another content stream, e.g. for inserting or substituting an advertisement}
- G06T 2207/10016: Video; Image sequence
- G06T 2207/20084: Artificial neural networks [ANN]
- G06T 2207/20132: Image cropping
- G06T: IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- H04N: PICTORIAL COMMUNICATION, e.g. TELEVISION

## Abstract

Embodiments of the present disclosure provide a video processing method performed by a computer device. The method includes: acquiring a first target frame sequence and a first target mask sequence of a target video, wherein the first target frame sequence belongs to a target single-shot frame sequence of the target video; performing frame extraction to obtain a first sampled frame sequence, a first remaining frame sequence, a first sampled mask sequence, and a first remaining mask sequence; performing flow propagation and image inpainting to obtain a first inpainted sampled frame sequence and a first inpainted remaining frame sequence; and combining the first inpainted sampled frame sequence and the first inpainted remaining frame sequence to obtain an inpainted video of the target video.

## Claims

### Claim 1

A video processing method performed by a computer device, the method comprising:
acquiring a first target frame sequence and a first target mask sequence of a target video, wherein the first target frame sequence belongs to a target single-shot frame sequence of the target video;
respectively performing frame extraction on the first target frame sequence and the first target mask sequence to obtain a first sampled frame sequence and a first remaining frame sequence thereof and a first sampled mask sequence and a first remaining mask sequence thereof;
performing flow propagation and image inpainting on the first sampled frame sequence and the first sampled mask sequence to obtain a first inpainted sampled frame sequence;
performing flow propagation and image inpainting on the first remaining frame sequence, and the first remaining mask sequence based on the first inpainted sampled frame sequence to obtain a first inpainted remaining frame sequence; and
combining the first inpainted sampled frame sequence and the first inpainted remaining frame sequence to obtain an inpainted video of the target video.

### Claim 2 (depends on 1)

The method according to claim 1, wherein the performing flow propagation and image inpainting on the first remaining frame sequence, and the first remaining mask sequence based on the first inpainted sampled frame sequence to obtain a first inpainted remaining frame sequence comprises:
performing gradient pixel conversion on the first remaining frame sequence to obtain a first remaining gradient frame sequence;
obtaining a first remaining optical flow sequence according to the first remaining frame sequence and the first sampled frame sequence;
performing flow filling on a mask region in the first remaining optical flow sequence to obtain a first filled remaining optical flow sequence; and
performing flow propagation and image inpainting on the first remaining gradient frame sequence, the first filled remaining optical flow sequence, and the first remaining mask sequence based on the first inpainted sampled frame sequence to obtain the first inpainted remaining frame sequence.

### Claim 3 (depends on 1)

The method according to claim 1, wherein the performing flow propagation and image inpainting on the first sampled frame sequence and the first sampled mask sequence to obtain a first inpainted sampled frame sequence comprises:
performing flow propagation on the first sampled frame sequence and the first sampled mask sequence to obtain a first updated sampled gradient frame sequence and a first updated sampled mask sequence;
performing Poisson reconstruction on the first updated sampled gradient frame sequence and the first updated sampled mask sequence to obtain a first updated sampled frame sequence; and
performing frame-by-frame image inpainting on the first updated sampled frame sequence to obtain the first inpainted sampled frame sequence.

### Claim 4 (depends on 1)

The method according to claim 1, wherein the acquiring a first target frame sequence and a first target mask sequence of a target video comprises:
acquiring a first frame sequence of the target video and a first mask sequence corresponding to the first frame sequence;
when a proportion of a mask region in the first mask sequence is less than a proportion threshold, determining a target mask according to the first mask sequence, wherein a mask region of the target mask covers the mask region in the first mask sequence; and
cropping the first frame sequence and the first mask sequence respectively according to the target mask to obtain the first target frame sequence and the first target mask sequence.

### Claim 5 (depends on 1)

The method according to claim 1, wherein the acquiring a first target frame sequence and a first target mask sequence of a target video comprises:
acquiring a first frame sequence of the target video and a first mask sequence corresponding to the first frame sequence; and
when a proportion of a mask region in the first mask sequence is greater than or equal to a proportion threshold, zooming the first frame sequence and the first mask sequence respectively to obtain the first target frame sequence and the first target mask sequence.

### Claim 6 (depends on 1)

The method according to claim 1, wherein the acquiring a first target frame sequence and a first target mask sequence of a target video comprises:
acquiring a complete frame sequence of the target video and a corresponding complete mask sequence; and
performing shot segmentation on the complete frame sequence and the complete mask sequence respectively to obtain a plurality of single-shot frame sequences and corresponding single-shot mask sequences, the plurality of single-shot frame sequences including the target single-shot frame sequence.

### Claim 7 (depends on 6)

The method according to claim 6, wherein the method further comprises:
when the target single-shot frame sequence and the corresponding single-shot mask sequence exceed a duration threshold, fragmenting the target single-shot frame sequence and the corresponding single-shot mask sequence to obtain a fragment frame sequence and a corresponding fragment mask sequence, wherein the fragment frame sequence comprises a first frame sequence, and the fragment mask sequence comprises a first mask sequence; and
obtaining the first target frame sequence and the first target mask sequence according to the first frame sequence and the first mask sequence corresponding to the first frame sequence.

### Claim 8 (depends on 1)

The method according to claim 1, wherein the combining the first inpainted sampled frame sequence and the first inpainted remaining frame sequence to obtain an inpainted video of the target video comprises:
inserting tail frames of the first inpainted sampled frame sequence and the first inpainted remaining frame sequence into a second frame sequence and a second mask sequence respectively as head frames of the second frame sequence and the second mask sequence, wherein the second frame sequence is immediately behind the first inpainted sampled frame sequence in the target video;
processing the second frame sequence and the second mask sequence to obtain a second inpainted sampled frame sequence and a second inpainted remaining frame sequence; and
combining the first inpainted sampled frame sequence, the first inpainted remaining frame sequence, the second inpainted sampled frame sequence, and the second inpainted remaining frame sequence to obtain the inpainted video.

### Claim 9

A computer device, comprising a processor, a memory, and an input/output interface, the processor being connected to the memory and the input/output interface, the input/output interface being configured to receive data and output data, the memory being configured to store a computer program, the processor being configured to invoke the computer program, to cause the computer device to perform a video processing method including:
acquiring a first target frame sequence and a first target mask sequence of a target video, wherein the first target frame sequence belongs to a target single-shot frame sequence of the target video;
respectively performing frame extraction on the first target frame sequence and the first target mask sequence to obtain a first sampled frame sequence and a first remaining frame sequence thereof and a first sampled mask sequence and a first remaining mask sequence thereof;
performing flow propagation and image inpainting on the first sampled frame sequence and the first sampled mask sequence to obtain a first inpainted sampled frame sequence;
performing flow propagation and image inpainting on the first remaining frame sequence, and the first remaining mask sequence based on the first inpainted sampled frame sequence to obtain a first inpainted remaining frame sequence; and
combining the first inpainted sampled frame sequence and the first inpainted remaining frame sequence to obtain an inpainted video of the target video.

### Claim 10 (depends on 9)

The computer device according to claim 9, wherein the performing flow propagation and image inpainting on the first remaining frame sequence, and the first remaining mask sequence based on the first inpainted sampled frame sequence to obtain a first inpainted remaining frame sequence comprises:
performing gradient pixel conversion on the first remaining frame sequence to obtain a first remaining gradient frame sequence;
obtaining a first remaining optical flow sequence according to the first remaining frame sequence and the first sampled frame sequence;
performing flow filling on a mask region in the first remaining optical flow sequence to obtain a first filled remaining optical flow sequence; and
performing flow propagation and image inpainting on the first remaining gradient frame sequence, the first filled remaining optical flow sequence, and the first remaining mask sequence based on the first inpainted sampled frame sequence to obtain the first inpainted remaining frame sequence.

### Claim 11 (depends on 9)

The computer device according to claim 9, wherein the performing flow propagation and image inpainting on the first sampled frame sequence and the first sampled mask sequence to obtain a first inpainted sampled frame sequence comprises:
performing flow propagation on the first sampled frame sequence and the first sampled mask sequence to obtain a first updated sampled gradient frame sequence and a first updated sampled mask sequence;
performing Poisson reconstruction on the first updated sampled gradient frame sequence and the first updated sampled mask sequence to obtain a first updated sampled frame sequence; and
performing frame-by-frame image inpainting on the first updated sampled frame sequence to obtain the first inpainted sampled frame sequence.

### Claim 12 (depends on 9)

The computer device according to claim 9, wherein the acquiring a first target frame sequence and a first target mask sequence of a target video comprises:
acquiring a first frame sequence of the target video and a first mask sequence corresponding to the first frame sequence;
when a proportion of a mask region in the first mask sequence is less than a proportion threshold, determining a target mask according to the first mask sequence, wherein a mask region of the target mask covers the mask region in the first mask sequence; and
cropping the first frame sequence and the first mask sequence respectively according to the target mask to obtain the first target frame sequence and the first target mask sequence.

### Claim 13 (depends on 9)

The computer device according to claim 9, wherein the acquiring a first target frame sequence and a first target mask sequence of a target video comprises:
acquiring a first frame sequence of the target video and a first mask sequence corresponding to the first frame sequence; and
when a proportion of a mask region in the first mask sequence is greater than or equal to a proportion threshold, zooming the first frame sequence and the first mask sequence respectively to obtain the first target frame sequence and the first target mask sequence.

### Claim 14 (depends on 9)

The computer device according to claim 9, wherein the acquiring a first target frame sequence and a first target mask sequence of a target video comprises:
acquiring a complete frame sequence of the target video and a corresponding complete mask sequence; and
performing shot segmentation on the complete frame sequence and the complete mask sequence respectively to obtain a plurality of single-shot frame sequences and corresponding single-shot mask sequences, the plurality of single-shot frame sequences including the target single-shot frame sequence.

### Claim 15 (depends on 14)

The computer device according to claim 14, wherein the method further comprises:
when the target single-shot frame sequence and the corresponding single-shot mask sequence exceed a duration threshold, fragmenting the target single-shot frame sequence and the corresponding single-shot mask sequence to obtain a fragment frame sequence and a corresponding fragment mask sequence, wherein the fragment frame sequence comprises a first frame sequence, and the fragment mask sequence comprises a first mask sequence; and
obtaining the first target frame sequence and the first target mask sequence according to the first frame sequence and the first mask sequence corresponding to the first frame sequence.

### Claim 16 (depends on 9)

The computer device according to claim 9, wherein the combining the first inpainted sampled frame sequence and the first inpainted remaining frame sequence to obtain an inpainted video of the target video comprises:
inserting tail frames of the first inpainted sampled frame sequence and the first inpainted remaining frame sequence into a second frame sequence and a second mask sequence respectively as head frames of the second frame sequence and the second mask sequence, wherein the second frame sequence is immediately behind the first inpainted sampled frame sequence in the target video;
processing the second frame sequence and the second mask sequence to obtain a second inpainted sampled frame sequence and a second inpainted remaining frame sequence; and
combining the first inpainted sampled frame sequence, the first inpainted remaining frame sequence, the second inpainted sampled frame sequence, and the second inpainted remaining frame sequence to obtain the inpainted video.

### Claim 17

A non-transitory computer-readable storage medium storing a computer program, the computer program being suitable for being loaded and executed by a processor of a computer device, to cause the computer device to perform a video processing method including:
acquiring a first target frame sequence and a first target mask sequence of a target video, wherein the first target frame sequence belongs to a target single-shot frame sequence of the target video;
respectively performing frame extraction on the first target frame sequence and the first target mask sequence to obtain a first sampled frame sequence and a first remaining frame sequence thereof and a first sampled mask sequence and a first remaining mask sequence thereof;
performing flow propagation and image inpainting on the first sampled frame sequence and the first sampled mask sequence to obtain a first inpainted sampled frame sequence;
performing flow propagation and image inpainting on the first remaining frame sequence, and the first remaining mask sequence based on the first inpainted sampled frame sequence to obtain a first inpainted remaining frame sequence; and
combining the first inpainted sampled frame sequence and the first inpainted remaining frame sequence to obtain an inpainted video of the target video.

### Claim 18 (depends on 17)

The non-transitory computer-readable storage medium according to claim 17, wherein the performing flow propagation and image inpainting on the first sampled frame sequence and the first sampled mask sequence to obtain a first inpainted sampled frame sequence comprises:
performing flow propagation on the first sampled frame sequence and the first sampled mask sequence to obtain a first updated sampled gradient frame sequence and a first updated sampled mask sequence;
performing Poisson reconstruction on the first updated sampled gradient frame sequence and the first updated sampled mask sequence to obtain a first updated sampled frame sequence; and
performing frame-by-frame image inpainting on the first updated sampled frame sequence to obtain the first inpainted sampled frame sequence.

### Claim 19 (depends on 17)

The non-transitory computer-readable storage medium according to claim 17, wherein the acquiring a first target frame sequence and a first target mask sequence of a target video comprises:
acquiring a complete frame sequence of the target video and a corresponding complete mask sequence; and
performing shot segmentation on the complete frame sequence and the complete mask sequence respectively to obtain a plurality of single-shot frame sequences and corresponding single-shot mask sequences, the plurality of single-shot frame sequences including the target single-shot frame sequence.

### Claim 20 (depends on 17)

The non-transitory computer-readable storage medium according to claim 17, wherein the combining the first inpainted sampled frame sequence and the first inpainted remaining frame sequence to obtain an inpainted video of the target video comprises:
inserting tail frames of the first inpainted sampled frame sequence and the first inpainted remaining frame sequence into a second frame sequence and a second mask sequence respectively as head frames of the second frame sequence and the second mask sequence, wherein the second frame sequence is immediately behind the first inpainted sampled frame sequence in the target video;
processing the second frame sequence and the second mask sequence to obtain a second inpainted sampled frame sequence and a second inpainted remaining frame sequence; and
combining the first inpainted sampled frame sequence, the first inpainted remaining frame sequence, the second inpainted sampled frame sequence, and the second inpainted remaining frame sequence to obtain the inpainted video.
