Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于视频码率问题 #133

Open
Darcrandex opened this issue Jul 15, 2023 · 1 comment
Open

关于视频码率问题 #133

Darcrandex opened this issue Jul 15, 2023 · 1 comment

Comments

@Darcrandex
Copy link

大佬你好,感谢你的项目。目前下载视频遇到一点问题,希望可以解决一下。

问题描述:
单个视频情况下,选择指定视频清晰度后,下载下来的视频的码率不正确。

我查看了源码,其中获取视频下载地址的方法似乎不会获取最大码率的一项,如下:
videoUrl

dash.video.find((item: any) => item.id === quality) ? dash.video.find((item: any) => item.id === quality).baseUrl : dash.video[0].baseUrl

以下方数据为例

const videoInfo = {
  video_codecid: 7,
  data: {
    bash: {
      video: [
        {
          id: 120,
          bandwidth: 3070633,
          mimeType: "video/mp4",
          mime_type: "video/mp4",
          codecs: "hev1.1.6.L153.90",
          width: 2160,
          height: 3840,
          frameRate: "62.500",
          frame_rate: "62.500",
          sar: "1:1",
          startWithSap: 1,
          start_with_sap: 1,
          SegmentBase: { Initialization: "0-1157", indexRange: "1158-1405" },
          segment_base: { initialization: "0-1157", index_range: "1158-1405" },
          codecid: 12,
        },
        {
          id: 120,
          bandwidth: 11128732,
          mimeType: "video/mp4",
          mime_type: "video/mp4",
          codecs: "avc1.640034",
          width: 2160,
          height: 3840,
          frameRate: "62.500",
          frame_rate: "62.500",
          sar: "1:1",
          startWithSap: 1,
          start_with_sap: 1,
          SegmentBase: { Initialization: "0-994", indexRange: "995-1242" },
          segment_base: { initialization: "0-994", index_range: "995-1242" },
          codecid: 7,
        },
        {
          id: 120,
          bandwidth: 2224746,
          mimeType: "video/mp4",
          mime_type: "video/mp4",
          codecs: "av01.0.13M.08.0.110.01.01.01.0",
          width: 2160,
          height: 3840,
          frameRate: "60.150",
          frame_rate: "60.150",
          sar: "1:1",
          startWithSap: 1,
          start_with_sap: 1,
          SegmentBase: { Initialization: "0-1023", indexRange: "1052-1299" },
          segment_base: { initialization: "0-1023", index_range: "1052-1299" },
          codecid: 13,
        },
      ],
    },
  },
};

按照代码的功能,会获取列表中第一个视频,但是第一个视频的码率是最低的,应该是 codecid:7 的那一项才是正确的。
所以应该是 dash.video.find((item: any) => item.id === quality && item.codecid === cid)

希望大佬抽时间修复一个这个 bug,再次感谢。

@zqhong
Copy link

zqhong commented Aug 12, 2023

你可以自己修改提交 PR ,问题已经定位到了。

我测试了下。

下载视频:
https://www.bilibili.com/video/BV1zc411w7rw/

清晰度选择:
HDR 真彩

image image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants