Bug 498870 - Importing subtitles file (*.ass) - Kdenlive should check if subtitles have the same start timestamp and warn the user
Summary: Importing subtitles file (*.ass) - Kdenlive should check if subtitles have th...
Status: ASSIGNED
Alias: None
Product: kdenlive
Classification: Applications
Component: Title Clips & Subtitles (other bugs)
Version First Reported In: 24.12.0
Platform: Other Microsoft Windows
: HI wishlist
Target Milestone: ---
Assignee: Ron
URL:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2025-01-19 00:55 UTC by Catalin
Modified: 2025-05-21 04:09 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
The subtitles file (18.52 KB, text/x-ssa)
2025-01-19 00:55 UTC, Catalin
Details
Aegisub_levels (215.60 KB, image/png)
2025-01-20 18:28 UTC, emohr
Details
karaoke-subtitles_with-layers (18.66 KB, text/x-ssa)
2025-01-20 18:45 UTC, emohr
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Catalin 2025-01-19 00:55:58 UTC
Created attachment 177521 [details]
The subtitles file

SUMMARY
When importing an external .ass file, some of the subtitles are not brought into the Kdenlive project.
This can happen when the file contains multiple subtitles that have the same StartTime timestamp.
The attached subtitles file ("karaoke-subtitles.ass") has been identified to present this behaviour.

STEPS TO REPRODUCE
1. Create an empty Kdenlive project
2. Set timeline cursor position at 00:00:00
3. Go to Project > Subtitles > Import Subtitle File...
4. Browse for "karaoke-subtitles.ass" file
5. Check "Import at timeline cursor position"
6. Press "OK"
7. Play the empty video with imported subtitles

OBSERVED RESULT
- During the first 15 seconds, three subtitles are displayed, being formatted and positioned differently
- During the rest of the empty video, any Korean subtitle has its corresponding English subtitle displayed underneath it

EXPECTED RESULT
- During the first 15 seconds, only the first subtitle in the .ass file is displayed
- During the rest of the empty video, every Korean subtitle is lacking its corresponding English subtitle displayed underneath it

SOFTWARE/OS VERSIONS
Windows: 11 Enterprise

ADDITIONAL INFORMATION
It looks like only StartTime is taken into account when importing the subtitles.
When two subtitles have different StartTime, but same EndTime, the subtitles are imported correctly.
This behaviour (importing multiple subtitles with same StartTime) is crucial when creating Karaoke videos.
Comment 1 Catalin 2025-01-19 15:30:11 UTC
I'm sorry, I have reversed the expected results and observed results descriptions.

Expected result: display all subtitles.
Observed result: some subtitles are not displayed.
Comment 2 emohr 2025-01-20 18:28:03 UTC
Created attachment 177554 [details]
Aegisub_levels

I was not aware that such subtitle “animation” can be done! I think you have it done in Aegisub.

I tried with Aegisub and put the English text on Layer 1. After importing the ass file into Kdenlive I see the English translation. See attached screenshot.

Is that what you want?
Comment 3 Catalin 2025-01-20 18:39:11 UTC
Indeed, I am using Aegisub to create the subtitles file.
I was not aware that I can manage the layers from Aegisub, I was looking to manage them in Kdenlive.

Thank you SO much for the suggestion! This is a good workaround.

I believe this issue can be closed, unless we consider the functionality of letting two subtitles having the same StartTime on the same layer. I'm not sure of the exact initial intended specifications of the import feature.
Comment 4 emohr 2025-01-20 18:45:12 UTC
Created attachment 177555 [details]
karaoke-subtitles_with-layers

Attached the updated ass file. When subtitles starts at the same time you have to distribute the subtitle to different layers.
Comment 5 emohr 2025-01-20 18:55:17 UTC
Importing subtitles. I think we could add a warning if subtitles start at the same time and are on the same layer with a suggestion to distribute it to different layer. Or even better open a window and give the user the possibly to distribute the subtitle line to different layers.

BTW: Aegisub indicate with red lines that subtitle-lines start at the same time or are within the same time range.
Comment 6 Catalin 2025-01-20 19:05:01 UTC
I agree that notifying the user about this potential problem is a very good idea. It would have saved me much time from research. Taking action and solving it on the spot in a new window would be even better, a nice-to-have feature I guess.

Now I understand the use cases for layers in subtitles, I was not using them properly in this scenario.

Also thank you so much for the updated file! :)
Comment 7 Ron 2025-05-21 04:09:12 UTC
The inability to have two subtitles with the same start time isn't something fundamental to
subtitle files or their renderers.  You can craft such a file outside of kdenlive and it will work
just fine in most if not all players.  In theory kdenlive can even render it correctly.

Disallowing that, and using 'layers' as a workaround for it, is an artificial limitation that was
created to 'solve' the problem of how to handle perfectly overlapping clips in the timeline
UI, and the problem of them being internally indexed by start time which didn't permit
having them together in the kdenlive internal structures for manipulating clips.

Using (ASS) layers isn't a good workaround for that, because most/all renderers will display two
subtitles on different layers differently to how it displays overlapping subtitles that are on the
same layer.  If they are on different layers, then they will overwrite each other (without explicit
re-positioning) rather than being cleanly shown together.  (It does make some sense to show
them that way on the UI timeline when subtitles overlap, in a similar way to showing any other
overlapping clips on different tracks, just not to link that function to 'ass layers' which do
something different, and almost completely opposite).

All these problems have been addressed in my current dev branch, and importing or otherwise
adding overlapping subtitles works correctly in the editor the same as it does in the renderer.

So this bug is in the set that will be closed when that work is completed and lands in a release.