@bililive-tools/bilibili-recorder 1.18.1 → 1.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -9
- package/lib/bilibili_api.js +2 -2
- package/lib/index.js +6 -2
- package/lib/stream.js +29 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -81,15 +81,15 @@ B站录制高画质需要登录,在无法匹配到画质时,会优先使用
|
|
|
81
81
|
|
|
82
82
|
能否录制flv下的hevc和你的ffmpeg版本有关
|
|
83
83
|
|
|
84
|
-
| 解释
|
|
85
|
-
|
|
|
86
|
-
| 等于flv
|
|
87
|
-
| 优先使用flv
|
|
88
|
-
| 优先使用hls
|
|
89
|
-
|
|
|
90
|
-
| 只使用flv
|
|
91
|
-
| 只使用hls
|
|
92
|
-
| 只使用fmp4
|
|
84
|
+
| 解释 | 值 |
|
|
85
|
+
| ------------ | --------- |
|
|
86
|
+
| 等于flv | auto |
|
|
87
|
+
| 优先使用flv | flv |
|
|
88
|
+
| 优先使用hls | hls |
|
|
89
|
+
| 优先使用fmp4 | fmp4 |
|
|
90
|
+
| 只使用flv | flv_only |
|
|
91
|
+
| 只使用hls | hls_only |
|
|
92
|
+
| 只使用fmp4 | fmp4_only |
|
|
93
93
|
|
|
94
94
|
### CodecName
|
|
95
95
|
|
|
@@ -100,8 +100,10 @@ B站录制高画质需要登录,在无法匹配到画质时,会优先使用
|
|
|
100
100
|
| 等于avc | auto |
|
|
101
101
|
| 优先使用avc | avc |
|
|
102
102
|
| 优先使用hevc | hevc |
|
|
103
|
+
| 优先使用av1 | av1 |
|
|
103
104
|
| 只使用avc | avc_only |
|
|
104
105
|
| 只使用hevc | hevc_only |
|
|
106
|
+
| 只使用av1 | av1_only |
|
|
105
107
|
|
|
106
108
|
## 直播间ID解析
|
|
107
109
|
|
package/lib/bilibili_api.js
CHANGED
|
@@ -60,8 +60,8 @@ export async function getRoomPlayInfo(roomIdOrShortId, opts = {}) {
|
|
|
60
60
|
qn: opts.qn,
|
|
61
61
|
// 0 http_stream, 1 http_hls
|
|
62
62
|
protocol: "0,1",
|
|
63
|
-
// 0 avc, 1 hevc
|
|
64
|
-
codec: "0,1",
|
|
63
|
+
// 0 avc, 1 hevc,2 av1
|
|
64
|
+
codec: "0,1,2",
|
|
65
65
|
// 0 flv, 1 ts, 2 fmp4
|
|
66
66
|
format: "0,1,2",
|
|
67
67
|
only_audio: opts.onlyAudio ? "1" : "0",
|
package/lib/index.js
CHANGED
|
@@ -40,12 +40,16 @@ function createRecorder(opts) {
|
|
|
40
40
|
...info,
|
|
41
41
|
};
|
|
42
42
|
},
|
|
43
|
-
async getStream() {
|
|
43
|
+
async getStream(opts = {}) {
|
|
44
44
|
const res = await getStream({
|
|
45
45
|
channelId: this.channelId,
|
|
46
46
|
quality: this.quality,
|
|
47
|
-
formatName: this.formatName,
|
|
47
|
+
formatName: opts.formatName || this.formatName,
|
|
48
48
|
codecName: this.codecName,
|
|
49
|
+
cookie: this.auth,
|
|
50
|
+
strictQuality: false,
|
|
51
|
+
onlyAudio: this.onlyAudio,
|
|
52
|
+
customHost: this.customHost,
|
|
49
53
|
});
|
|
50
54
|
return res.currentStream;
|
|
51
55
|
},
|
package/lib/stream.js
CHANGED
|
@@ -177,6 +177,24 @@ async function getLiveInfo(roomIdOrShortId, opts) {
|
|
|
177
177
|
codec_name: "hevc",
|
|
178
178
|
sort: 4,
|
|
179
179
|
},
|
|
180
|
+
{
|
|
181
|
+
protocol_name: "http_stream",
|
|
182
|
+
format_name: "flv",
|
|
183
|
+
codec_name: "av1",
|
|
184
|
+
sort: 3,
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
protocol_name: "http_hls",
|
|
188
|
+
format_name: "fmp4",
|
|
189
|
+
codec_name: "av1",
|
|
190
|
+
sort: 2,
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
protocol_name: "http_hls",
|
|
194
|
+
format_name: "ts",
|
|
195
|
+
codec_name: "av1",
|
|
196
|
+
sort: 1,
|
|
197
|
+
},
|
|
180
198
|
];
|
|
181
199
|
// 处理formatName
|
|
182
200
|
if (opts.formatName === "flv_only") {
|
|
@@ -221,7 +239,17 @@ async function getLiveInfo(roomIdOrShortId, opts) {
|
|
|
221
239
|
});
|
|
222
240
|
conditons = conditons.sort((a, b) => b.sort - a.sort);
|
|
223
241
|
}
|
|
224
|
-
|
|
242
|
+
else if (opts.codecName === "av1") {
|
|
243
|
+
conditons.forEach((item) => {
|
|
244
|
+
if (item.codec_name === "av1") {
|
|
245
|
+
item.sort += 100;
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
conditons = conditons.sort((a, b) => b.sort - a.sort);
|
|
249
|
+
}
|
|
250
|
+
else if (opts.codecName === "av1_only") {
|
|
251
|
+
conditons = conditons.filter((item) => item.codec_name === "av1");
|
|
252
|
+
}
|
|
225
253
|
let streamInfo;
|
|
226
254
|
let streamOptions;
|
|
227
255
|
// console.log("conditons", JSON.stringify(res.playurl_info.playurl.stream, null, 2));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bililive-tools/bilibili-recorder",
|
|
3
|
-
"version": "1.18.
|
|
3
|
+
"version": "1.18.2",
|
|
4
4
|
"description": "bililive-tools bilibili recorder implemention",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"tiny-bilibili-ws": "^1.0.2",
|
|
40
40
|
"lodash-es": "^4.17.21",
|
|
41
41
|
"axios": "^1.15.0",
|
|
42
|
-
"@bililive-tools/manager": "^1.17.
|
|
42
|
+
"@bililive-tools/manager": "^1.17.1"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"build": "tsc",
|