Skip to content

Subtitle downloads are very slow when MPD has many segments #71

@SleepInfinity

Description

@SleepInfinity

When subtitles are split into many segments in the MPD, the download process becomes very slow.

In my case the subtitles are split into ~450 segments per language, and downloading them with vsd takes around 30 seconds for a single subtitle file.

I haven't looked deeply into the code, but it seems like the segment downloads might be happening sequentially. I tested downloading the same subtitles with a small Python script where I request all segment URLs asynchronously in parallel, keep track of their order, and then reconstruct the file afterward. With that approach the same subtitle file downloads in about 1 second.

It might be worth downloading subtitle segments concurrently instead of sequentially to improve performance when the MPD contains a large number of segments.

Steps to reproduce (general idea):

  • Use an MPD where subtitle tracks are split into hundreds of segments (~400–500).
  • Download subtitles with vsd.
  • Observe that the process takes tens of seconds.

Expected behavior: Subtitle segments should ideally be downloaded concurrently to avoid large delays when there are many segments.

Actual behavior: Subtitles appear to be downloaded sequentially, resulting in slow downloads.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions