Closed Trigus42 closed 2 years ago
ffmpeg-static?
Show us your Packages
Do you mean the npm packages? package-lock.json
Adding ffmpeg-static
using npm i ffmpeg-static
didn't solve the issue.
Only package.json
,
Do you use only FFmpeg?
Did you try to listen to any Errors?
My package.json
:
{
"dependencies": {
"@discordjs/opus": "^0.7.0",
"@distube/spotify": "^1.1.0",
"@distube/yt-dlp": "^1.0.2",
"axios": "^0.25.0",
"discord.js": "13.3.1",
"distube": "3.3.2",
"ffmpeg-static": "^4.4.1",
"sqlite3": "https://github.com/mapbox/node-sqlite3/tarball/master"
},
"devDependencies": {
"@types/node": "^17.0.8",
"@types/sqlite3": "^3.1.8",
"ts-node": "^10.4.0",
"typescript": "^4.5.5"
},
"name": "discord-music-bot",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"description": ""
}
I get the following caught errors:
TypeError: Cannot read properties of undefined (reading 'relatedVideoArgs')
at Object.exports.getRelatedVideos (/home/user/Documents/Code/DiscordMusicBot/node_modules/@distube/ytdl-core/lib/info-extras.js:201:65)
at exports.getBasicInfo (/home/user/Documents/Code/DiscordMusicBot/node_modules/@distube/ytdl-core/lib/info.js:71:28)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
TypeError: Cannot read properties of undefined (reading 'thumbnails')
at parseRelatedVideo (/home/user/Documents/Code/DiscordMusicBot/node_modules/@distube/ytdl-core/lib/info-extras.js:177:80)
at Object.exports.getRelatedVideos (/home/user/Documents/Code/DiscordMusicBot/node_modules/@distube/ytdl-core/lib/info-extras.js:214:19)
at exports.getBasicInfo (/home/user/Documents/Code/DiscordMusicBot/node_modules/@distube/ytdl-core/lib/info.js:71:28)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
TypeError: metadataRows is not iterable
at Object.exports.getMedia (/home/user/Documents/Code/DiscordMusicBot/node_modules/@distube/ytdl-core/lib/info-extras.js:36:21)
at exports.getBasicInfo (/home/user/Documents/Code/DiscordMusicBot/node_modules/@distube/ytdl-core/lib/info.js:75:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
TypeError: Cannot read properties of undefined (reading 'accessibilityData')
at Object.exports.getDislikes (/home/user/Documents/Code/DiscordMusicBot/node_modules/@distube/ytdl-core/lib/info-extras.js:260:76)
at exports.getBasicInfo (/home/user/Documents/Code/DiscordMusicBot/node_modules/@distube/ytdl-core/lib/info.js:80:22)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
TypeError: Cannot read properties of undefined (reading 'slice')
at Function.idToBinary (/home/user/Documents/Code/DiscordMusicBot/node_modules/discord.js/src/util/Util.js:531:29)
at Function.deconstruct (/home/user/Documents/Code/DiscordMusicBot/node_modules/discord.js/src/util/SnowflakeUtil.js:63:25)
at isSnowflake (/home/user/Documents/Code/DiscordMusicBot/node_modules/distube/src/util.ts:107:26)
at isMemberInstance (/home/user/Documents/Code/DiscordMusicBot/node_modules/distube/src/util.ts:116:5)
at new Song (/home/user/Documents/Code/DiscordMusicBot/node_modules/distube/src/struct/Song.ts:80:25)
at DisTubeHandler.resolveSong (/home/user/Documents/Code/DiscordMusicBot/node_modules/distube/src/core/DisTubeHandler.ts:139:40)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async DisTube.play (/home/user/Documents/Code/DiscordMusicBot/node_modules/distube/src/DisTube.ts:287:16)
at async Client.<anonymous> (/home/user/Documents/Code/DiscordMusicBot/src/index.ts:208:13)
If I play a video regardless of whether it works or not, this line is executed: https://github.com/skick1234/DisTube/blob/a759440f26593105228c524c1d70202e517dbde5/src/core/voice/DisTubeVoice.ts#L159
Then somewhere something goes wrong and those lines are called even though the video is not over: https://github.com/skick1234/DisTube/blob/a759440f26593105228c524c1d70202e517dbde5/src/core/voice/DisTubeVoice.ts#L46-L51
If I pause the execution by adding a break point somewhere after the await distube.play
, the video sometimes plays flawlessly, sometimes just the first few seconds play. Could this have something to do with buffering?
Trigus42, have you tried using the youtubeCookie
option? Some related issues are caused because of the cookie, you can check how to get one here
I tried using the youtubeCookie
option with youtube-dl and with the YtDlpPlugin. To confirm that the cookie is used, I tried playing an age-restricted video, which worked. However, this didn't solve the issue.
Should be due to your FFmpeg cannot stream some URLs. Try downgrading or installing it from another source. I cannot reproduce your error.
If I install ffmpeg-static
I now get the error I before only got with a few select streams with every stream, until I completely remove ffmpeg-static
. If I don't install the node ffmpeg-static
module, the ffmpeg binary of the system is used and working for some URLs.
On my PC I have installed ffmpeg version n5.0
from the official Manjaro repos. I use a docker container with node:17 as base image to actually deploy my bot. There the ffmpeg version is 4.3.3-0+deb11u1
and I get the same error.
If I use ffmpeg from the command line with the stream URL of a video that doesn't work in the bot, it works fine:
ffmpeg -i "https://rr5---sn-i5h7lnll.googlevideo.com/videoplayback?expire=1647552208&ei=cFIzYt3EA8SJ6dsP87KcgAo&ip=77.23.112.149&id=o-AMJvAeQeH_6MV_uOvqSrXaZf--65DFEfI9UUZ39X27dh&itag=251&source=youtube&requiressl=yes&mh=ri&mm=31%2C29&mn=sn-i5h7lnll%2Csn-i5heen7s&ms=au%2Crdu&mv=m&mvi=2&pl=24&initcwndbps=1781250&vprv=1&mime=audio%2Fwebm&ns=1rHc-oMWjh7KP6qhZrJlxbsG&gir=yes&clen=141216842&dur=7758.581&lmt=1636612379244087&mt=1647530243&fvip=2&keepalive=yes&fexp=24001373,24007246,24162928&c=WEB&txp=5531432&n=Etn899FH-pQyNQ&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRgIhAIEujoiu-e680uqh1q_6idQxny-Q7fq_Z0H6hww2xAbdAiEAsUHstywaW3iiBTfFbdmxf6U150PCuVvoxTouTkEjkTY%3D&sig=AOq0QJ8wRgIhAMTSUBwzezTF8ozT_2SF0t6fPIJYFlHRAdXRoCUiNZYrAiEAmrRRx0lnYu_7ja0Opqbah3VDh3TSVBpX-Nu1sLrfqhQ%3D&ir=1,&rr=12." test.mp4
Also, if I pause the execution of the bot at this.audioPlayer.play(this.audioResource);
for a few seconds before resuming execution, everything works fine.
This is a minimal, not working example:
import * as Discord from "discord.js"
import * as DisTube from "distube"
import { YtDlpPlugin } from "@distube/yt-dlp"
const client = new Discord.Client({intents: ["GUILDS", "GUILD_MESSAGES", "GUILD_VOICE_STATES"]})
const distube = new DisTube.DisTube(client, {youtubeDL: false, plugins: [new YtDlpPlugin()] })
client.login("TOKEN")
client.on("messageCreate", async message => {
try {
if (message.author.bot || !message.guild) return
let prefix = "!"
if (!message.content.startsWith(prefix)) return;
const args = message.content.slice(prefix.length).trim().split(/ +/g);
const command = args.shift();
if (command === "p") {
await distube.play(message.member.voice.channel, args.join(" "), {message: message})
message.react("✅")
return
}
} catch (error) {
console.error(error)
}
})
uname -a
:
Linux PC 5.15.25-1-MANJARO #1 SMP PREEMPT Wed Feb 23 14:44:03 UTC 2022 x86_64 GNU/Linux
node -v
:
v17.7.1
/usr/bin/ffmpeg
:
ffmpeg version n5.0 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 11.2.0 (GCC)
configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-shared --enable-version3
libavutil 57. 17.100 / 57. 17.100
libavcodec 59. 18.100 / 59. 18.100
libavformat 59. 16.100 / 59. 16.100
libavdevice 59. 4.100 / 59. 4.100
libavfilter 8. 24.100 / 8. 24.100
libswscale 6. 4.100 / 6. 4.100
libswresample 4. 3.100 / 4. 3.100
libpostproc 56. 3.100 / 56. 3.100
Sadly I cannot reproduce it on my PC and my DisTube Beta bot.
Maybe due to FFmpeg's pcm_s16le
codec cannot convert it directly to s16le
raw stream.
You can try using libopus
codec and @discordjs/voice
will convert it to s16le
for you. This makes one stream need 2 FFmpeg processes and ofc double the RAM and CPU usage.
To change to this, you have to edit your distube
folder in node_modules
StreamType.Raw
with StreamType.OggOpus
https://github.com/skick1234/DisTube/blob/a759440f26593105228c524c1d70202e517dbde5/src/core/DisTubeStream.ts#L87 "-f",
"opus",
"-acodec",
"libopus",
Thanks! If I modify the DisTubeStream class as you suggested, it works.
However, it's not that ffmpeg can't convert the stream. If I grab the URL from the DisTubeStream instance, ffmpeg manages to convert it to s16le just fine:
ffmpeg -reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5 -i "https://rr2---sn-i5h7lnll.googlevideo.com/videoplayback?expire=1647801153&ei=4R43YrnbBMeI6dsPsPS7mAQ&ip=77.23.112.149&id=o-ACxXpHMlrDPgQj6dXd2LAlHqEA12Cj-rlyUv4yL2_CME&itag=251&source=youtube&requiressl=yes&mh=ri&mm=31%2C29&mn=sn-i5h7lnll%2Csn-i5heen7s&ms=au%2Crdu&mv=m&mvi=2&pl=24&initcwndbps=1530000&vprv=1&mime=audio%2Fwebm&ns=bUeOhoPZgHn7k2hwtYXU4xQG&gir=yes&clen=141216842&dur=7758.581&lmt=1636612379244087&mt=1647779088&fvip=2&keepalive=yes&fexp=24001373%2C24007246&c=WEB&txp=5531432&n=odjSvkr_940Aaw&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRgIhALnD-2Mqy68fIWdCu7cIzK8tI_xTQQessGQ5cW8-l7wIAiEApxTqahR_74VA0yKiF4E1akKJyozCXa_G2AuposcBREU%3D&sig=AOq0QJ8wRAIgUUmO9L33ROoGGN0O7L59caxsUcnXLQFHcJOLihlD-BkCIBFbhoIYo0RvOQXkqouzdhXme35cKiTfXeaVRDlRNGyj" -analyzeduration 0 -ar 48000 -ac 2 -f s16le test
ffmpeg version n5.0 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 11.2.0 (GCC)
configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-shared --enable-version3
libavutil 57. 17.100 / 57. 17.100
libavcodec 59. 18.100 / 59. 18.100
libavformat 59. 16.100 / 59. 16.100
libavdevice 59. 4.100 / 59. 4.100
libavfilter 8. 24.100 / 8. 24.100
libswscale 6. 4.100 / 6. 4.100
libswresample 4. 3.100 / 4. 3.100
libpostproc 56. 3.100 / 56. 3.100
Input #0, matroska,webm, from 'https://rr2---sn-i5h7lnll.googlevideo.com/videoplayback?expire=1647801153&ei=4R43YrnbBMeI6dsPsPS7mAQ&ip=77.23.112.149&id=o-ACxXpHMlrDPgQj6dXd2LAlHqEA12Cj-rlyUv4yL2_CME&itag=251&source=youtube&requiressl=yes&mh=ri&mm=31%2C29&mn=sn-i5h7lnll%2Csn-i5heen7s&ms=au%2Crdu&mv=m&mvi=2&pl=24&initcwndbps=1530000&vprv=1&mime=audio%2Fwebm&ns=bUeOhoPZgHn7k2hwtYXU4xQG&gir=yes&clen=141216842&dur=7758.581&lmt=1636612379244087&mt=1647779088&fvip=2&keepalive=yes&fexp=24001373%2C24007246&c=WEB&txp=5531432&n=odjSvkr_940Aaw&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRgIhALnD-2Mqy68fIWdCu7cIzK8tI_xTQQessGQ5cW8-l7wIAiEApxTqahR_74VA0yKiF4E1akKJyozCXa_G2AuposcBREU%3D&sig=AOq0QJ8wRAIgUUmO9L33ROoGGN0O7L59caxsUcnXLQFHcJOLihlD-BkCIBFbhoIYo0RvOQXkqouzdhXme35cKiTfXeaVRDlRNGyj':
Metadata:
encoder : google/video-file
Duration: 02:09:18.58, start: -0.007000, bitrate: 145 kb/s
Stream #0:0(eng): Audio: opus, 48000 Hz, stereo, fltp (default)
Stream mapping:
Stream #0:0 -> #0:0 (opus (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, s16le, to 'test':
Metadata:
encoder : Lavf59.16.100
Stream #0:0(eng): Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s (default)
Metadata:
encoder : Lavc59.18.100 pcm_s16le
size= 7934kB time=00:00:42.32 bitrate=1535.7kbits/s speed=2.04x
video:0kB audio:7934kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
Exiting normally, received signal 2.
You don't use pipe
argument to stream it, this may be the problem
I tried that too:
ffmpeg -reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5 -i "https://rr2---sn-i5h7lnll.googlevideo.com/videoplayback?expire=1647889738&ei=6ng4Ysf5B8-T1gKZl67IBw&ip=77.23.112.149&id=o-AEFhIgbJNyuTdnKC2NX3lkd5wk_AWbN8Ha364X9jEEZk&itag=251&source=youtube&requiressl=yes&mh=ri&mm=31%2C29&mn=sn-i5h7lnll%2Csn-i5heen7s&ms=au%2Crdu&mv=m&mvi=2&pl=24&initcwndbps=1841250&vprv=1&mime=audio%2Fwebm&ns=hSExU27xkXElG8md7QW-3eoG&gir=yes&clen=141216842&dur=7758.581&lmt=1636612379244087&mt=1647867654&fvip=2&keepalive=yes&fexp=24001373%2C24007246&c=WEB&txp=5531432&n=INvOwqDPLDr7JQ&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRAIgBJ4dhrmdnurVl8MtngZzi8neCHa_jrFKEaxfWlJ-Bo0CIBYIOq4B1Kc1OTRBHulnDnXevTA1z3WRBQc_H11jd_cs&sig=AOq0QJ8wRgIhANc53_xi1WVakIZFpqUODf74kefyek6i-n6UeFtVW79DAiEA3h8cQLfxHG1GgRrUABSlAGLB5ZWI_4-nK6uI23vYYiE%3D" -analyzeduration 0 -ar 48000 -ac 2 -f s16le pipe:1 | dd of=./test
ffmpeg version n5.0 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 11.2.0 (GCC)
configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-shared --enable-version3
libavutil 57. 17.100 / 57. 17.100
libavcodec 59. 18.100 / 59. 18.100
libavformat 59. 16.100 / 59. 16.100
libavdevice 59. 4.100 / 59. 4.100
libavfilter 8. 24.100 / 8. 24.100
libswscale 6. 4.100 / 6. 4.100
libswresample 4. 3.100 / 4. 3.100
libpostproc 56. 3.100 / 56. 3.100
Input #0, matroska,webm, from 'https://rr2---sn-i5h7lnll.googlevideo.com/videoplayback?expire=1647889738&ei=6ng4Ysf5B8-T1gKZl67IBw&ip=77.23.112.149&id=o-AEFhIgbJNyuTdnKC2NX3lkd5wk_AWbN8Ha364X9jEEZk&itag=251&source=youtube&requiressl=yes&mh=ri&mm=31%2C29&mn=sn-i5h7lnll%2Csn-i5heen7s&ms=au%2Crdu&mv=m&mvi=2&pl=24&initcwndbps=1841250&vprv=1&mime=audio%2Fwebm&ns=hSExU27xkXElG8md7QW-3eoG&gir=yes&clen=141216842&dur=7758.581&lmt=1636612379244087&mt=1647867654&fvip=2&keepalive=yes&fexp=24001373%2C24007246&c=WEB&txp=5531432&n=INvOwqDPLDr7JQ&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRAIgBJ4dhrmdnurVl8MtngZzi8neCHa_jrFKEaxfWlJ-Bo0CIBYIOq4B1Kc1OTRBHulnDnXevTA1z3WRBQc_H11jd_cs&sig=AOq0QJ8wRgIhANc53_xi1WVakIZFpqUODf74kefyek6i-n6UeFtVW79DAiEA3h8cQLfxHG1GgRrUABSlAGLB5ZWI_4-nK6uI23vYYiE%3D':
Metadata:
encoder : google/video-file
Duration: 02:09:18.58, start: -0.007000, bitrate: 145 kb/s
Stream #0:0(eng): Audio: opus, 48000 Hz, stereo, fltp (default)
Stream mapping:
Stream #0:0 -> #0:0 (opus (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, s16le, to 'pipe:1':
Metadata:
encoder : Lavf59.16.100
Stream #0:0(eng): Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s (default)
Metadata:
encoder : Lavc59.18.100 pcm_s16le
5437+567 Datensätze ein:00:14.38 bitrate=1535.2kbits/s speed= 2x
5720+0 Datensätze aus
2928640 Bytes (2,9 MB, 2,8 MiB) kopiert, 7,67634 s, 382 kB/s
av_interleaved_write_frame(): Datenübergabe unterbrochen (broken pipe)
Error writing trailer of pipe:1: Datenübergabe unterbrochen (broken pipe)
size= 2860kB time=00:00:15.28 bitrate=1533.2kbits/s speed= 2x
video:0kB audio:2864kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Error closing file pipe:1: Datenübergabe unterbrochen (broken pipe)
Exiting normally, received signal 2.
I've downloaded the videos that aren't working to compare them with two that work, but I see no difference:
$ ffprobe /home/user/Desktop/failing.webm
ffprobe version n5.0 Copyright (c) 2007-2022 the FFmpeg developers
built with gcc 11.2.0 (GCC)
configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-shared --enable-version3
libavutil 57. 17.100 / 57. 17.100
libavcodec 59. 18.100 / 59. 18.100
libavformat 59. 16.100 / 59. 16.100
libavdevice 59. 4.100 / 59. 4.100
libavfilter 8. 24.100 / 8. 24.100
libswscale 6. 4.100 / 6. 4.100
libswresample 4. 3.100 / 4. 3.100
libpostproc 56. 3.100 / 56. 3.100
Input #0, matroska,webm, from '/home/user/Desktop/failing.webm':
Metadata:
encoder : google/video-file
Duration: 02:09:18.58, start: -0.007000, bitrate: 145 kb/s
Stream #0:0(eng): Audio: opus, 48000 Hz, stereo, fltp (default)
$ ffprobe /home/user/Desktop/failing_2.webm
...
Input #0, matroska,webm, from '/home/user/Desktop/failing_2.webm':
Metadata:
encoder : google/video-file
Duration: 02:04:47.16, start: -0.007000, bitrate: 142 kb/s
Stream #0:0(eng): Audio: opus, 48000 Hz, stereo, fltp (default)
$ ffprobe /home/user/Desktop/working_2.webm
...
Input #0, matroska,webm, from '/home/user/Desktop/working_2.webm':
Metadata:
encoder : google/video-file
Duration: 00:05:44.76, start: -0.007000, bitrate: 147 kb/s
Stream #0:0(eng): Audio: opus, 48000 Hz, stereo, fltp (default)
$ ffprobe /home/user/Desktop/working.webm
...
Input #0, matroska,webm, from '/home/user/Desktop/working.webm':
Metadata:
encoder : google/video-file
Duration: 02:04:42.80, start: -0.007000, bitrate: 142 kb/s
Stream #0:0(eng): Audio: opus, 48000 Hz, stereo, fltp (default)
If I upload the files to my own file server or OneDrive, I can play them.
Have you tried with node.js child process? Maybe due to your node.js cannot pipe to a readable stream. You can create it yourself or use other wrappers like fluent-ffmpeg
, prism-media
, ...
Both work:
import * as cp from "child_process"
let child = cp.spawn('ffmpeg -reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5 -i "https://rr2---sn-i5h7lned.googlevideo.com/videoplayback?expire=1648307691&ei=i9k-YruxIMiZ8gPfx5nQDw&ip=77.23.112.149&id=o-AFACPFbF7oE7t--KfVHJ0dYZYf5YM5kSQlzThnaqTwCh&itag=251&source=youtube&requiressl=yes&mh=He&mm=31%2C26&mn=sn-i5h7lned%2Csn-4g5e6nsy&ms=au%2Conr&mv=m&mvi=2&pl=24&initcwndbps=1861250&spc=4ocVC1HOPJtKdc32dG7ys9Y_ocZgwwi2VbHHzSpRYg&vprv=1&mime=audio%2Fwebm&ns=NV0fgBua9hgQufkzi2Mmu74G&gir=yes&clen=135013770&dur=7327.321&lmt=1644399887706667&mt=1648285728&fvip=2&keepalive=yes&fexp=24001373%2C24007246&c=WEB&txp=4532434&n=65_SPfrnEHOKiQ&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cspc%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIhALqhlOtYROlSNv7LWZQFQdcYz94hp2Ar8y1PTR_sokmWAiBwTSHGUUM5R62N_assbqGUvjBjYnXToo1NH3aNkG-jjA%3D%3D&sig=AOq0QJ8wRAIgCsCR27Cm-wuJHUlTmEgM1gLFsD91T0WntX7merMu2bsCIGKqblXwkreMJlbE3rrDC2qtjFCZ8LPS_dJOTcFAQoQ_" -analyzeduration 0 -ar 48000 -ac 2 -f s16le pipe:1 | dd of=./test', {shell: true});
child.stdout.on('data', (data) => {
console.log(`child stdout:\n${data}`);
});
child.stderr.on('data', (data) => {
console.error(`child stderr:\n${data}`);
});
child.on('exit', function (code, signal) {
console.log('child process exited with ' + `code ${code} and signal ${signal}`);
});
setTimeout(function() {
process.exit(0)
}, 5000)
import * as ffmpeg from "fluent-ffmpeg"
import * as fs from "fs"
var stream = fs.createWriteStream('test')
ffmpeg("https://rr2---sn-i5h7lned.googlevideo.com/videoplayback?expire=1648307691&ei=i9k-YruxIMiZ8gPfx5nQDw&ip=77.23.112.149&id=o-AFACPFbF7oE7t--KfVHJ0dYZYf5YM5kSQlzThnaqTwCh&itag=251&source=youtube&requiressl=yes&mh=He&mm=31%2C26&mn=sn-i5h7lned%2Csn-4g5e6nsy&ms=au%2Conr&mv=m&mvi=2&pl=24&initcwndbps=1861250&spc=4ocVC1HOPJtKdc32dG7ys9Y_ocZgwwi2VbHHzSpRYg&vprv=1&mime=audio%2Fwebm&ns=NV0fgBua9hgQufkzi2Mmu74G&gir=yes&clen=135013770&dur=7327.321&lmt=1644399887706667&mt=1648285728&fvip=2&keepalive=yes&fexp=24001373%2C24007246&c=WEB&txp=4532434&n=65_SPfrnEHOKiQ&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cspc%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIhALqhlOtYROlSNv7LWZQFQdcYz94hp2Ar8y1PTR_sokmWAiBwTSHGUUM5R62N_assbqGUvjBjYnXToo1NH3aNkG-jjA%3D%3D&sig=AOq0QJ8wRAIgCsCR27Cm-wuJHUlTmEgM1gLFsD91T0WntX7merMu2bsCIGKqblXwkreMJlbE3rrDC2qtjFCZ8LPS_dJOTcFAQoQ_")
.addInputOptions(["-reconnect 1", "-reconnect_streamed 1", "-reconnect_delay_max 5"])
.addOutputOptions(["-analyzeduration 0", "-ar 48000", "-ac 2", "-f s16le"])
.on('end', function() {
console.log('file has been converted succesfully');
})
.on('error', function(err) {
console.log('an error happened: ' + err.message);
})
.pipe(stream, {end:true})
Weird, idk why. It is normal on my pc/vps and I cannot reproduce it .-.
I created a simple test bot with a docker image: discordbottest.zip
The exact command that is failing is: !p https://www.youtube.com/watch?v=yv2-8z_p5kw
I can confirm that the two songs are not working. tried the cookies before but still did not work!
OS: windows 11/Debian 11
Fixed on v4
I am unable to play certain videos, while similar videos work just fine. For example:
Don't work: https://www.youtube.com/watch?v=PdeoyBb8vhM https://www.youtube.com/watch?v=TWTV4T3yxzs
Work: https://www.youtube.com/watch?v=_ov7wfQnGM4
Right after the video has been added to the queue, the
finish
event is emitted. The event is emitted in the DisTubeVoice contructor:Relevant code:
Further information: