Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

Merge origin/main into feat/webv2-reference-sample-window

Lincoln Stein5172231b03e6
diff --cc invokeai/frontend/webv2/public/locales/en.json
index d8ef41833a,6681668ad1..f208c5e878
--- a/invokeai/frontend/webv2/public/locales/en.json
+++ b/invokeai/frontend/webv2/public/locales/en.json
@@@ -3402,11 -3523,6 +3523,8 @@@
"lastFrameExtendHelp": "Optional destination: the extension ends on this image.",
"lastFrameHelp": "Optional: the video ends on this image (interpolates from the first frame).",
"removeClip": "Remove video",
- "removeFrame": "Remove",
- "replaceClip": "Replace the initial video",
- "replaceFrame": "Replace the frame image",
+ "sampleLength": "Sample Length (Frames)",
+ "sampleLengthWithSeconds": "Sample Length · {{seconds}}s",
"trim": "Trim",
"trimEnd": "End Frame",
"trimEndShort": "End",
diff --cc invokeai/frontend/webv2/src/features/video/ui/VideoReferenceListField.tsx
index 9e0576a337,0cb7091a1a..53ac4f20a8
--- a/invokeai/frontend/webv2/src/features/video/ui/VideoReferenceListField.tsx
+++ b/invokeai/frontend/webv2/src/features/video/ui/VideoReferenceListField.tsx
@@@ -6,16 -8,12 +8,17 @@@ import type
} from '@features/video/core/types';
import type { ChangeEvent } from 'react';
- import { Badge, Box, createListCollection, HStack, Image, Input, Spinner, Stack, Text } from '@chakra-ui/react';
+ import { Badge, Box, createListCollection, HStack, Icon, Image, Input, Spinner, Stack, Text } from '@chakra-ui/react';
import { useDndContext, useDndMonitor, useDroppable } from '@dnd-kit/core';
- import { galleryImages, galleryItems, galleryTransfers } from '@features/gallery';
+ import { galleryItems, galleryTransfers, toGalleryItemKey } from '@features/gallery';
+ import { GalleryPickerPopover } from '@features/gallery/picker';
import { galleryImageUrls, galleryVideoUrls, isGalleryItemDragData } from '@features/gallery/utility';
-import { createVideoSourceClip } from '@features/video/core/settings';
+import {
+ createVideoSourceClip,
+ DEFAULT_REFERENCE_SAMPLE_FRAMES,
+ resizeReferenceSampleWindow,
+ slideReferenceSampleWindow,
+} from '@features/video/core/settings';
import {
assertAccountScopeCurrent,
captureAccountScope,
@@@ -391,7 -367,40 +402,46 @@@ export const VideoReferenceListField =
setIsLoading(false);
}
},
- [maxImages, onChange, reportError, t]
+ [addImageReference, reportError]
+ );
+
+ const addVideoItem = useCallback(
+ (item: GalleryVideoItem) => {
+ const clip = createVideoSourceClip(item);
+ // Same live cap re-check as the image path -- the Initial Video's
+ // anchor is the writer that most easily fills the slots mid-await.
+ let declined = false;
+
+ setErrorMessage(null);
+ onChange((current) => {
+ if (current.filter((entry) => entry.kind === 'video').length >= maxVideos) {
+ declined = true;
+
+ return current;
+ }
+
+ return [
+ ...current,
+ {
- // References are truncated to the generated duration, not joined: default to
- // the whole clip rather than the extend-mode 2-frame-tail trim.
- clip: { ...clip, endFrame: Math.max(0, clip.numFrames - 1), startFrame: 0 },
++ // Default to a short sample window from the clip's start, not the whole
++ // clip: reference frames cost denoise VRAM every step, and a few seconds
++ // captures the wanted features. (Not the extend-mode 2-frame-tail trim
++ // either -- references are truncated to the generated duration, not joined.)
++ clip: {
++ ...clip,
++ endFrame: Math.max(0, Math.min(DEFAULT_REFERENCE_SAMPLE_FRAMES, clip.numFrames) - 1),
++ startFrame: 0,
++ },
+ conditioning: 'video_audio',
+ kind: 'video',
+ },
+ ];
+ });
+ if (declined) {
+ setErrorMessage(t('widgets.video.referenceVideoCapRace', { max: maxVideos }));
+ }
+ },
+ [maxVideos, onChange, t]
);
const addVideoReference = useCallback(