-
Notifications
You must be signed in to change notification settings - Fork 125
Reproduction case for many clips freezing issue #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
remorses
wants to merge
4
commits into
diffusionstudio:main
Choose a base branch
from
remorses:repro-many-clips
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+29
−278
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
725fa4d
Update playground to reproduce many clips performance issue
remorses f2e194d
Simplify playground to only include video clips for performance testing
remorses 6c0fc64
Adjust clips configuration for reproduction
remorses 4d6fd12
update package
remorses File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,6 @@ | |
| "vite": "^7.2.2" | ||
| }, | ||
| "dependencies": { | ||
| "@diffusionstudio/core": "^4.0.0" | ||
| "@diffusionstudio/core": "^4.0.2" | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,285 +1,36 @@ | ||
| import * as core from '@diffusionstudio/core-v4'; | ||
| import * as core from '@diffusionstudio/core'; | ||
|
|
||
| export const settings: core.CompositionSettings = { | ||
| background: '#76b7f5', | ||
| }; | ||
|
|
||
| export async function main(composition: core.Composition) { | ||
| const font = await core.loadFont({ | ||
| family: 'Geologica', | ||
| weight: '800', | ||
| }); | ||
|
|
||
| core.env.experimental_timeBase = 30; | ||
| core.env.experimental_canonicalTimeBase = 48_000; | ||
|
|
||
| const sources = await Promise.all([ | ||
| core.Source.from<core.VideoSource>('/bbb_1080p_30fps.mp4'), | ||
| core.Source.from<core.ImageSource>('/lenna.png'), | ||
| core.Source.from<core.AudioSource>('/harvard.MP3'), | ||
| core.Source.from<core.CaptionSource>('/captions.json'), | ||
| core.Source.from<core.AudioSource>('/file_example_MP3_1MG.mp3'), | ||
| core.Source.from<core.ImageSource>('/parrot.jpg') | ||
| ]); | ||
|
|
||
| const mask = new core.RectangleMask({ | ||
| x: 1920 / 2, | ||
| y: 1080 / 2, | ||
| width: 1080, | ||
| height: 1080, | ||
| radius: 100, | ||
| }); | ||
| const videoSource = await core.Source.from<core.VideoSource>('/bbb_1080p_30fps.mp4'); | ||
|
|
||
| const videoClip = new core.VideoClip(sources[0], { | ||
| position: 'center', | ||
| mask, | ||
| height: '100%', | ||
| animations: [ | ||
| { | ||
| key: 'scale', | ||
| frames: [ | ||
| { time: 0, value: 0.5 }, | ||
| { time: 2, value: 1 }, | ||
| ], | ||
| }, | ||
| { | ||
| key: 'rotation', | ||
| frames: [ | ||
| { time: 0, value: 0 }, | ||
| { time: 2, value: 720 }, | ||
| ], | ||
| }, | ||
| { | ||
| key: 'opacity', | ||
| frames: [ | ||
| { time: 0, value: 100 }, | ||
| { time: 1, value: 80 }, | ||
| { time: 2, value: 100 }, | ||
| ], | ||
| } | ||
| ], | ||
| range: [0.8, 18], | ||
| delay: 1, | ||
| }) | ||
| const CLIPS = 40; | ||
| const videoDuration = 20; | ||
| const minClipDuration = 3; | ||
| const slideStep = videoDuration / CLIPS; | ||
|
|
||
| const videoLayer = new core.Layer(); | ||
| const videoLayer = new core.Layer({ mode: 'SEQUENTIAL' }); | ||
| await composition.add(videoLayer); | ||
| await videoLayer.add(videoClip); | ||
|
|
||
| const imageClip = new core.ImageClip(sources[1], { | ||
| position: 'center', | ||
| height: 600, | ||
| duration: 6, | ||
| effects: [ | ||
| { | ||
| type: 'contrast', | ||
| value: 60, | ||
| }, | ||
| { | ||
| type: 'sepia', | ||
| value: 100, | ||
| }, | ||
| { | ||
| type: 'drop-shadow', | ||
| value: { | ||
| offsetX: -9, | ||
| offsetY: 9, | ||
| blur: 3, | ||
| color: '#e81', | ||
| }, | ||
| }, | ||
| ], | ||
| animations: [ | ||
| { | ||
| key: 'translateX', | ||
| frames: [ | ||
| { time: 0, value: -1000 }, | ||
| { time: 2, value: 1000 }, | ||
| { time: 4, value: 0 } | ||
| ], | ||
| }, | ||
| ] | ||
| }); | ||
|
|
||
| const imageLayer = new core.Layer(); | ||
| await composition.add(imageLayer); | ||
| await imageLayer.add(imageClip); | ||
|
|
||
| const audioClip = new core.AudioClip(sources[2]); | ||
|
|
||
| const audioLayer = new core.Layer(); | ||
| await composition.add(audioLayer); | ||
| await audioLayer.sequential(); | ||
| await audioLayer.add(audioClip); | ||
| await audioClip.removeSilences(); | ||
|
|
||
| const captionLayer = new core.Layer(); | ||
| await composition.add(captionLayer); | ||
| const captionClip = new core.CaptionClip(sources[3]); | ||
| await captionLayer.add(captionClip); | ||
|
|
||
| const textLayer0 = new core.Layer(); | ||
| await composition.add(textLayer0); | ||
| await textLayer0.add(new core.TextClip({ | ||
| text: "Basic text in \nDiffusion Studio", | ||
| align: 'center', | ||
| baseline: 'middle', | ||
| fontSize: 14, | ||
| strokes: [{ | ||
| width: 3, | ||
| color: '#000000', | ||
| }], | ||
| x: '50%', | ||
| y: '15%', | ||
| rotation: 45, | ||
| })); | ||
| for (let i = 0; i < CLIPS; i++) { | ||
| const startTime = i * slideStep; | ||
| const endTime = startTime + minClipDuration; | ||
|
|
||
| const textLayer1 = new core.Layer(); | ||
| await composition.add(textLayer1); | ||
| await textLayer1.add( | ||
| new core.TextClip({ | ||
| align: 'center', | ||
| baseline: 'middle', | ||
| fontSize: 14, | ||
| x: '75%', | ||
| y: '40%', | ||
| casing: 'upper', | ||
| duration: 20, | ||
| animations: [{ | ||
| key: 'text', | ||
| easing: 'ease-out', | ||
| frames: [ | ||
| { time: 0, value: '' }, | ||
| { time: 20 / 30, value: 'Animated Text' }, | ||
| ], | ||
| }] | ||
| }) | ||
| ); | ||
| if (endTime > videoDuration) continue; | ||
|
|
||
| const rectangleLayer = new core.Layer(); | ||
| await composition.add(rectangleLayer); | ||
| await rectangleLayer.add( | ||
| new core.RectangleClip({ | ||
| const videoClip = new core.VideoClip(videoSource, { | ||
| position: 'center', | ||
| delay: 6, | ||
| duration: 4, | ||
| fill: '#FF0000', | ||
| radius: 10, | ||
| strokes: [{ | ||
| width: 2, | ||
| color: '#000000', | ||
| }], | ||
| animations: [ | ||
| { | ||
| key: 'x', | ||
| easing: 'ease-in-out', | ||
| frames: [ | ||
| { time: 2.6, value: 960 }, | ||
| { time: 4, value: 50 }, | ||
| ], | ||
| }, | ||
| { | ||
| key: 'width', | ||
| easing: 'ease-in-out', | ||
| frames: [ | ||
| { time: 0, value: 0 }, | ||
| { time: 2, value: 1000 }, | ||
| { time: 4, value: 60 }, | ||
| ], | ||
| }, | ||
| { | ||
| key: 'height', | ||
| easing: 'ease-in-out', | ||
| frames: [ | ||
| { time: 0, value: 0 }, | ||
| { time: 2, value: 700 }, | ||
| { time: 4, value: 40 }, | ||
| ], | ||
| }, | ||
| { | ||
| key: 'fill', | ||
| frames: [ | ||
| { time: 0, value: '#FF0000' }, | ||
| { time: 4, value: '#00FF00' }, | ||
| ], | ||
| } | ||
| ] | ||
| }) | ||
| ) | ||
|
|
||
| const circleLayer = new core.Layer(); | ||
| await composition.add(circleLayer); | ||
| await circleLayer.add( | ||
| new core.EllipseClip({ | ||
| position: 'center', | ||
| x: '70%', | ||
| fill: '#FFFF00', | ||
| radius: 90, | ||
| blendMode: 'screen', | ||
| }) | ||
| ); | ||
|
|
||
| const textLayer2 = new core.Layer(); | ||
| await composition.add(textLayer2); | ||
| await textLayer2.add( | ||
| new core.TextClip({ | ||
| text: `This is a Complex Text`, | ||
| duration: 12, | ||
| align: 'center', | ||
| baseline: 'middle', | ||
| font, | ||
| casing: 'upper', | ||
| fontSize: 12, | ||
| background: { | ||
| borderRadius: 20, | ||
| opacity: 40, | ||
| }, | ||
| strokes: [{ | ||
| width: 2, | ||
| color: '#000000', | ||
| }], | ||
| y: '85%', | ||
| x: '50%', | ||
| shadows: [{ | ||
| opacity: 70, | ||
| blur: 7, | ||
| offsetX: 2, | ||
| offsetY: 4, | ||
| }], | ||
| styles: [{ | ||
| start: 8, | ||
| style: { | ||
| color: '#19fa2c' | ||
| } | ||
| }], | ||
| }) | ||
| ) | ||
|
|
||
|
|
||
| const audioClip1 = new core.AudioClip(sources[4], { volume: 0.2, duration: 20 }); | ||
| const audioLayer1 = new core.Layer(); | ||
| await composition.add(audioLayer1); | ||
| await audioLayer1.add(audioClip1); | ||
|
|
||
| const imageLayer2 = new core.Layer(); | ||
| await composition.add(imageLayer2); | ||
| await imageLayer2.add( | ||
| new core.ImageClip(sources[1], { | ||
| height: 300, | ||
| delay: 2, | ||
| duration: 3, | ||
| transition: { | ||
| duration: 3, | ||
| type: 'dissolve', | ||
| } | ||
| }) | ||
| ) | ||
| height: '100%', | ||
| range: [startTime, endTime], | ||
| duration: minClipDuration, | ||
| }); | ||
|
|
||
| await imageLayer2.add( | ||
| new core.ImageClip(sources[5], { | ||
| height: 300, | ||
| delay: 5, | ||
| duration: 3, | ||
| }) | ||
| ) | ||
| await videoLayer.add(videoClip); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| import * as core from '@diffusionstudio/core-v4'; | ||
| import * as core from '@diffusionstudio/core'; | ||
|
|
||
| let fps = 30; | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.