fent / node-ytdl-core

YouTube video downloader in javascript.
MIT License
4.53k stars 805 forks source link

Missing Format Details for Livestreams #884

Open repository opened 3 years ago

repository commented 3 years ago

Hello, for certain livestream formats, ytdl-core is unable to retrieve details about the format, why is this so?

Here is an example, note itag 301.

ytdl.getInfo("https://www.youtube.com/watch?v=idUGBcSEurY");
┌──────┬───────────┬───────────┬───────────────┬───────────┬───────────────┐
│ itag │ container │  quality  │    codecs     │  bitrate  │ audio_bitrate │
├──────┼───────────┼───────────┼───────────────┼───────────┼───────────────┤
│ 300  │   'ts'    │  '720p'   │ 'H.264, aac'  │  1318000  │      48       │
│  94  │   'ts'    │  '480p'   │ 'H.264, aac'  │  800000   │      128      │
│  93  │   'ts'    │  '360p'   │ 'H.264, aac'  │  500000   │      128      │
│  92  │   'ts'    │  '240p'   │ 'H.264, aac'  │  150000   │      48       │
│  91  │   'ts'    │  '144p'   │ 'H.264, aac'  │  100000   │      48       │
│ 301  │   null    │ undefined │     null      │ undefined │   undefined   │
│ 299  │   'mp4'   │  '1080p'  │ 'avc1.4d402a' │  5144200  │     null      │
│ 299  │   'mp4'   │ '1080p60' │ 'avc1.4d402a' │  5144200  │     null      │
│ 298  │   'mp4'   │ '720p60'  │ 'avc1.4d4020' │  2639005  │     null      │
│ 136  │   'mp4'   │  '720p'   │ 'avc1.4d401f' │  2187400  │     null      │
│ 135  │   'mp4'   │  '480p'   │ 'avc1.4d401f' │  1077445  │     null      │
│ 134  │   'mp4'   │  '360p'   │ 'avc1.4d401e' │  772630   │     null      │
│ 133  │   'mp4'   │  '240p'   │ 'avc1.4d4015' │  419256   │     null      │
│ 160  │   'mp4'   │  '144p'   │ 'avc1.4d400c' │  192223   │     null      │
│ 140  │   'mp4'   │   null    │  'mp4a.40.2'  │  144000   │      128      │
└──────┴───────────┴───────────┴───────────────┴───────────┴───────────────┘

However, youtube-dl is able to get information for that format

$ youtube-dl -F  https://www.youtube.com/watch?v=idUGBcSEurY
format code  extension  resolution note
91           mp4        256x144    HLS  269k , avc1.4d400c, 30.0fps, mp4a.40.5@ 48k
92           mp4        426x240    HLS  507k , avc1.4d4015, 30.0fps, mp4a.40.5@ 48k
93           mp4        640x360    HLS  962k , avc1.4d401e, 30.0fps, mp4a.40.2@128k
94           mp4        854x480    HLS 1282k , avc1.4d401f, 30.0fps, mp4a.40.2@128k
300          mp4        1280x720   2922k , avc1.4d4020, 60.0fps, mp4a.40.2
301          mp4        1920x1080  5552k , avc1.4d402a, 60.0fps, mp4a.40.2 (best)

version: "ytdl-core": "^4.5.0"

Is there anything I can do about it?

fent commented 3 years ago

looks like 301 is a relatively new format that's not already in ytdl-core's list of formats.

although we should be parsing all of its properties from the m3u8 master file where it's first found. those properties weren't there before

#EXT-X-STREAM-INF:BANDWIDTH=5552610,CODECS="mp4a.40.2,avc1.4d402a",RESOLUTION=1920x1080,FRAME-RATE=60,VIDEO-RANGE=SDR,CLOSED-CAPTIONS=NONE
repository commented 3 years ago

Cool, I've added it to the formats myself and I'm using it locally now. https://github.com/repository/node-ytdl-core/commit/906414bd60d004cd5a0f12d7059d56dd094bddcc

I don't know how you calculate video bitrates, so I just guessed based off the other formats