Python-Scripts icon indicating copy to clipboard operation
Python-Scripts copied to clipboard

Add script to shift subtitles forward or backward

Open Syed-56 opened this issue 10 months ago • 3 comments

The repository currently lacks a script to shift subtitle timings forward or backward, which is needed when subtitles are out of sync with the video.

A simple Python script or function could be added to shift subtitle timestamps by a specified offset (positive or negative), preferably supporting .srt files via command-line arguments.

At the moment, this can be done using external tools like Subtitle Edit or ffmpeg, but having this functionality in the repo would keep workflows consistent and easier to automate.

This would be especially useful for handling audio/video delays or re-encoded media files.

Syed-56 avatar Jan 14 '26 20:01 Syed-56

Thank you for raising this issue! Our team will review it soon.

For more queries or discussions or approval of requests, please join the Discord server for further discussion: Discord Link

github-actions[bot] avatar Jan 14 '26 20:01 github-actions[bot]

Hi, I’d like to work on this issue. Could you assign it to me?

Kulkarnivaishnavi473 avatar Feb 10 '26 13:02 Kulkarnivaishnavi473

Hi 👋

This looks like a useful addition to the repo. I’ve worked with SRT files before and understand the timestamp format and edge cases (negative offsets, zero clamping, etc.).

I’m planning to:

  • Add a small Python CLI script to shift SRT timestamps
  • Support positive/negative offsets via command-line arguments
  • Ensure timestamps don’t go below 00:00:00,000
  • Keep it dependency-free if possible

Before starting, I wanted to confirm:

  • Is there a preferred location in the repo for utility scripts?
  • Should the script overwrite the file or write to a new output file?

If this approach works, I’d be happy to take this up. Thanks!

anosvoldi883 avatar Feb 10 '26 17:02 anosvoldi883