Skip to content

Unrestricted Open-source alternative to AI video platforms — Free AI image & video generation studio with 600+ models (Flux, Midjourney, Kling, Sora, Veo). No content filters. Self-hosted, MIT licensed.

feat(studio): port first/last frame i2v support + t2v→i2v family map to web JSX

Anil Matcha5e01f6075818
diff --git a/packages/studio/src/components/VideoStudio.jsx b/packages/studio/src/components/VideoStudio.jsx
index 55a4d062..fb718f3c 100644
--- a/packages/studio/src/components/VideoStudio.jsx
+++ b/packages/studio/src/components/VideoStudio.jsx
@@ -276,6 +276,9 @@ export default function VideoStudio({
// ── uploads ──
const [uploadedImageUrl, setUploadedImageUrl] = useState(null);
const [imageUploading, setImageUploading] = useState(false);
+ const [uploadedEndImageUrl, setUploadedEndImageUrl] = useState(null);
+ const [endImageUploading, setEndImageUploading] = useState(false);
+ const [endImageProgress, setEndImageProgress] = useState(0);
const [uploadedVideoUrl, setUploadedVideoUrl] = useState(null);
const [videoUploading, setVideoUploading] = useState(false);
const [uploadedVideoName, setUploadedVideoName] = useState(null);
@@ -306,6 +309,7 @@ export default function VideoStudio({
const textareaRef = useRef(null);
const dropdownRef = useRef(null);
const imageFileInputRef = useRef(null);
+ const endImageFileInputRef = useRef(null);
const videoFileInputRef = useRef(null);
const resultVideoRef = useRef(null);
const hasRestored = useRef(false);
@@ -520,11 +524,15 @@ export default function VideoStudio({
setUploadedVideoName(null);
setV2vMode(false);
if (!imageMode) {
- const firstI2V = i2vModels[0];
+ const currentT2V = t2vModels.find((m) => m.id === selectedModel);
+ const sibling = currentT2V?.family
+ ? i2vModels.find((m) => m.family === currentT2V.family)
+ : null;
+ const target = sibling || i2vModels[0];
setImageMode(true);
- setSelectedModel(firstI2V.id);
- setSelectedModelName(firstI2V.name);
- applyControlsForModel(firstI2V.id, true, false);
+ setSelectedModel(target.id);
+ setSelectedModelName(target.name);
+ applyControlsForModel(target.id, true, false);
}
setPromptDisabled(false);
} catch (err) {
@@ -633,11 +641,15 @@ export default function VideoStudio({
setV2vMode(false);
if (!imageMode) {
- const firstI2V = i2vModels[0];
+ const currentT2V = t2vModels.find((m) => m.id === selectedModel);
+ const sibling = currentT2V?.family
+ ? i2vModels.find((m) => m.family === currentT2V.family)
+ : null;
+ const target = sibling || i2vModels[0];
setImageMode(true);
- setSelectedModel(firstI2V.id);
- setSelectedModelName(firstI2V.name);
- applyControlsForModel(firstI2V.id, true, false);
+ setSelectedModel(target.id);
+ setSelectedModelName(target.name);
+ applyControlsForModel(target.id, true, false);
}
setPromptDisabled(false);
} catch (err) {
@@ -652,6 +664,7 @@ export default function VideoStudio({
const clearImageUpload = () => {
setUploadedImageUrl(null);
+ setUploadedEndImageUrl(null);
setImageMode(false);
const first = t2vModels[0];
setSelectedModel(first.id);
@@ -660,6 +673,32 @@ export default function VideoStudio({
setPromptDisabled(false);
};
+ // ── end-frame upload (FLF i2v models) ──────────────────────────────────────
+ const handleEndImageFileChange = async (e) => {
+ const file = e.target.files[0];
+ if (!file) return;
+ if (file.size > 10 * 1024 * 1024) {
+ alert("Image exceeds 10MB limit.");
+ return;
+ }
+ setEndImageUploading(true);
+ setEndImageProgress(0);
+ try {
+ const url = await uploadFile(apiKey, file, (pct) => {
+ setEndImageProgress(pct);
+ });
+ setUploadedEndImageUrl(url);
+ } catch (err) {
+ alert(`End frame upload failed: ${err.message}`);
+ } finally {
+ setEndImageUploading(false);
+ setEndImageProgress(0);
+ if (endImageFileInputRef.current) endImageFileInputRef.current.value = "";
+ }
+ };
+
+ const clearEndImage = () => setUploadedEndImageUrl(null);
+
// ── video upload ─────────────────────────────────────────────────────────
const handleVideoFileChange = async (e) => {
const file = e.target.files[0];
@@ -820,6 +859,10 @@ export default function VideoStudio({
const i2vParams = { model: selectedModel, image_url: uploadedImageUrl };
if (trimmedPrompt) i2vParams.prompt = trimmedPrompt;
i2vParams.aspect_ratio = selectedAr;
+ const i2vModel = i2vModels.find((m) => m.id === selectedModel);
+ if (uploadedEndImageUrl && i2vModel?.lastImageField) {
+ i2vParams.last_image = uploadedEndImageUrl;
+ }
const durations = getDurationsForI2VModel(selectedModel);
if (durations.length > 0) i2vParams.duration = selectedDuration;
const resolutions = getResolutionsForI2VModel(selectedModel);
@@ -1209,6 +1252,70 @@ export default function VideoStudio({
</button>
</div>
+ {/* End-frame upload button (FLF i2v models only) */}
+ {imageMode && i2vModels.find((m) => m.id === selectedModel)?.lastImageField && (
+ <div className="relative">
+ <input
+ ref={endImageFileInputRef}
+ type="file"
+ accept="image/*"
+ className="hidden"
+ onChange={handleEndImageFileChange}
+ />
+ <button
+ type="button"
+ title={uploadedEndImageUrl ? "Clear end frame" : "Upload end frame (optional)"}
+ onClick={() =>
+ uploadedEndImageUrl
+ ? clearEndImage()
+ : endImageFileInputRef.current?.click()
+ }
+ className={`w-10 h-10 shrink-0 rounded-full border transition-all flex items-center justify-center relative overflow-hidden ${uploadedEndImageUrl ? "border-primary/60 bg-primary/5" : "bg-white/5 border-white/[0.03] hover:bg-white/10 hover:border-primary/40"} group`}
+ >
+ {endImageUploading ? (
+ <div className="flex flex-col items-center justify-center w-full h-full absolute inset-0 bg-black/80 z-20 backdrop-blur-[2px]">
+ <svg className="w-8 h-8 -rotate-90">
+ <circle cx="16" cy="16" r="14" stroke="currentColor" strokeWidth="2" fill="transparent" className="text-white/10" />
+ <circle
+ cx="16"
+ cy="16"
+ r="14"
+ stroke="currentColor"
+ strokeWidth="2"
+ fill="transparent"
+ strokeDasharray={88}
+ strokeDashoffset={88 - (88 * endImageProgress) / 100}
+ className="text-primary transition-all duration-300"
+ />
+ </svg>
+ <span className="absolute text-[9px] font-black text-primary leading-none">
+ {endImageProgress}%
+ </span>
+ </div>
+ ) : null}
+
+ {uploadedEndImageUrl ? (
+ <img
+ src={uploadedEndImageUrl}
+ alt=""
+ className={`w-full h-full object-cover rounded-full ${endImageUploading ? "opacity-40 blur-[2px]" : "opacity-100"}`}
+ />
+ ) : (
+ !endImageUploading && (
+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" className="text-white/40 group-hover:text-primary transition-colors">
+ <rect x="3" y="3" width="18" height="18" rx="2" ry="2" />
+ <circle cx="8.5" cy="8.5" r="1.5" />
+ <polyline points="21 15 16 10 5 21" />
+ </svg>
+ )
+ )}
+ <span className="absolute top-0.5 left-0.5 px-1 h-3.5 bg-black/60 rounded-md text-[7px] font-black text-primary leading-none flex items-center justify-center pointer-events-none">
+ END
+ </span>
+ </button>
+ </div>
+ )}
+
{/* Video upload button */}
<div className="relative">
<input
diff --git a/packages/studio/src/models.js b/packages/studio/src/models.js
index 7ed0a0a1..6a93c794 100644
--- a/packages/studio/src/models.js
+++ b/packages/studio/src/models.js
@@ -5583,6 +5583,7 @@ export const i2vModels = [
"endpoint": "kling-v2.1-master-i2v",
"family": "kling-v2.1",
"imageField": "image_url",
+ "lastImageField": "last_image",
"hasPrompt": true,
"inputs": {
"prompt": {
@@ -5624,6 +5625,7 @@ export const i2vModels = [
"endpoint": "kling-v2.1-standard-i2v",
"family": "kling-v2.1",
"imageField": "image_url",
+ "lastImageField": "last_image",
"hasPrompt": true,
"inputs": {
"prompt": {
@@ -5665,6 +5667,7 @@ export const i2vModels = [
"endpoint": "kling-v2.1-pro-i2v",
"family": "kling-v2.1",
"imageField": "image_url",
+ "lastImageField": "last_image",
"hasPrompt": true,
"inputs": {
"prompt": {
@@ -5706,6 +5709,7 @@ export const i2vModels = [
"endpoint": "wan2.2-image-to-video",
"family": "wan2.2",
"imageField": "image_url",
+ "lastImageField": "last_image",
"hasPrompt": true,
"inputs": {
"prompt": {
@@ -5932,6 +5936,7 @@ export const i2vModels = [
"endpoint": "minimax-hailuo-02-standard-i2v",
"family": "minimax-2",
"imageField": "image_url",
+ "lastImageField": "end_image_url",
"hasPrompt": true,
"inputs": {
"prompt": {
@@ -5973,6 +5978,7 @@ export const i2vModels = [
"endpoint": "minimax-hailuo-02-pro-i2v",
"family": "minimax-2",
"imageField": "image_url",
+ "lastImageField": "end_image_url",
"hasPrompt": true,
"inputs": {
"prompt": {
@@ -6072,6 +6078,7 @@ export const i2vModels = [
"endpoint": "seedance-lite-i2v",
"family": "bytedance",
"imageField": "image_url",
+ "lastImageField": "last_image",
"hasPrompt": true,
"inputs": {
"prompt": {
@@ -6753,6 +6760,7 @@ export const i2vModels = [
"endpoint": "veo3.1-image-to-video",
"family": "veo3.1",
"imageField": "image_url",
+ "lastImageField": "last_image",
"hasPrompt": true,
"inputs": {
"prompt": {
@@ -6803,6 +6811,7 @@ export const i2vModels = [
"endpoint": "veo3.1-fast-image-to-video",
"family": "veo3.1",
"imageField": "image_url",
+ "lastImageField": "last_image",
"hasPrompt": true,
"inputs": {
"prompt": {
@@ -6853,6 +6862,7 @@ export const i2vModels = [
"endpoint": "veo3.1-lite-image-to-video",
"family": "veo3.1",
"imageField": "image_url",
+ "lastImageField": "last_image",
"hasPrompt": true,
"inputs": {
"prompt": {
@@ -7433,6 +7443,7 @@ export const i2vModels = [
"endpoint": "kling-o1-image-to-video",
"family": "kling-o1",
"imageField": "image_url",
+ "lastImageField": "last_image",
"hasPrompt": true,
"inputs": {
"prompt": {
@@ -7753,6 +7764,7 @@ export const i2vModels = [
"endpoint": "kling-o1-standard-image-to-video",
"family": "kling-o1",
"imageField": "image_url",
+ "lastImageField": "last_image",
"hasPrompt": true,
"inputs": {
"prompt": {
@@ -7825,6 +7837,7 @@ export const i2vModels = [
"endpoint": "seedance-v1.5-pro-i2v",
"family": "seedance-v1.5-pro",
"imageField": "image_url",
+ "lastImageField": "last_image",
"hasPrompt": true,
"inputs": {
"prompt": {
@@ -7895,6 +7908,7 @@ export const i2vModels = [
"endpoint": "seedance-v1.5-pro-i2v-fast",
"family": "seedance-v1.5-pro",
"imageField": "image_url",
+ "lastImageField": "last_image",
"hasPrompt": true,
"inputs": {
"prompt": {
@@ -8005,6 +8019,7 @@ export const i2vModels = [
"endpoint": "kling-v3.0-pro-image-to-video",
"family": "kling-v3.0",
"imageField": "image_url",
+ "lastImageField": "last_image",
"hasPrompt": true,
"inputs": {
"prompt": {
@@ -8041,6 +8056,7 @@ export const i2vModels = [
"endpoint": "kling-v3.0-standard-image-to-video",
"family": "kling-v3.0",
"imageField": "image_url",
+ "lastImageField": "last_image",
"hasPrompt": true,
"inputs": {
"prompt": {
diff --git a/packages/studio/src/muapi.js b/packages/studio/src/muapi.js
index debe25d9..9550b454 100644
--- a/packages/studio/src/muapi.js
+++ b/packages/studio/src/muapi.js
@@ -107,6 +107,10 @@ export async function generateI2V(apiKey, params) {
if (imageField === 'images_list') payload.images_list = [params.image_url];
else payload[imageField] = params.image_url;
}
+ const lastImageField = modelInfo?.lastImageField;
+ if (lastImageField && params.last_image) {
+ payload[lastImageField] = params.last_image;
+ }
if (params.aspect_ratio) payload.aspect_ratio = params.aspect_ratio;
if (params.duration) payload.duration = params.duration;
if (params.resolution) payload.resolution = params.resolution;