Skip to content

Commit 5c49199

Browse files
committed
add how to record the video stream
1 parent 57e752c commit 5c49199

File tree

5 files changed

+410
-2
lines changed

5 files changed

+410
-2
lines changed

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"libusb",
1616
"logcat",
1717
"muxer",
18+
"muxing",
1819
"MVVM",
1920
"nohostname",
2021
"nouser",

docs/scrcpy/control/index.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Control device
22

3+
import Version from "../version-span";
4+
35
Scrcpy supports various input events, including mouse, touch, keyboard, and physical buttons. The client sends input events to the server, which injects them into the device.
46

57
There are three ways to create or send control messages, they provide the same set of methods:
@@ -15,6 +17,7 @@ There are three ways to create or send control messages, they provide the same s
1517
- Collapse panels: Collapse the notification and quick settings panels.
1618
- [Rotate device](./rotate.mdx): Change the device orientation.
1719
- Set clipboard: Set the device clipboard (only supports plain text).
20+
- <Version since="v3.0">[Reset video](./reset-video.mdx): Restart video capture and encoding.</Version>
1821

1922
## Using `@yume-chan/scrcpy`
2023

docs/scrcpy/control/reset-video.mdx

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
sidebar_position: 12
3+
---
4+
5+
# Reset video
6+
7+
:::info
8+
9+
Added in Scrcpy 3.0
10+
11+
:::
12+
13+
Restart video capture and encoding.
14+
15+
Because a video must start with a configuration and keyframe to be decoded, sometimes you might want to manually restart video capture and encoding, which produces a new configuration packet and keyframe data packet immediately.
16+
17+
For example, when you want to [save a video](../video/record.mdx) from a specific point, or stream the video to multiple players, and a new player is added.
18+
19+
Reset video will cause a very small pause in the video stream, but it should be acceptable for most cases.
20+
21+
## Usage
22+
23+
```ts transpile
24+
import { AndroidKeyEventAction } from "@yume-chan/scrcpy";
25+
26+
// Using `ScrcpyControlMessageSerializer`
27+
const message: Uint8Array = serializer.resetVideo();
28+
29+
// Using `ScrcpyControlMessageWriter`
30+
await writer.resetVideo();
31+
32+
// Using `AdbScrcpyClient`
33+
await client.controller!.resetVideo();
34+
```

docs/scrcpy/video/index.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ When the encoder is restarted, a new configuration packet will be generated and
112112

113113
The `data` field contains the codec-specific configuration information:
114114

115-
* H.264: Sequence Parameter Set (SPS) and Picture Parameter Set (PPS)
116-
* H.265: Video Parameter Set (VPS), Sequence Parameter Set (SPS), and Picture Parameter Set (PPS)
115+
* H.264: Sequence Parameter Set (SPS) and Picture Parameter Set (PPS) in Annex B format.
116+
* H.265: Video Parameter Set (VPS), Sequence Parameter Set (SPS), and Picture Parameter Set (PPS) in Annex B format.
117117
* AV1: The first 3 bytes of `AV1CodecConfigurationRecord` (https://aomediacodec.github.io/av1-isobmff/#av1codecconfigurationbox). The remaining configuration OBUs are in the next data packet.
118118

119119
The client should handle this packet and update the decoder accordingly.

0 commit comments

Comments
 (0)