Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a21cac0

Browse files
Dubbing: Fix bug of changing window. v5.15.20
1 parent d41d180 commit a21cac0

2 files changed

Lines changed: 31 additions & 21 deletions

File tree

‎DEVELOPER.md‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -937,6 +937,16 @@ youtube-dl --proxy socks5://127.0.0.1:10000 --output srs 'https://youtu.be/Sqraz
937937
938938
> Note: Setup the `--output TEMPLATE` when wants to define the filename.
939939
940+
## Regenrate ASR for Dubbing
941+
942+
Create a `regenerate.txt` under the project file, then restart Oryx and refresh the page:
943+
944+
```bash
945+
touch ./platform/containers/data/dubbing/4830675a-7945-48fe-bed9-72e6fa904a19/regenerate.txt
946+
```
947+
948+
Oryx will regenerate the ASR and translation, then delete the `regenerate.txt` to make sure it executes one time.
949+
940950
## WebRTC Candidate
941951

942952
Oryx follows the rules for WebRTC candidate, see [CANDIDATE](https://ossrs.io/lts/en-us/docs/v5/doc/webrtc#config-candidate),
@@ -1272,8 +1282,8 @@ The following are the update records for the Oryx server.
12721282
* Dubbing: Merge more words if in small duration. v5.15.17
12731283
* Dubbing: Allow fullscreen when ASR. v5.15.18
12741284
* Dubbing: Support disable asr or translation. v5.15.19
1275-
* Dubbing: Fix bug when changing ASR segment size. [v5.15.20](https://github.com/ossrs/oryx/releases/tag/v5.15.20)
1276-
* Dubbing: Refine the window of text. v5.15.21
1285+
* Dubbing: Fix bug when changing ASR segment size. v5.15.20
1286+
* Dubbing: Refine the window of text. [v5.15.20](https://github.com/ossrs/oryx/releases/tag/v5.15.20)
12771287
* v5.14:
12781288
* Merge features and bugfix from releases. v5.14.1
12791289
* Dubbing: Support VoD dubbing for multiple languages. [v5.14.2](https://github.com/ossrs/oryx/releases/tag/v5.14.2)

‎platform/dubbing.go‎

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1550,27 +1550,18 @@ func (v *AudioResponse) QueryGroup(uuid string) *AudioGroup {
15501550
return nil
15511551
}
15521552

1553-
func (v *AudioResponse) FindAnySegmentMatchStarttime(starttime float64) *AudioSegment {
1554-
for i, g := range v.Groups {
1555-
var nextGroup *AudioGroup
1556-
if i < len(v.Groups)-1 {
1557-
nextGroup = v.Groups[i+1]
1558-
}
1559-
1560-
firstSegment, lastSegment := g.FirstSegment(), g.LastSegment()
1561-
if nextGroup != nil {
1562-
lastSegment = nextGroup.LastSegment()
1563-
}
1564-
1565-
if firstSegment == nil || lastSegment == nil {
1566-
continue
1553+
func (v *AudioResponse) MatchGroups(starttime float64, max int) []*AudioGroup {
1554+
var matched []*AudioGroup
1555+
for _, g := range v.Groups {
1556+
if first := g.FirstSegment(); first != nil && starttime <= first.Start {
1557+
matched = append(matched, g)
15671558
}
15681559

1569-
if firstSegment.OriginalStart<=starttime&&starttime<=lastSegment.OriginalStart {
1570-
returnfirstSegment
1560+
if len(matched) >=max {
1561+
break
15711562
}
15721563
}
1573-
return nil
1564+
return matched
15741565
}
15751566

15761567
func (v *AudioResponse) AppendSegment(resp openai.AudioResponse, starttime float64) {
@@ -1798,7 +1789,14 @@ func (v *SrsDubbingTask) Start(ctx context.Context) error {
17981789

17991790
// Whether force to generate ASR response.
18001791
if alwaysForceRegenerateASRResponse {
1801-
v.AsrResponse = NewAudioResponse()
1792+
v.AsrResponse = nil
1793+
}
1794+
1795+
// Whether exists command file to regenerate ASR.
1796+
regenerateASR := path.Join(conf.Pwd, aiDubbingWorkDir, v.project.UUID, "regenerate.txt")
1797+
if _, err := os.Stat(regenerateASR); err == nil {
1798+
os.Remove(regenerateASR)
1799+
v.AsrResponse = nil
18021800
}
18031801

18041802
if v.AsrResponse == nil {
@@ -1815,7 +1813,9 @@ func (v *SrsDubbingTask) Start(ctx context.Context) error {
18151813
break
18161814
}
18171815

1818-
if v.AsrResponse.FindAnySegmentMatchStarttime(starttime) != nil {
1816+
// If there are some matched groups about start time, do not generate the ASR for it.
1817+
ignoreIfMatched := 3
1818+
if matches := v.AsrResponse.MatchGroups(starttime, ignoreIfMatched*2); len(matches) > ignoreIfMatched {
18191819
continue
18201820
}
18211821

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /