Skip to content

[FEATURE] Add optional combined MKV torrent/magnet output for multi-version releases #29

@Zzackllack

Description

@Zzackllack

Description

Currently AniBridge delivers separate torrent/magnet links for each available version (language, subtitles, etc.) of a video/series/anime based on what providers like s.to and aniworld.to offer.

As a new feature, we could optionally combine all available versions into a single MKV and provide one consolidated torrent/magnet link instead of multiple MP4 links. This would reduce clutter for users and allow them to get all audio/subtitle tracks in one file (with a custom torrent name as appropriate).

This behavior should be toggleable via a new environment variable.

Motivation

  • Multiple versions (e.g., different subtitle tracks) currently result in separate torrent/magnet links, this can be messy.
  • Providing a single, enhanced MKV with all tracks included would streamline the experience while preserving all metadata.
  • We already support yt-dlp and the underlying downloads; muxing and packaging could be integrated with existing pipelines.

Proposed Implementation

New Feature Flag

  • Add an ENV VAR such as COMBINE_VERSIONS_IN_MKV (bool) to enable/disable combined output.

Muxing Logic

  • After gathering all versions for a release, generate a combined MKV file that includes:

    • All audio/subtitle tracks
    • Appropriate metadata and naming
  • Replace the multiple magnet/torrent links with a single link pointing to the combined MKV.

Dependencies/Tools

  • We’d need to support muxing likely FFmpeg or a similar muxer (e.g., mkvmerge via mkvtoolnix) as part of the pipeline for combining tracks into MKV containers. FFmpeg can remux without re-encoding, making this efficient. Arch Linux Foren

Integration

  • Integrate muxing steps after download but before generating the torrent/magnet.
  • Fallback to existing behavior if the flag is disabled or muxing fails.

Example Reference

There’s already a project that aims to tackle combining versions into a single container for AniWorld Downloads, AniWorld-Downloader_Mux-Tool (linked below). We might be able to adapt some ideas or workflows from it:

Technical Considerations

  • Compute overhead: Muxing may require additional CPU, so we should make this optional and document performance implications.
  • Error handling: Ensure fallbacks if muxing fails or toolchains are missing.
  • Torrent naming: Decide a consistent naming scheme for combined torrents (e.g., include all languages/subs in name).

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions