@bililive-tools/bilibili-recorder 1.8.0 → 1.9.0

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 CHANGED
@@ -62,15 +62,16 @@ interface Options {
62
62
 
63
63
  B站录制高画质需要登录,在无法匹配到画质时,会优先使用高画质
64
64
 
65
- | 画质 | 值 |
66
- | ---- | ----- |
67
- | 杜比 | 30000 |
68
- | 4K | 20000 |
69
- | 原画 | 10000 |
70
- | 蓝光 | 400 |
71
- | 超清 | 250 |
72
- | 高清 | 150 |
73
- | 流畅 | 80 |
65
+ | 画质 | 值 |
66
+ | -------- | ----- |
67
+ | 杜比 | 30000 |
68
+ | 4K | 20000 |
69
+ | 原画真彩 | 25000 |
70
+ | 原画 | 10000 |
71
+ | 蓝光 | 400 |
72
+ | 超清 | 250 |
73
+ | 高清 | 150 |
74
+ | 流畅 | 80 |
74
75
 
75
76
  ### formatName
76
77
 
package/lib/index.js CHANGED
@@ -63,14 +63,7 @@ function createRecorder(opts) {
63
63
  });
64
64
  return recorderWithSupportUpdatedEvent;
65
65
  }
66
- const ffmpegOutputOptions = [
67
- "-c",
68
- "copy",
69
- "-movflags",
70
- "faststart+frag_keyframe+empty_moov",
71
- "-min_frag_duration",
72
- "10000000",
73
- ];
66
+ const ffmpegOutputOptions = [];
74
67
  const ffmpegInputOptions = [
75
68
  "-rw_timeout",
76
69
  "10000000",
@@ -91,6 +84,7 @@ const checkLiveStatusAndRecord = async function ({ getSavePath, isManualStart, b
91
84
  avatar: "",
92
85
  cover: "",
93
86
  liveId: liveId,
87
+ startTime: new Date(),
94
88
  };
95
89
  this.state = "idle";
96
90
  }
@@ -122,7 +116,7 @@ const checkLiveStatusAndRecord = async function ({ getSavePath, isManualStart, b
122
116
  }
123
117
  }
124
118
  const liveInfo = await getInfo(this.channelId);
125
- const { owner, title, roomId } = liveInfo;
119
+ const { owner, title, roomId, startTime } = liveInfo;
126
120
  this.liveInfo = liveInfo;
127
121
  let res;
128
122
  try {
@@ -200,12 +194,19 @@ const checkLiveStatusAndRecord = async function ({ getSavePath, isManualStart, b
200
194
  const reason = args[0] instanceof Error ? args[0].message : String(args[0]);
201
195
  this.recordHandle?.stop(reason);
202
196
  };
197
+ const recordStartTime = new Date();
203
198
  const recorder = createBaseRecorder(this.recorderType, {
204
199
  url: url,
205
200
  outputOptions: ffmpegOutputOptions,
206
201
  inputOptions: ffmpegInputOptions,
207
202
  segment: this.segment ?? 0,
208
- getSavePath: (opts) => getSavePath({ owner, title: opts.title ?? title, startTime: opts.startTime }),
203
+ getSavePath: (opts) => getSavePath({
204
+ owner,
205
+ title: opts.title ?? title,
206
+ startTime: opts.startTime,
207
+ liveStartTime: startTime,
208
+ recordStartTime,
209
+ }),
209
210
  formatName: streamOptions.format_name,
210
211
  disableDanma: this.disableProvideCommentsWhenRecording,
211
212
  videoFormat: this.videoFormat,
@@ -220,6 +221,9 @@ const checkLiveStatusAndRecord = async function ({ getSavePath, isManualStart, b
220
221
  const savePath = getSavePath({
221
222
  owner,
222
223
  title,
224
+ startTime: Date.now(),
225
+ liveStartTime: startTime,
226
+ recordStartTime,
223
227
  });
224
228
  try {
225
229
  ensureFolderExist(savePath);
package/lib/stream.js CHANGED
@@ -1,6 +1,7 @@
1
- import { BiliQualities, utils } from "@bililive-tools/manager";
1
+ import { utils } from "@bililive-tools/manager";
2
2
  import { getRoomInit, getRoomPlayInfo, getStatusInfoByUIDs, getRoomBaseInfo, } from "./bilibili_api.js";
3
3
  import { assert } from "./utils.js";
4
+ const BiliQualities = [30000, 20000, 25000, 10000, 400, 250, 150, 80];
4
5
  export async function getStrictStream(roomId, options) {
5
6
  const res = await getRoomPlayInfo(roomId, options);
6
7
  const streamInfo = res.playurl_info.playurl.stream
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bililive-tools/bilibili-recorder",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
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.7.8",
42
- "@bililive-tools/manager": "^1.8.0"
42
+ "@bililive-tools/manager": "^1.9.0"
43
43
  },
44
44
  "scripts": {
45
45
  "build": "tsc",