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 fix/audio-reference-default-conditioning

Lincoln Stein75e50ef4d17f
diff --cc invokeai/frontend/webv2/src/features/video/ui/VideoReferenceListField.tsx
index b526b56fb0,53ac4f20a8..99f0dab6c1
--- a/invokeai/frontend/webv2/src/features/video/ui/VideoReferenceListField.tsx
+++ b/invokeai/frontend/webv2/src/features/video/ui/VideoReferenceListField.tsx
@@@ -10,10 -10,15 +10,16 @@@ import type { ChangeEvent } from '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 { galleryItems, galleryTransfers, toGalleryItemKey } from '@features/gallery';
+import { galleryItems, galleryTransfers, galleryVideos, toGalleryItemKey } from '@features/gallery';
import { GalleryPickerPopover } from '@features/gallery/picker';
import { galleryImageUrls, galleryVideoUrls, isGalleryItemDragData } from '@features/gallery/utility';
- import { createVideoSourceClip, getDefaultReferenceConditioning } from '@features/video/core/settings';
+ import {
+ createVideoSourceClip,
+ DEFAULT_REFERENCE_SAMPLE_FRAMES,
++ getDefaultReferenceConditioning,
+ resizeReferenceSampleWindow,
+ slideReferenceSampleWindow,
+ } from '@features/video/core/settings';
import {
assertAccountScopeCurrent,
captureAccountScope,
@@@ -402,20 -406,8 +438,26 @@@ export const VideoReferenceListField =
);
const addVideoItem = useCallback(
- (item: GalleryVideoItem) => {
+ // The conditioning is passed in rather than derived here: only a caller holding the
+ // clip's metadata can tell a wrapped audio upload from footage. Callers without it get
+ // the ordinary video default -- and the entry back, so a late answer can correct it.
+ (item: GalleryVideoItem, conditioning: VideoReferenceConditioning = 'video_audio') => {
const clip = createVideoSourceClip(item);
+ // Built outside the updater so the caller holds the same object the list does: it is
+ // the only durable handle on this entry once reordering moves it.
+ const entry: Extract<VideoReferenceItem, { kind: 'video' }> = {
- // 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,
+ kind: 'video',
+ };
// 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;