node-twitch-stream is a Node.js application that allows you to stream a video file to Twitch using
the Twitch API and FFmpeg.
Before running the application, make sure you have the following prerequisites installed:
- Node.js (version 18.16 or higher) (run
nvm useif you use NVM or similar tools) - FFmpeg (installed and accessible via the command line)
- Twitch account with stream key
- Clone the repository:
git clone https://github.com/failfa-st/node-twitch-stream.git- Navigate to the project directory:
cd node-twitch-stream- Install the dependencies:
npm install- Create a
.envfile in the project root directory and add the following environment variables:
TWITCH_CLIENT_ID=your-twitch-client-id
TWITCH_CLIENT_SECRET=your-twitch-client-secret
TWITCH_STREAM_KEY=your-twitch-stream-key
💡 You can copy the
.env.exampleto.env
Replace your-twitch-client-id, your-twitch-client-secret, and your-twitch-stream-key with your
actual Twitch credentials.
- Add a file
demo.mp4to the project:path/to/node-twitch-stream/demo.mp4
To start the streaming process, run the following command:
npm startThe application will authenticate with the Twitch API using the provided client credentials,
retrieve an access token, and initiate the streaming of the video file demo.mp4 to Twitch.
You can customize the video file to be streamed by replacing demo.mp4 in the startStreaming
function of index.js with the path to your desired video file.
Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.