# US 10,313,675 B1 · Adaptive multi-pass video encoder control

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

- Number: US 10,313,675 B1
- Document ID: US10313675B1
- Status: Granted
- Kind: B1
- Application number: 14/611,084
- Filed: 2015-01-30
- Granted: 2019-06-04
- Earliest claimed: 2015-01-30
- Assignees: Google Inc.
- Applicants: Google Inc.
- Inventors: Yao-Chung Lin; Anil Christopher Kokaram; Andrew Joseph Crawford; Hugh Pierre Denman
- Web page: https://patentgrep.com/patent/US10313675B1

## CPC

- H04N 19/147: according to rate distortion criteria (rate-distortion as a criterion for motion estimation H04N19/567)
- H04N 19/15: by monitoring actual compressed data size at the memory before deciding storage at the transmission buffer
- H04N 19/177: the unit being a group of pictures [GOP]
- H04N 19/192: the adaptation method, adaptation tool or adaptation type being iterative or recursive
- H04N 19/436: using parallelised computational arrangements
- H04N: PICTORIAL COMMUNICATION, e.g. TELEVISION

## Abstract

A method includes determining whether a rate distortion cost of a compressed video is above a cost threshold, the compressed video being encoded using a first constant rate factor (CRF). Upon determining the quality of a compressed video is above a cost threshold calculating a second CRF based on the first CRF, and encoding a video associated with the compressed video using the second CRF. Upon determining the quality of a compressed video is below a cost threshold encoding the video using the first CRF and a target bitrate.

## Claims

### Claim 1

A method, comprising:
determining whether a rate distortion cost of a compressed video is above a cost threshold, the compressed video being encoded using a first constant rate factor (CRF);
upon determining a quality of the compressed video is above the cost threshold,
calculating a second CRF as:
CRF
2
=
CRF
1
=
1
α
⁢
log
⁡
(
B
ma
⁢
⁢
x
B
1
)
where CRF1 is the first CRF,
CRF, is the second CRF,
α is a constant,
Bmax is the target maximum bitrate, and
B1 is the bitrate of the compressed video, and
encoding a video associated with the compressed video using the second CRF; or
upon determining a quality of the compressed video is below the cost threshold,
encoding a video associated with the compressed video using the first CRF and a target bitrate.

### Claim 2 (depends on 1)

The method of claim 1, further comprising:
after encoding of the video associated with the compressed video using the second CRF, determining whether a quality associated with encoding the video associated with the compressed video using the second CRF is above the cost threshold;
upon determining the quality associated with encoding the video associated with the compressed video using the second CRF is above the cost threshold,
calculating a third CRF based on the first CRF and the second CRF, and
encoding the video associated with the compressed video using the third CRF; or
upon determining the quality associated with encoding the video associated with the compressed video using the second CRF is below the cost threshold,
encoding the video associated with the compressed video using the second CRF and the target bitrate.

### Claim 3 (depends on 1)

The method of claim 1, wherein the first CRF is a default CRF.

### Claim 4 (depends on 1)

The method of claim 1, wherein
the rate distortion cost is a measured bitrate, and
the cost threshold is the target maximum bitrate.

### Claim 5 (depends on 1)

The method of claim 1, wherein
the determining of whether the quality of the compressed video is above the cost threshold includes determining whether a bitrate of the compressed video is ten percent above the target maximum bitrate, and
upon determining the bitrate of the compressed video is ten percent above the target maximum bitrate, encoding of the video associated with the compressed video using the first CRF and the target bitrate includes adjusting the first CRF based on a statistically estimated CRF.

### Claim 6 (depends on 1)

The method of claim 1, wherein the second CRF is based on:
Cost=D+λB
Where,
D is a measured distortion between the compressed video and an input video,
λ is a weighting of rate/distortion trade-offs, and
B is the bitrate of the compressed video.

### Claim 7 (depends on 1)

The method of claim 1, wherein the compressed video is encoded in a Q-CTRL pass of a multi-pass encoding scheme.

### Claim 8 (depends on 1)

The method of claim 1, wherein the encoding of the video associated with the compressed video using the first CRF and the target bitrate is encoding the video in a B-CTRL pass of a multi-pass encoding scheme.

### Claim 9

A method, comprising:
in a first pass of a multi-pass encoding scheme, encoding a video stream using a first constant rate factor (CRF) to generate a compressed video stream;
determining a rate distortion cost associated with the compressed video stream;
determining whether the rate distortion cost is above a cost threshold;
upon determining the rate distortion cost is above the cost threshold,
calculating a second CRF as:
CRF
2
=
CRF
1
+
1
α
⁢
log
⁡
(
B
ma
⁢
⁢
x
B
1
)
where CRF1 is the first CRF,
CRF is the second CRF,
α is a constant,
Bmax is the target maximum bitrate, and
B1 is the bitrate of the compressed video, and
in an intermediate pass of the multi-pass encoding scheme, encoding the video stream associated with the compressed video stream using the second CRF; or
upon determining the rate distortion cost is below the cost threshold,
in a final pass of the multi-pass encoding scheme, encoding the video stream associated with the compressed video stream using the first CRF and a target bitrate.

### Claim 10 (depends on 9)

The method of claim 9, further comprising:
after encoding of the video stream associated with the compressed video stream using the second CRF, determining whether a quality associated with encoding the video stream associated with the compressed video stream using the second CRF is above the cost threshold;
upon determining the quality associated with encoding the video stream associated with the compressed video stream using the second CRF is above the cost threshold,
calculating a third CRF based on the first CRF and the second CRF, and
encoding the video stream associated with the compressed video stream using the third CRF; or
upon determining the quality associated with encoding the video stream associated with the compressed video stream using the second CRF is below the cost threshold,
encoding a video stream associated with the compressed video stream using the second CRF and the target bitrate.

### Claim 11 (depends on 9)

The method of claim 9, wherein
the rate distortion cost is a measured bitrate, and
the cost threshold is a target maximum bitrate.

### Claim 12 (depends on 9)

The method of claim 9, wherein
the determining of whether the quality of the compressed video stream is above the cost threshold includes determining whether a bitrate of the compressed video stream is ten percent above a target maximum bitrate, and
upon determining the bitrate of the compressed video stream is ten percent above the target maximum bitrate, encoding of the video stream associated with the compressed video stream using the first CRF and the target bitrate includes adjusting the first CRF based on a statistically estimated CRF.

### Claim 13 (depends on 9)

The method of claim 9, wherein the second CRF is based on:
Cost=D+λB
Where,
D is a measured distortion between the compressed video stream and an input video,
λ is a weighting of rate/distortion trade-offs, and
B is the bitrate of the compressed video.

### Claim 14

A non-transitory computer-readable storage medium having stored thereon computer executable program code which, when executed on a computer system, causes the computer system to perform steps comprising:
determining whether a quality of a compressed video is above a cost threshold, the compressed video being encoded using a first constant rate factor (CRF);
upon determining the quality of the compressed video is above a cost threshold,
calculating a second CRF based on the first CRF as:
CRF3={circumflex over (α)} log(Bmax)+{circumflex over (β)}
where
α
^
=
log
⁡
(
B
1
)
-
log
⁡
(
B
2
)
CRF
1
-
CRF
2
,
and
{circumflex over (β)}=log(B1)−{circumflex over (α)}CRF1
CRF1 is a CRF used to encode the video before using the first CRF,
CRF2 is the first CRF,
α is a constant,
Bmax is the target maximum bitrate,
B1 is a bitrate associated with CRF1
B2 is the bitrate of the compressed video, and
encoding a video associated with the compressed video using the second CRF; or
upon determining the quality of the compressed video is below a cost threshold,
encoding a video associated with the compressed video using the first CRF and a target bitrate.

### Claim 15

A method, comprising:
in a first pass of a multi-pass encoding scheme, encoding a video stream using a first constant rate factor (CRF) to generate a first compressed video stream;
determining a rate distortion cost associated with the first compressed video stream;
determining whether the rate distortion cost is above a cost threshold;
upon determining the rate distortion cost is above the cost threshold,
calculating a second CRF as:
CRF3={circumflex over (α)} log(Bmax)+{circumflex over (β)}
where,
α
^
=
log
⁡
(
B
1
)
-
log
⁡
(
B
2
)
CRF
1
-
CRF
2
,
and
{circumflex over (β)}=log(B1)−{circumflex over (α)}CRF1
CRF1 is a CRF used to encode the video before using the first CRF,
CRF2 is the first CRF,
α is a constant,
Bmax is the target maximum bitrate,
B1 is a bitrate associated with CRF1
B2 is the bitrate of the compressed video, and
in an intermediate pass of the multi-pass encoding scheme, encoding the video stream using the second CRF; or
upon determining the rate distortion cost is below the cost threshold,
in a final pass of the multi-pass encoding scheme, encoding the video using the first CRF and a target bitrate.
