{"id":24836361,"url":"https://github.com/Discord-RE/Discord-video-stream","last_synced_at":"2025-10-14T10:30:52.311Z","repository":{"id":107436864,"uuid":"602348197","full_name":"Discord-RE/Discord-video-stream","owner":"Discord-RE","description":"Experiment for making video streaming work for discord selfbots.","archived":false,"fork":true,"pushed_at":"2025-09-19T05:54:56.000Z","size":487,"stargazers_count":254,"open_issues_count":37,"forks_count":54,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-09-29T13:35:46.911Z","etag":null,"topics":["bot","discord","discord-js","self-bot","stream","video"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"aiko-chan-ai/Discord-video-experiment","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Discord-RE.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-02-16T02:32:56.000Z","updated_at":"2025-09-20T16:54:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"c055160a-6942-45a7-87cf-84854544b932","html_url":"https://github.com/Discord-RE/Discord-video-stream","commit_stats":null,"previous_names":["discord-re/discord-video-stream"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/Discord-RE/Discord-video-stream","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Discord-RE%2FDiscord-video-stream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Discord-RE%2FDiscord-video-stream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Discord-RE%2FDiscord-video-stream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Discord-RE%2FDiscord-video-stream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Discord-RE","download_url":"https://codeload.github.com/Discord-RE/Discord-video-stream/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Discord-RE%2FDiscord-video-stream/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279018780,"owners_count":26086452,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bot","discord","discord-js","self-bot","stream","video"],"created_at":"2025-01-31T05:01:22.511Z","updated_at":"2025-10-14T10:30:52.305Z","avatar_url":"https://github.com/Discord-RE.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# Discord self-bot video\n\nFork: [Discord-video-experiment](https://github.com/mrjvs/Discord-video-experiment)\n\n\u003e [!CAUTION]\n\u003e Using any kind of automation programs on your account can result in your account getting permanently banned by Discord. Use at your own risk\n\nThis project implements the custom Discord UDP protocol for sending media. Since Discord is likely change their custom protocol, this library is subject to break at any point. An effort will be made to keep this library up to date with the latest Discord protocol, but it is not guranteed.\n\nFor better stability it is recommended to use WebRTC protocol instead since Discord is forced to adhere to spec, which means that the non-signaling portion of the code is guaranteed to work.\n\n## Features\n\n- Playing video \u0026 audio in a voice channel (`Go Live`, or webcam video)\n\n## Implementation\n\nWhat I implemented and what I did not.\n\n### Video codecs\n\n- [X] VP8\n- [ ] VP9\n- [X] H.264\n- [X] H.265\n- [ ] AV1\n\n### Packet types\n\n- [X] RTP (sending of realtime data)\n- [ ] RTX (retransmission)\n\n### Connection types\n\n- [X] Regular Voice Connection\n- [X] Go live\n\n### Encryption\n\n- [X] Transport Encryption\n- [ ] [End-to-end Encryption](https://github.com/dank074/Discord-video-stream/issues/102)\n\n### Extras\n\n- [X] Figure out rtp header extensions (discord specific) (discord seems to use one-byte RTP header extension https://www.rfc-editor.org/rfc/rfc8285.html#section-4.2)\n\nExtensions supported by Discord (taken from the webrtc sdp exchange)\n\n```\n\"a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\"\n\"a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\"\n\"a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\"\n\"a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid\"\n\"a=extmap:5 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay\"\n\"a=extmap:6 http://www.webrtc.org/experiments/rtp-hdrext/video-content-type\"\n\"a=extmap:7 http://www.webrtc.org/experiments/rtp-hdrext/video-timing\"\n\"a=extmap:8 http://www.webrtc.org/experiments/rtp-hdrext/color-space\"\n\"a=extmap:10 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id\"\n\"a=extmap:11 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id\"\n\"a=extmap:13 urn:3gpp:video-orientation\"\n\"a=extmap:14 urn:ietf:params:rtp-hdrext:toffset\"\n```\n\n## Requirements\n\nFor full functionality, this library requires an FFmpeg build with `libzmq` enabled. Here is our recommendation:\n- Windows \u0026 Linux: [BtbN's FFmpeg Builds](https://github.com/BtbN/FFmpeg-Builds)\n- macOS (Intel): [evermeet.cx](https://evermeet.cx/ffmpeg/)\n- macOS (Apple Silicon): Install from Homebrew\n\n## Usage\n\nInstall the package, alongside its peer-dependency discord.js-selfbot-v13:\n\n```\nnpm install @dank074/discord-video-stream@latest\nnpm install discord.js-selfbot-v13@latest\n```\n\nCreate a new Streamer, and pass it a selfbot Client\n\n```typescript\nimport { Client } from \"discord.js-selfbot-v13\";\nimport { Streamer } from '@dank074/discord-video-stream';\n\nconst streamer = new Streamer(new Client());\nawait streamer.client.login('TOKEN HERE');\n\n```\n\nMake client join a voice channel\n\n```typescript\nawait streamer.joinVoice(\"GUILD ID HERE\", \"CHANNEL ID HERE\");\n```\n\nStart sending media\n\n```typescript\nimport { prepareStream, playStream, Utils } from \"@dank074/discord-video-stream\"\ntry {\n    const { command, output } = prepareStream(\"DIRECT VIDEO URL OR READABLE STREAM HERE\", {\n        // Specify either width or height for aspect ratio aware scaling\n        // Specify both for stretched output\n        height: 1080,\n\n        // Force frame rate, or leave blank to use source frame rate\n        frameRate: 30,\n        bitrateVideo: 5000,\n        bitrateVideoMax: 7500,\n        videoCodec: Utils.normalizeVideoCodec(\"H264\" /* or H265, VP9 */),\n        h26xPreset: \"veryfast\" // or superfast, ultrafast, ...\n    });\n    command.on(\"error\", (err, stdout, stderr) =\u003e {\n        // Handle ffmpeg errors here\n    });\n\n    await playStream(output, streamer, {\n        type: \"go-live\" // use \"camera\" for camera stream\n    });\n\n    console.log(\"Finished playing video\");\n} catch (e) {\n    console.log(e);\n}\n```\n\n## Encoder options available\n\n```typescript\n/**\n * Disable transcoding of the video stream. If specified, all video related\n * options have no effects\n * \n * Only use this if your video stream is Discord streaming friendly, otherwise\n * you'll get a glitchy output\n */\nnoTranscoding?: boolean;\n/**\n * Video output width\n */\nwidth?: number;\n/**\n * Video output height\n */\nheight?: number;\n/**\n * Video output frames per second\n */\nfps?: number;\n/**\n * Video average bitrate in kbps\n */\nbitrateVideo?: number;\n/**\n * Video max bitrate in kbps\n */\nbitrateVideoMax?: number;\n/**\n * Audio bitrate in kbps\n */\nbitrateAudio?: number;\n/**\n * Enable audio output\n */\nincludeAudio?: boolean;\n/**\n * Enables hardware accelerated video decoding. Enabling this option might result in an exception\n * being thrown by Ffmpeg process if your system does not support hardware acceleration\n */\nhardwareAcceleratedDecoding?: boolean;\n/**\n * Output video codec. **Only** supports H264, H265, and VP8 currently\n */\nvideoCodec?: SupportedVideoCodec;\n/**\n * Encoding preset for H264 or H265. The faster it is, the lower the quality\n */\nh26xPreset?: 'ultrafast' | 'superfast' | 'veryfast' | 'faster' | 'fast' | 'medium' | 'slow' | 'slower' | 'veryslow';\n/**\n * Adds ffmpeg params to minimize latency and start outputting video as fast as possible.\n * Might create lag in video output in some rare cases\n */\nminimizeLatency?: boolean;\n/**\n * Custom headers for HTTP requests\n */\ncustomHeaders?: Record\u003cstring, string\u003e;\n/**\n * Custom ffmpeg flags/options to pass directly to ffmpeg\n * These will be added to the command after other options\n */\ncustomFfmpegFlags?: string[];\n```\n\n## `playStream` options available\n\n```typescript\n/**\n * Set stream type as \"Go Live\" or camera stream\n */\ntype?: \"go-live\" | \"camera\",\n\n/**\n * Override video width sent to Discord.\n * \n * DO NOT SPECIFY UNLESS YOU KNOW WHAT YOU'RE DOING!\n */\nwidth?: number,\n\n/**\n * Override video height sent to Discord.\n * \n * DO NOT SPECIFY UNLESS YOU KNOW WHAT YOU'RE DOING!\n */\nheight?: number,\n\n/**\n * Override video frame rate sent to Discord.\n * \n * DO NOT SPECIFY UNLESS YOU KNOW WHAT YOU'RE DOING!\n */\nframeRate?: number,\n\n/**\n * Same as ffmpeg's `readrate_initial_burst` command line flag\n * \n * See https://ffmpeg.org/ffmpeg.html#:~:text=%2Dreadrate_initial_burst\n */\nreadrateInitialBurst?: number,\n```\n\n## Streamer options available\n\nThese control internal operations of the library, and can be changed through the `opts` property on the `Streamer` class. You probably shouldn't change it without a good reason\n\n```typescript\n/**\n * Enables sending RTCP sender reports. Helps the receiver synchronize the\n * audio/video frames, except in some weird cases which is why you can disable it\n */\nrtcpSenderReportEnabled?: boolean;\n/**\n * ChaCha20-Poly1305 Encryption is faster than AES-256-GCM, except when using AES-NI\n */\nforceChacha20Encryption?: boolean;\n```\n\n## Performance tips\n\nSee [this page](./PERFORMANCE.md) for some tips on improving performance\n\n## Running example\n\n`examples/basic/src/config.json`:\n\n```json\n\"token\": \"SELF TOKEN HERE\",\n\"acceptedAuthors\": [\"USER_ID_HERE\"],\n```\n\n1. Configure your `config.json` with your accepted authors ids, and your self token\n2. Generate js files with ```npm run build```\n3. Start program with: ```npm run start```\n4. Join a voice channel\n5. Start streaming with commands:\n\nfor go-live\n\n```\n$play-live \u003cDirect video link\u003e\n```\n\nor for cam\n\n```\n$play-cam \u003cDirect video link\u003e\n```\n\nfor example:\n\n```\n$play-live http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4\n```\n\n## FAQS\n\n- Can I stream on existing voice connection (CAM) and in a go-live connection simultaneously?\n\nYes, just send the media packets over both udp connections. The voice gateway expects you to signal when a user turns on their camera, so make sure you signal using `client.signalVideo(guildId, channelId, true)` before you start sending cam media packets.\n\n- Does this library work with bot tokens?\n\nNo, Discord blocks video from bots which is why this library uses a selfbot library as peer dependency. You must use a user token\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDiscord-RE%2FDiscord-video-stream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDiscord-RE%2FDiscord-video-stream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDiscord-RE%2FDiscord-video-stream/lists"}