FC Pro X - Importing caption files, only part of the captions show, not all

I have been trying unsuccessfully to import captions an hour and 15 minutes long into final cut pro. At first I thought that there was something wrong with the file, however, I imported the full captions successfully into davinci resolve. I do not want to work in davinci for my projects, I love final cut and have gotten proficiently adept with it. Does anyone possibly have a resolution for this? When the captions import, only the first two minutes import successfully. The rest are non existent in the project.

MacBook Pro 16″, macOS 13.4

Posted on Sep 4, 2023 3:05 PM

Reply
Question marked as Top-ranking reply

Posted on Sep 5, 2023 7:32 AM

As a test, I generated a (synthetic) caption file with more than 5000 captions and it imported without issue (it took a bit, but came out perfect).


I then modified it and got the error also.


I think I have a general idea of what is causing the problem: FCP does not take captions where the duration is too small. If your duration is, say, 1 millisecond, then it will be less than one frame and that causes an error.


In your case, that happens with caption number 117. It's timed to display for... 1 millisecond.

There may be more of those, so just fixing this one may not be enough, but at least we have a handle on the problem.

10 replies
Question marked as Top-ranking reply

Sep 5, 2023 7:32 AM in response to mercury290

As a test, I generated a (synthetic) caption file with more than 5000 captions and it imported without issue (it took a bit, but came out perfect).


I then modified it and got the error also.


I think I have a general idea of what is causing the problem: FCP does not take captions where the duration is too small. If your duration is, say, 1 millisecond, then it will be less than one frame and that causes an error.


In your case, that happens with caption number 117. It's timed to display for... 1 millisecond.

There may be more of those, so just fixing this one may not be enough, but at least we have a handle on the problem.

Sep 5, 2023 10:07 AM in response to mercury290

If the program producing the captions cannot be tuned to avoid these too short ones, we can always adjust the file afterwards. After all, it is only text in it. There are far too many captions to just try to find the problem ones visually.


One could import into FCP, note where the problem appears (it is the first caption after the last that imported correctly), and manually edit it. But this is still a nuisance, if there are many of those. I found three in your file, and then I quit searching.


A little script can help, though. At most, we could concoct a script that takes a file and spits out a new file with some adjustments to timing to avoid the problem.


I propose an intermediate solution, since I do not have the time to program and test a full thing.

We may try to build a little script that identifies the problematic captions, then they can be fixed by hand.

What do you think? I may try to do it if you think it is useful.


Sep 5, 2023 6:57 PM in response to mercury290

Luis will likely provide something easier to use, but I hacked together a python script with the help of ChatGPT.


In Terminal.app you'll first need to install the srt python library:

$ pip install srt


Then create this python script using something like vi in Terminal or a simple text editor. I named it srtchk.py and set it to check for captions that are less than 2 milliseconds. Change the line that sets the name of your SRT file. You can save this script wherever you want. I just put it adjacent to the srt file in a temp directory.


import srt
from datetime import timedelta

def check_caption_duration(file_path):
    with open(file_path, 'r') as f:
        srt_data = f.read()

    subtitles = list(srt.parse(srt_data))

    for subtitle in subtitles:
        caption_duration = subtitle.end - subtitle.start
        if caption_duration.total_seconds() < 0.002:  # 2 milliseconds
            print(f"Caption {subtitle.index} is less than 2 milliseconds.")

# Replace 'subtitle_file.srt' with the path to your SRT file
srt_file_path = 'subtitle_file.srt'

check_caption_duration(srt_file_path)


In Terminal, I navigated to the temp directory that has the python script and your SRT file and ran it with:

$ python srtchk.py


It found these in your SRT:

Caption 117 is less than 2 milliseconds.
Caption 1150 is less than 2 milliseconds.
Caption 1542 is less than 2 milliseconds.
Caption 1914 is less than 2 milliseconds.
Caption 2086 is less than 2 milliseconds.

Sep 5, 2023 6:57 AM in response to mercury290

Thank you for posting the file.


I have been experimenting with it, and I am getting errors as well.

I was suspecting that there might be some invisible character that would be invalid, but I have confirmed that it is not the case. It is a bit weird, because there does not seem to be one specific caption that is invalid, but it always fails around the same one. I am still trying some variations and if I arrive at a useful conclusion I will report back.

Sep 5, 2023 8:18 AM in response to Luis Sequeira1

Okay, so this helps greatly, now that we've deduced where the problem is stemming from. Now I am exporting these captions with DeScript so I have no control, seemingly, over the duration of the captions. Would you happen to know of any solution to this problem that I could use whenever this problem occurs? I run a podcast so I will be dealing with .srt files and transcripts on a very consistent basis. I've tried adding more lines to be available and that didn't fix the problem either. Thank you for all of your help!

Sep 6, 2023 2:06 AM in response to terryb

Thank you, Terry!


I have learned something new thanks to you...

I was coding this by hand (and it was mostly working, but still had to polish), and of course I should have though that "there is a Python module for that!"


I believe that your solution is just the right thing.

With that output it is easy to open the srt file in a text editor, and make an adjustment to the timings.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

FC Pro X - Importing caption files, only part of the captions show, not all

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.