GithubHelp home page GithubHelp logo

hua0512 / stream-rec Goto Github PK

View Code? Open in Web Editor NEW
11.0 1.0 2.0 2.7 MB

Automatic streaming record tool using Kotlin coroutines, flow, serialization, sqldelight, and ktor. 虎牙/抖音//斗鱼/Twitch直播,弹幕自动录制

License: MIT License

Kotlin 99.85% Dockerfile 0.15%
douyin huya streaming-recorder downloader douyu twitch

stream-rec's Introduction

English | 简体中文

Stream-rec

Stream-rec is an automatic stream recording tool for various streaming services.

It's powered by Kotlin, Ktor, and ffmpeg.

This project is the result of my personal need for a tool that can automatically record live streams and upload them to cloud storage.

Note

This project is the result of my personal learning of Kotlin Coroutines, flow, Ktor, dao, repository pattern and other technologies.

Features

  • Automatic stream recording, with configurable quality and format.
  • Automatic file naming based on the stream title and start time.
  • Automatic Danmu(Bullet comments) recording
  • Persistent storage of stream and upload information (using SQLite)
  • Integration with Rclone for uploading to cloud storage
  • Configurable via web interface.
  • Docker support

Supported streaming services

Service Recording Danmu
Huya
Douyin
Douyu
Bilibili
Twitch
Youtube
Niconico
AfreecaTv
  • As for now, only Huya, Douyin, Douyu are supported. (Because I only use these three services 😄).
  • More services will be supported in the future (if I have time, PRs are welcomed).

Screenshots

login.png dashboard.png streamers.png

Installation

1. Docker Compose (Recommended)

1.1 Configuring the docker-compose.yml file

Create a docker-compose.yml, take a look at the example configuration file.

Please read the comments in the configuration file for more information and make sure to modify crucial parts like passwords, paths, etc.

1.2 Running the Docker compose

Make sure you are in the same directory as the docker-compose.yml file, then run the following command:

docker compose up -d && docker compose logs -f

Now, you are all set! You can access the web interface at http://localhost:15275 and start configuring the tool ( see Configuration).

Note

You can detach from the logs by pressing Ctrl + C. And you can reattach to the logs by running docker compose logs -f. To stop the containers, run docker compose down.

2. Building from source

2.1 Prerequisites

  • Internet access, obviously 😂
  • Git (optional, for cloning the repository)
  • A java development kit (JDK) (version 17 or later), Amazon Corretto 17 is recommended.
  • FFmpeg (Make sure it's in your PATH).
  • Streamlink (optional, for recording streams, make sure it's in your PATH)
  • Rclone (optional, for uploading to cloud storage, make sure it's in your PATH)
  • Sqlite3 (for storing stream, upload information, make sure it's in your PATH)

2.2 Building the backend

To build the project, first clone the repository and navigate to the root directory of the project.

git clone https://github.com/hua0512/stream-rec.git
cd stream-rec

Then, build the project using the following command:

./gradlew stream-rec:build -x test

The built fat jar file stream-rec.jar will be located in the stream-rec/build/libs directory.

2.2.1 Running the jar file

To run the jar file, use the following command:

java -jar stream-rec/build/libs/stream-rec.jar

Several environment variables can be set to configure the tool:

  • DB_PATH: Path to the SQLite database folder. (default: ./db)
  • JWT_SECRET: Secret key for JWT token generation.
  • LOG_LEVEL: Log level (default: info).
  • LOGIN_SECRET: Login password for the web interface (default: stream-rec).

For example:

java -DDB_PATH=/path/to/your/db -DLOG_LEVEL=DEBUG -DJWT_SECRET=SECRET -DLOGIN_SECRET=123 -jar stream-rec/build/libs/stream-rec.jar

[!IMPORTANT]\

  • Please set the LOGIN_SECRET environment variable to a secure password. This password is used to log in to the web interface.
  • This password cannot be changed after the first run.

2.3 Building the frontend

Frontend is used to configure the tool, it's a simple web interface built with React.

Navigate to frontend repository and follow the build instructions.

After that, you can start configuring the tool by accessing the web interface at http://localhost:15275. Take a look at the Configuration page for more information.

Troubleshooting

Check logs under logs directory, by default, it will be created in the same directory as the DB_PATH.

  • There´s a environment variable LOG_LEVEL that can be set to debug to enable debug logs.

Contributing

Contributions are welcome! If you have any ideas, suggestions, or bug reports, please feel free to open an issue or a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

stream-rec's People

Contributors

dependabot[bot] avatar hua0512 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

stream-rec's Issues

docker 版的一些问题

  • 时区不是**时区
  • docker-compose.yml 文件没有映射 rclone 的配置目录,每次使用docker-compose up -d启动时 rclone 配置都会丢失

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.