Fix: SubRip subtitle export - sequence numbers now start at 1 #107997

Merged
Richard Antalik merged 2 commits from Alice-Scarlett/blender:subrip-1-indexed into main 2023-07-04 03:55:51 +02:00
Contributor

This PR makes is so when exporting .srt subtitles from the video sequence editor, each subtitle is indexed starting from 1, not 0.

Problem

Currently when exporting subtitles from the VSE, the file generated starts numbering subtitles from 0. Here's an example of the generated .srt file:

0
00:00:00,000 --> 00:00:02,267
Hello world

1
00:00:03,250 --> 00:00:05,533
meow

2
00:00:06,500 --> 00:00:08,783
Goodbye world

While there don't seem to be any official specs for the .srt file format (at least not that I could find), resources online pretty much all start numbering from 1 (Eg: Wikipedia, Matroska, Mailchimp). I ran into this issue trying to import a .srt file into Unreal Engine, where it just failed because it has a check that the first number is 1.

Reproduction steps

  1. Create a project using the Video Editing template
  2. Add a movie strip to the sequencer
  3. Add a few text strips to the sequencer
  4. Use View > Export Subtitles to generate a .srt file
  5. Observe that the .srt file starts numbering at 0

Fix

We start indexing from 1 now - to use the same example as above, now the .srt file generated looks like:

1
00:00:00,000 --> 00:00:02,267
Hello world

2
00:00:03,250 --> 00:00:05,533
meow

3
00:00:06,500 --> 00:00:08,783
Goodbye world
This PR makes is so when exporting .srt subtitles from the video sequence editor, each subtitle is indexed starting from 1, not 0. ## Problem Currently when exporting subtitles from the VSE, the file generated starts numbering subtitles from 0. Here's an example of the generated .srt file: ``` 0 00:00:00,000 --> 00:00:02,267 Hello world 1 00:00:03,250 --> 00:00:05,533 meow 2 00:00:06,500 --> 00:00:08,783 Goodbye world ``` While there don't seem to be any official specs for the .srt file format (at least not that I could find), resources online pretty much all start numbering from 1 (Eg: [Wikipedia](https://en.wikipedia.org/wiki/SubRip#SubRip_file_format), [Matroska](https://www.matroska.org/technical/subtitles.html#srt-subtitles), [Mailchimp](https://mailchimp.com/resources/what-is-an-srt-file/)). I ran into this issue trying to import a .srt file into Unreal Engine, where it just failed because it has a check that the first number is 1. ## Reproduction steps 1. Create a project using the Video Editing template 2. Add a movie strip to the sequencer 3. Add a few text strips to the sequencer 4. Use View > Export Subtitles to generate a .srt file 5. Observe that the .srt file starts numbering at 0 ## Fix We start indexing from 1 now - to use the same example as above, now the .srt file generated looks like: ``` 1 00:00:00,000 --> 00:00:02,267 Hello world 2 00:00:03,250 --> 00:00:05,533 meow 3 00:00:06,500 --> 00:00:08,783 Goodbye world ```
Alice-Scarlett added 1 commit 2023-05-17 03:37:13 +02:00
fdf8797e67 Fix: SubRip subtitle export - sequence numbers now start at 1
While there doesn't seem to be any official specs for the .srt file
format, all resourses I could find online start indexing at 1. This
commit makes Blender's .srt exports start at 1 instead of 0.
Iliya Katushenock added this to the Video Sequencer project 2023-05-17 13:30:59 +02:00
Brecht Van Lommel requested review from Richard Antalik 2023-06-13 19:27:41 +02:00

Thanks for patch, I have missed notification, sorry about that. The fix seems OK so will merge this.
The file has been converted to C++, so will update patch first.

Thanks for patch, I have missed notification, sorry about that. The fix seems OK so will merge this. The file has been converted to C++, so will update patch first.
Richard Antalik approved these changes 2023-07-04 03:34:51 +02:00
Richard Antalik added 1 commit 2023-07-04 03:50:36 +02:00
Richard Antalik merged commit 9cd07da339 into main 2023-07-04 03:55:51 +02:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#107997
No description provided.