Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > General > Subtitles

Reply
 
Thread Tools Search this Thread Display Modes
Old 10th April 2025, 16:31   #2001  |  Link
Music Fan
Registered User
 
Join Date: May 2009
Location: Belgium
Posts: 1,761
Hi,
I'm quite confused with a pattern to replace, I can't target 3 suspension points following a new line and followed by another character.
I want to add a space after these 3 points, thus only when they begin the line (I have another reg ex when they are preceeded by a space).

For instance, I'd like this ;
Code:
1
00:02:37,309 --> 00:02:39,516
Hello...

2
00:02:39,687 --> 00:02:42,641
...hi ...you.
to become ;
Code:
1
00:02:37,309 --> 00:02:39,516
Hello...

2
00:02:39,687 --> 00:02:42,641
... hi ...you.
I believed this could work but no ;
Code:
(\n)(\.{3})(\w)
replace by ;
Code:
$1$2 $3
Music Fan is offline   Reply With Quote
Old 10th April 2025, 16:42   #2002  |  Link
markfilipak
Registered User
 
markfilipak's Avatar
 
Join Date: Jul 2016
Location: Mansfield, Ohio (formerly, Silicon Valley in California)
Posts: 430
Quote:
Originally Posted by Music Fan View Post
Hi,
Code:
(\n)(\.{3})(\w)
Slow down my friend. You're telling regexp to find a word boundary.

Try this instead:

Code:
(\n)(\.{3})([^\s])
Also try this:

Code:
(\n)(\.{3})([\S])
Also try this:

Code:
^(\.{3})([\S])

Last edited by markfilipak; 10th April 2025 at 16:50.
markfilipak is offline   Reply With Quote
Old 10th April 2025, 16:50   #2003  |  Link
Music Fan
Registered User
 
Join Date: May 2009
Location: Belgium
Posts: 1,761
Thanks but neither of these 2 detects the pattern.
Music Fan is offline   Reply With Quote
Old 10th April 2025, 16:54   #2004  |  Link
markfilipak
Registered User
 
markfilipak's Avatar
 
Join Date: Jul 2016
Location: Mansfield, Ohio (formerly, Silicon Valley in California)
Posts: 430
Quote:
Originally Posted by Music Fan View Post
Thanks but neither of these 2 detects the pattern.
Then try these:
Code:
(\n)(\.\.\.)([\S])
(\n)(\.\.\.)([^ ])
^(\.\.\.)([^ ])
markfilipak is offline   Reply With Quote
Old 10th April 2025, 17:02   #2005  |  Link
Music Fan
Registered User
 
Join Date: May 2009
Location: Belgium
Posts: 1,761
Great, this works ;
Code:
^(\.{3})([^ ])
equals ;
Code:
^(\.\.\.)([^ ])
replace by ;
Code:
$1 $2


Do you know why \n is not taken into account ?
Music Fan is offline   Reply With Quote
Old 10th April 2025, 17:13   #2006  |  Link
markfilipak
Registered User
 
markfilipak's Avatar
 
Join Date: Jul 2016
Location: Mansfield, Ohio (formerly, Silicon Valley in California)
Posts: 430
Quote:
Originally Posted by Music Fan View Post
Great, this works ;
Do you know why \n is not taken into account ?
Nope. Every regexp processor I've used has bugs. SE can't seem to make up its mind regarding how to handle line-endings between subs versus line-endings within subs.
markfilipak is offline   Reply With Quote
Old 10th April 2025, 17:23   #2007  |  Link
Music Fan
Registered User
 
Join Date: May 2009
Location: Belgium
Posts: 1,761
Ok, good to know.
Music Fan is offline   Reply With Quote
Old 10th April 2025, 20:38   #2008  |  Link
markfilipak
Registered User
 
markfilipak's Avatar
 
Join Date: Jul 2016
Location: Mansfield, Ohio (formerly, Silicon Valley in California)
Posts: 430
Quote:
Originally Posted by Music Fan View Post
Do you know why \n is not taken into account ?
If
- your subs are text (e.g., SRT), and
- you have a text editor for UTF-8, and
- your text editor does regexp.
I'd recommend you use your text editor rather than SE.
markfilipak is offline   Reply With Quote
Old 10th April 2025, 23:26   #2009  |  Link
markfilipak
Registered User
 
markfilipak's Avatar
 
Join Date: Jul 2016
Location: Mansfield, Ohio (formerly, Silicon Valley in California)
Posts: 430
Waveshapes in waveforms are lagging

"The Ghost and Mrs. Muir" [1947] DVD, UPC 024543071426 (2023)

I've written about this in the past two days.
As it turns out, the real problem is that the audio is out of sync. The movie's running time is 102 minutes. By the 30 minute mark, the audio lags by about 200ms and placing subtitle cues begins to get difficult. By the end, the audio lags by about 600ms.

The fault is not with SE. The fault is with Mill Creek Entertainment, the folks who made the DVD. Perhaps my experience, documented here, will help other SE users.

FOLLOW-UP: Below is how I fixed the movie MP4. I
- sped up the dialog audio (-map "[a]") by a factor of 1.00005 (found by trail and error) and
- mixed in the sped up dialog (-c:a:0 ac3) and
- added the two audio comment streams (-map 0:a:4 -map 0:a:5, -c:a:1 copy -c:a:2 copy) and
- deleted closed captions
using the following script:
Code:
set      _SOURCE_="c:\The Ghost and Mrs. Muir\copy_b.mp4"
: copy_b is the concatenated VOBs made via copy /b then transcoded to AVC using my special sauce
set    _CHAPTERS_="c:\The Ghost and Mrs. Muir\chapters.txt"
set      _TARGET_="c:\The Ghost and Mrs. Muir [1947].mp4"
set _STRETCH_AUDIO_=-filter_complex "[0:a]atempo=1.00005[a]"
set _DELETE_CC_=-bsf:v "filter_units=remove_types=6"
ffmpeg^
 -i %_SOURCE_%^
 -i %_CHAPTERS_%^
 %_STRETCH_AUDIO_%^
 -map 0:v -map "[a]" -map 0:a:4 -map 0:a:5 -map_metadata 1^
 %_DELETE_CC_%^
 -c:v copy -c:a:0 ac3 -c:a:1 copy -c:a:2 copy^
 -dn^
 %_TARGET_%
I will now fix the SRT subs that I made in a previous step, which should be much easier now, and mix them in at the end.

Last edited by markfilipak; 11th April 2025 at 17:09.
markfilipak is offline   Reply With Quote
Old 11th April 2025, 08:54   #2010  |  Link
Music Fan
Registered User
 
Join Date: May 2009
Location: Belgium
Posts: 1,761
Quote:
Originally Posted by markfilipak View Post
If
- your subs are text (e.g., SRT), and
- you have a text editor for UTF-8, and
- your text editor does regexp.
I'd recommend you use your text editor rather than SE.
Ok, I believe I can do that with PowerShell (I don't know other methods).
Music Fan is offline   Reply With Quote
Old 11th April 2025, 12:22   #2011  |  Link
TR-7970X
Registered User
 
TR-7970X's Avatar
 
Join Date: Jan 2025
Posts: 65
Quote:
Originally Posted by markfilipak View Post
"The Ghost and Mrs. Muir" [1947] DVD, UPC 024543071426 (2023)

I've written about this in the past two days.

The fault is not with SE.

I will now fix the SRT subs that I made in a previous step, which should be much easier now, and mix them in at the end.
I just had to say that you've gone to a huge effort to "fix" this, and it's still DVD resolution (unless you're going to upscale in the future).

And progressive sync problems are a real pain.

The copy I got is 720p, with sub's, and it's all good, despite it being B&W, and a little grainy, it's good.
__________________
Main Systems:-
Threadripper 7970X on Asus Pro WS TRX50-Sage WiFi
Ryzen 9 9950X3D on MSI Carbon X670E
Ryzen 9 7950X on Gigabyte Aorus Elite B650
Intel 13900KF on MSI Tomahawk B660
TR-7970X is offline   Reply With Quote
Old 11th April 2025, 17:07   #2012  |  Link
markfilipak
Registered User
 
markfilipak's Avatar
 
Join Date: Jul 2016
Location: Mansfield, Ohio (formerly, Silicon Valley in California)
Posts: 430
What waveforms shows doesn't make sense

This should be useful for anyone experiencing audio out of sync.
Quote:
Originally Posted by TR-7970X View Post
I just had to say that you've gone to a huge effort to "fix" this, and it's still DVD resolution (unless you're going to upscale in the future).
Every problem holds a serpent in one hand and a laurel wreath in the other. Wisdom comes through struggle. (Note: I'm puzzled by "upscale". Why would anyone ever do that?)

Quote:
And progressive sync problems are a real pain.
The audio is slightly early and needed to be stretched.
Code:
From ffprobe -show_streams
   Before stretching: duration=6265.248021 seconds = 1:44:25.248021
    After stretching: duration=6265.595708 seconds = 1:44:25.595708
Amount of stretching: 6265.595708/6265.248021 ==> atempo=1.00005
What waveforms shows doesn't make sense:
In the case of the DVD above, audio was early relative to video. Don't let that confuse the issue. Regardless how well audio syncs with video, sound and a picture of the sound should always be identical. If a sound is early, then a picture of the sound should also be early. When SE waveforms draws pictures of sounds (audio), it must be using improper methods, methods derived from video timing.

Last edited by markfilipak; 11th April 2025 at 19:14.
markfilipak is offline   Reply With Quote
Old 24th April 2025, 09:55   #2013  |  Link
iKron
Registered User
 
Join Date: May 2021
Posts: 17
is there anyway we can use https://github.com/tesseract-ocr/tessdata_best
iKron is offline   Reply With Quote
Old 24th April 2025, 16:04   #2014  |  Link
markfilipak
Registered User
 
markfilipak's Avatar
 
Join Date: Jul 2016
Location: Mansfield, Ohio (formerly, Silicon Valley in California)
Posts: 430
Integate keyboard and mouse

Below are suggestions for integrating keyboard and mouse operations so to speed editing in the waveform panel.
INTERVAL is an internal process.
REWORK is suggestions shown to users after INTERVAL completes after displaying REWORK flags.
ALOOP, EDCUES, and MOVINTERVAL are user functions and will be of most interest to readers.

INTERVAL process: An automatic 'waveform' process that is run when SE knows where utterance_1 ends and utterance_2 starts.
This is called by EDCUES (below), not directly by users.
Let out_pad = 1000ms, in_pad = 300ms -- they can be changed of course, as can the 100ms shot change encroachment value.
"gap" is the minimal subtitle gap set by users.
Code:
// Set the gap (i.e., the minimum allowed space) to 2 frames.
// Adjust out-pads to 1000ms after utterances.
// Adjust in-pads to 300ms before utterances.

IF (X - gap) > 1300ms
//                        ___out-cue_1                    ___in-cue_2
//                       /                               /
//     ---utterance_1---|<--------------X-------------->|---utterance_2---
//                       ------------>             <----
//                          1000ms                 300ms
//     ---subtitle_1------------------|           |---------subtitle_2----

ELSE IF (X - gap) = 1300ms
//     ---utterance_1----------|<----------X----------->|---utterance_2---
//                              ------------->     <----
//                                  1000ms         300ms
//     ---subtitle_1--------------------------|gap|---------subtitle_2----

// When out-cue_1 and in-cue_2 collide with the gap, eat into out-pad_1.

ELSE IF (X - gap) >= 600ms
//     ---utterance_1-------------------|<------X------>|---utterance_2---
//                                                 <----
//                                                 300ms
//     ---subtitle_1--------------------------|gap|---------subtitle_2----

// When the utterances are even closer, eat into both, but center in-cue_2 between the utterances -- favors subtitle_2.

ELSE IF X > gap
//     ---utterance_1-----------------------|<----X---->|---utterance_2---
//                                                 <----
//                                                  X/2
//     ---subtitle_1--------------------------|gap|---------subtitle_2----

// When the utterances are closer than the gap, allow the gap to overlap utterance_1 -- preserves the start of subtitle_2.

ELSE
//     ---utterance_1---------------------------------| |---utterance_2---
//
//     ---subtitle_1--------------------------------|gap|---subtitle_2----
IF utterance_1 ends less than 100ms after a shot change, move out-cue_1 to the shot change and flag the interval "REWORK".
IF a shot change is within out-pad_1, move out-cue_1 to the shot change, then move in_cue_2 to either (out-cue_1 + gap) or (in-cue_2 - 300ms), whichever is later.
IF a shot change is within the gap, do nothing.
IF a shot change is within in-pad_1, move in-cue_2 to the shot change, then move out-cue_1 to either (out-cue_1 + 1000ms) or (in-cue_2 - gap), whichever is earlier.
IF utterance_2 begins less than 100ms before a shot change, move in-cue_2 to the shot change and flag the interval "REWORK".

REWORK (recommendations)
1, If utterance_1 and utterance_2 have the same speaker, merge the subtitles, then split them somewhere else.
2, Consider merging the subtitles as a 2-speaker dialog subtitle.
3, Do nothing, retain the current in- and out-cues.


ALOOP user function: A user 'waveform' function for arbitrary audio looping.
THE_KEY is a label for the key that has been assigned to invoke this function.
Press and hold THE_KEY, click point_A, click point_B.
(The audio continuously loops.)
Drag either point any number of times.
(The audio loop responds to the new loop.)
Release THE_KEY.
(The audio stops.)
Point_A and point_B can be _any_ two points.


EDCUES user function: A user 'waveform' function for setting cues.
THE_KEY is a label for the key that has been assigned to invoke this function.
Press and hold THE_KEY, click an existing out_cue, click an existing in_cue.
(The audio begins to loop continuously.)
Drag out_cue to the left while audio loops until you hear the end of utterance_1.
Drop out_cue at the end of utterance_1.
Drag in_cue to the right while audio loops until you hear the start of utterance_2.
Drop in_cue at the start of utterance_2.
(The audio continues looping.)
Repeat drag-n-drop as needed, adjusting their positions if needed, while holding THE_KEY.
Release THE_KEY.
(The audio stops).
SE now knows where utterance_1 ends and utterance_2 starts and automatically runs the INTERVAL process.
Repeating EDCUES on the same cues or any other pair of cues is allowed at any time without restriction.


MOVINTERVAL user function: A user 'waveform' function for moving both in- and out-cues simultaneously.
THE_KEY is a label for the key that has been assigned to invoke this function.
Press and hold THE_KEY.
Click on an interval between subtitles.
Drag-n-drop the interval.
(Both out-cue and in-cue have been moved.)
Release THE_KEY.


FOCUS: Abandon the current focus strategies. Toggle the focus between text and waveform via a single control: The "Tab" key for example.


SPACE: Instead of the user setting the number of pixels in a space, could you prompt the user to identify the center of a space during training and then simply measure it yourself?

Last edited by markfilipak; 4th May 2025 at 15:29. Reason: Extensive revision -- easier to see what this is about.
markfilipak is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 21:36.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.