Node-ytdl-core: Stream finishes after some seconds with livestreams

Created on 18 Oct 2020  路  6Comments  路  Source: fent/node-ytdl-core

Basically the title, tested with this livestream, no errors given the stream just ends and changing the highWaterMark option doesn't seem to do anything
Version: 3.4.1

not a bug

All 6 comments

I'm testing with the ytdl cli and it doesn't stop after a few seconds

ytdl 'https://www.youtube.com/watch?v=21X5lGlDOfg' | mpv -

what does your code look like?

I tested it with discordjs, as simple as this:

let stream = ytdl(url, {filter: "audioonly"});
connection.play(stream, {bitrate: "auto", highWaterMark: 1 << 25});

I tested it with mpv and it works fine, but with --filter audioonly it breaks too, then the console looks like this:
image

ah, I can replicate with audioonly. ok I'll investigate

Doesn't look like ytdl bug for me tbh, filter audioonly has been "breaking" livestream support on discord.js for pretty long time now (2018 or even earlier)
But i may be wrong about this and it may be a bug 馃憖

Doesn't look like ytdl bug for me tbh, filter audioonly has been "breaking" livestream support on discord.js for pretty long time now (2018 or even earlier)
But i may be wrong about this and it may be a bug 馃憖

It's happening with mpv too

investigated this a bit. downloading the formats poses no problem, the issue is playing the files. mpv can only play 4 seconds before the audio glitches out, stops, and it prints this error

[lavf] Edit lists are not correctly supported (FFmpeg issue).

I tried a couple other players, quicktime plays 4 seconds too, but vlc can play the entire downloaded track. therefore, i'm considering this a player issue, not a ytdl-core issue. I'm not sure what the issue with these formats are, the ones I had trouble playing are the audio/video only formats on the bottom. youtube may be doing something different for these formats on livestreams, or only on this stream

itag container quality codecs     bitrate  audio bitrate
 300 ts        720p    H.264, aac 1.26MB   48KB
  94 ts        480p    H.264, aac 781.25KB 128KB
  93 ts        360p    H.264, aac 488.28KB 128KB
  92 ts        240p    H.264, aac 146.48KB 48KB
  91 ts        144p    H.264, aac 97.66KB  48KB
 298 mp4       720p    H.264      3.32MB
 136 mp4       720p    H.264      2.22MB
 135 mp4       480p    H.264      1.12MB
 134 mp4       360p    H.264      630.86KB
 133 mp4       240p    H.264      195.31KB
 160 mp4       144p    H.264      121.09KB
 140 m4a               aac                 128KB
 139 mp4               aac                 48KB
 386 mp4               unknown
 387 mp4               unknown
 406 mp4               unknown

if you can't change or fix your audio player, I recommend not filtering by "audioonly" or "videoonly". the formats on top (300, 94, 93, 92, 91) do play fine for me in mpv, so their encoding may be more widely supported. you can also filter by format.isHLS as that is true for all of those formats that play.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

PKPear picture PKPear  路  4Comments

CheweyZ picture CheweyZ  路  6Comments

FireController1847 picture FireController1847  路  5Comments

barbhackk picture barbhackk  路  3Comments

cloudrac3r picture cloudrac3r  路  5Comments