lachhabw / Live-Video-Transcription-and-Translation

Python-based tool for real-time transcription and translation of live video streams.
https://www.youtube.com/@WalidLachhab
2 stars 1 forks source link

m3u8 #1

Open odehalaa opened 3 weeks ago

odehalaa commented 3 weeks ago

Hi,

Thank you so much for your amazing solution! I have a quick question: Is it possible to generate an M3U8 stream that includes soft-coded subtitles from caption.srt, with the subtitles automatically refreshing? I would like to ensure that it’s compatible with any player.

Looking forward to your advice.

Best regards,

lachhabw commented 3 weeks ago

Hi,

Thank you for your kind words about the tool! I’m glad you found it helpful.

Regarding your question about generating an M3U8 stream with soft-coded subtitles and ensuring they refresh automatically: This indeed falls into the realm of HLS (HTTP Live Streaming).

My tool operates in a modular way with three main independent components:

  1. Downloading the Live Stream: Using Streamlink to get the video (any other way to get the video should work, like using obs and fragmented mp4 for instance).
  2. Transcribing and Translating: Converting speech to text and generating subtitles.
  3. Playing the Video with Updated Captions: Using a player that supports live subtitle updates.

For your use case:

With continuously growing files, you essentially have two components:

  1. The M3U8 video stream.
  2. The captions.srt file.

To combine these into a playable video with live subtitles, you would generally need a mechanism to mux or integrate the subtitles into the stream. Since both files are continuously growing, you might need to set up a script or tool to handle this dynamically.

Although I don't have extensive knowledge about HLS specifics, a common approach is to periodically check for updates to the subtitle file and refresh the video player. You could implement something similar to how my tool manages updates: a script that monitors changes and updates the player or reloads the subtitles as needed.

If you're familiar with HLS or have specific tools for handling live streams, they might offer built-in features for managing dynamic subtitles. Otherwise, a custom script to integrate and refresh the subtitles periodically could be a good solution.

Best regards,

odehalaa commented 3 weeks ago

Thank you for your reply. Could you please let me know if there are any package updates available to enhance stability and incorporate the latest modules?