Movie Subtitle Merging Task

Always looking for little projects that ChatGPT would be good at. This seems like a pretty ideal task for ChatGPT. But ChatGPT 4 & 40 really fails here.

Merge two subtitle files (one in English and one in Vietnamese) into a single subtitle file where each entry contains an English line followed by the corresponding Vietnamese line. These are standard .srt files and follow the srt (subtitle) file format.

I feel like my prompts are clear enough. But maybe I’m just prompting terribly or maybe I don’t have a good sense for good use cases for ChatGPT. What do you think? Should ChatGPT be able to handle this task?

I tried many iterations of this prompt and they all fail terribly.
Here’s an example prompt:


Objective: Merge two subtitle files (one in English and one in Vietnamese) into a single subtitle file where each entry contains an English line followed by the corresponding Vietnamese line. These are standard .srt files and follow the srt (subtitle) file format.
Master Time Codes:

  • It’s likely that the times in the VN file do not match the EN file. Finding the time shift between the files will be useful for matching entry translations.
  • Use the English subtitle file as the master for all time codes.
  • Time codes look like this: 01:06:17,289 --> 01:06:19,757 which is: `start showing subtitle at hh:mm:ss,ms → end showing subtitle at hh:mm:ss,ms’
    Simplifications
  • Strip the Vietnamese file of all HTML formatting.

If there is any place where you would want clarification, ask me before processing.

  1. Load and Parse the Subtitle Files:
    • Parse the contents of both subtitle files to extract time codes and text. This is a suggestion for your organization. I don’t need the code or a dataframe. I only need the merged .srt output file.
  2. Translate Vietnamese Entries to English:
    • Translate Vietnamese subtitles into English for comparison.
  3. Calculate Time Shift:
    • Compare the translated Vietnamese text with the English text to find several initial matches based on content similarity.
    • A consistent pattern should emerge. Use these matches to determine the the time stamp discrepancy between files. I’m calling this time shift.
    • These are are coded by humans so they will not be perfectly consistent, but should be close (likely within a second).
  4. Merge Subtitles Based on Time Shift:
    • Use the calculated time shift to match and merge the English and Vietnamese subtitles.
    • Ensure the closest language match rather than exact time codes.
    • If the meaning of combined entries don’t match, you may need to recalculate the time shift from this point forward.
    • Check every entry to make sure the combined translations are corrolated.
  5. Handle Unmatched English Entries:
    • If an English entry clearly doesn’t have a Vietnamese equivalent, keep the entry and move on. The Vietnamese translator may missed transcribing a phrase.
  6. Handle Unmatched Vietnamese Entries:
    • Use linear interpolation to estimate the best time position in the merged file based on matched adjacent entries.
    • Since there’s no English entry that matches, include the English translation gathered for this entry from the initial parsing step. It won’t be as good as the human generated translations but it’s better than nothing.
      Quality Control:
  • Verify translations of each matched entry in the merged file based on the garnered meaning.
    srt format
    • Once all the entries have been merged, make sure the file matches srt format standards.
    • Each entry number of the output should be numerically iterative starting from 1.
    • Text formatting should not be imported from the VN file. If there is text formatting in any English entries, match that formatting on the Vietnamese entry.
      Output the Merged Subtitle File:
    • Write the merged subtitles to a new file.