Skip to main content

A service to automatically record livestreams from various platforms, backed by yt-dlp

Project description

yt-dvr

A service to automatically record livestreams from various platforms, backed by yt-dlp.

Channels are automatically pinged at a specified frequency, and recorded if they are live. Recordings are handled by yt-dlp, supporting hundreds of platforms, with specific support for certain platform features (e.g. chat).

A small web interface is served via Quart, for basic video playback and service configuration. An external media server is recommended if media organization is important - the interface is only meant for limited usage and is not optimized for multiple users, sorting, etc.

Install

Built executables can be found under Releases on the right.

Requires Python (any recent version will do, no idea how old). You will also need a working copy of FFmpeg installed. Deno is required if recording YouTube streams.

Install requirements from requirements.txt: pip install -r requirements.txt.

Configuration

yt-dvr is configured with a JSON file at $YTDVR_CONFIG (default ytdvr_config.json). The config file contains the following keys:

  • saveDir: The directory to store recordings in.
  • serverPort: The port to host the internal server on.
  • defaultRetention: An object containing keys indicating the maximum amounts to keep of a certain channel by default. Files will be deleted when any of the retention counts are hit, starting with the oldest. Null values mean the category is ignored/infinity - if all are null, files will never be deleted.
    • count: The maximum number of recordings to keep.
    • time: The maximum age of a recording, in days.
    • size: The maximum cumulative file size, in megabytes.
  • globalRetention: Similar to defaultRetention, but applies to all videos altogether.
  • pollInterval: The number of seconds to wait between live checks.
  • remuxRecordings: Whether to remux recordings after finishing. (Recordings are saved as MPEG-TS for streaming.)
  • remuxFormat: If remuxing is enabled, the (FFmpeg) format to remux to.
  • logLevel: The logging level as defined by Python logging (string)
  • ffmpegPath: The path to an FFmpeg binary to use, or null to find one on the system.
  • channels: An object containing channel names and options to record, with the following channel options (optional unless otherwise specified):
    • url: The URL to record (required)
      • For YouTube channels, this should be in the format https://www.youtube.com/@<channel>/live
    • getChat: Whether to download chat automatically (only supported on some platforms) (required, default false)
    • platform: An override for platform support (TODO: is this necessary?)
    • quality: The yt-dlp quality format to record at (default bestaudio+bestvideo)
    • retention: An alternate retention configuration for this channel only - if set it overrides the defaults completely
    • ytdlParams: An object containing parameters to pass to yt-dlp, in API format (see https://github.com/yt-dlp/yt-dlp/blob/master/devscripts/cli_to_api.py)
      • In the web interface, this may also be regular flags which will be converted to API format on submit

These settings can be configured through the web interface.

The video database is stored in a SQLite database stored at $YTDVR_DB, default ytdvr.db.

Running

Run python -m yt_dvr.__init__.

The web interface is hosted at http://localhost:6334 by default. The URL will be printed to the console.

A Dockerfile is also provided for use in a Docker container.

PyInstaller packaging

Install yt-dlp[default] for EJS support. Download FFmpeg (static) and Deno to build.

pyinstaller src/yt_dvr/__init__.py -F --add-data templates:templates --collect-submodules yt_dvr --add-binary build\ffmpeg.exe:. --add-binary build\deno.exe:. --collect-all curl_cffi

License

yt-dvr is licensed under the GNU Affero General Public License v3.0. You are allowed to host, modify and redistribute this code at will, as long as source code is always provided, including by public server hosts.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yt_dvr-0.2.1.tar.gz (27.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yt_dvr-0.2.1-py3-none-any.whl (28.5 kB view details)

Uploaded Python 3

File details

Details for the file yt_dvr-0.2.1.tar.gz.

File metadata

  • Download URL: yt_dvr-0.2.1.tar.gz
  • Upload date:
  • Size: 27.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for yt_dvr-0.2.1.tar.gz
Algorithm Hash digest
SHA256 10c466f2e0c95f8621de65f6e1a2735f5499130b50935b8200d1de3ec878d5c9
MD5 604dbb7609414fdbd5907d96ae72bea6
BLAKE2b-256 0aa23344e188ac4a03a164be75656c1f90d49ca91c45e87841e5341cbb00fce7

See more details on using hashes here.

Provenance

The following attestation bundles were made for yt_dvr-0.2.1.tar.gz:

Publisher: python-publish.yml on MCJack123/yt-dvr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file yt_dvr-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: yt_dvr-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 28.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for yt_dvr-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 219647e1ae5becc35a6bd7398023f26cbafcf905ddd119d22d87c216ed806e84
MD5 e9ecebe4c08d952d9b03dcc94fdd52d8
BLAKE2b-256 ab0b960428062474cdab97bc5c9e5b0251bebd9d340825b9423dd5d55ae851b5

See more details on using hashes here.

Provenance

The following attestation bundles were made for yt_dvr-0.2.1-py3-none-any.whl:

Publisher: python-publish.yml on MCJack123/yt-dvr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page