FangSen9000 commited on
Commit
8af7be8
·
1 Parent(s): 98cf86d

Fix streaming pose preview playback order

Browse files
Files changed (3) hide show
  1. index.js +78 -7
  2. pipeline02_gloss2pose.py +58 -56
  3. viser_backend.py +2 -2
index.js CHANGED
@@ -676,7 +676,7 @@ export default class StableSignerPlugin extends ControlWavePlugin {
676
  <div class="stable-advanced-grid">
677
  <div class="form-group">
678
  <label>FPS</label>
679
- <input id="stable-fps" type="number" min="5" max="60" value="30">
680
  </div>
681
  <div class="form-group">
682
  <label>Width</label>
@@ -836,6 +836,10 @@ export default class StableSignerPlugin extends ControlWavePlugin {
836
  this.selectionGenerationInFlight = false;
837
  this.selectionStreamPollingTimer = null;
838
  this.selectionStreamCursor = 0;
 
 
 
 
839
  this.lastGeneratedSelection = '';
840
  this.generateBtn = container.querySelector('#stable-generate');
841
  this.statusChip = container.querySelector('#stable-status');
@@ -910,7 +914,7 @@ export default class StableSignerPlugin extends ControlWavePlugin {
910
  text: promptText,
911
  gloss: glossValue,
912
  existingVideo: this.existingInput.value,
913
- fps: toInt(this.fpsInput.value, 30),
914
  width: toInt(this.widthInput.value, 512),
915
  height: toInt(this.heightInput.value, 512),
916
  smoothing: this.smoothingSelect.value,
@@ -1104,6 +1108,8 @@ export default class StableSignerPlugin extends ControlWavePlugin {
1104
  clearTimeout(this.selectionGenerationTimer);
1105
  this.selectionGenerationTimer = null;
1106
  }
 
 
1107
  if (this.selectionPopover) {
1108
  this.selectionPopover.style.display = 'none';
1109
  }
@@ -1117,6 +1123,10 @@ export default class StableSignerPlugin extends ControlWavePlugin {
1117
  this.lastGeneratedSelection = text;
1118
  this.promptTextInput.value = text;
1119
  this.glossInput.value = '';
 
 
 
 
1120
  this.logsPre.textContent = 'Selected text:\n' + text + '\n\nStreaming pose preview...';
1121
  if (this.selectionStatus) {
1122
  this.selectionStatus.textContent = 'Preparing pose preview...';
@@ -1157,12 +1167,68 @@ export default class StableSignerPlugin extends ControlWavePlugin {
1157
  this.glossInput.value = response.gloss;
1158
  }
1159
  this.selectionStreamCursor = 0;
 
 
 
 
1160
  if (this.selectionStreamPollingTimer) {
1161
  clearTimeout(this.selectionStreamPollingTimer);
1162
  }
1163
  this.pollPoseStream(response.job_id);
1164
  }
1165
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1166
  drawStreamFrameToCanvas(dataUrl) {
1167
  const image = new Image();
1168
  image.onload = () => {
@@ -1175,6 +1241,9 @@ export default class StableSignerPlugin extends ControlWavePlugin {
1175
  }
1176
  this.selectionCanvasCtx.drawImage(image, 0, 0, this.selectionCanvas.width, this.selectionCanvas.height);
1177
  this.selectionCanvas.style.display = 'block';
 
 
 
1178
  this.selectionHasFrame = true;
1179
  if (this.selectionPlaceholder) {
1180
  this.selectionPlaceholder.style.display = 'none';
@@ -1197,10 +1266,7 @@ export default class StableSignerPlugin extends ControlWavePlugin {
1197
  }
1198
  const frames = response.frames || [];
1199
  if (frames.length > 0) {
1200
- const latest = frames[frames.length - 1];
1201
- if (this.selectionCanvas && this.selectionCanvasCtx && latest.image) {
1202
- this.drawStreamFrameToCanvas(latest.image);
1203
- }
1204
  if (this.selectionPlaceholder) {
1205
  this.selectionPlaceholder.style.display = 'none';
1206
  }
@@ -1211,7 +1277,7 @@ export default class StableSignerPlugin extends ControlWavePlugin {
1211
  this.selectionStatus.textContent = `Gloss: ${(response.gloss || this.glossInput.value || '').trim()} · ${response.frame_count || this.selectionStreamCursor}${total} frames`;
1212
  }
1213
  if (response.status === 'running') {
1214
- this.selectionStreamPollingTimer = setTimeout(() => this.pollPoseStream(jobId), 180);
1215
  return;
1216
  }
1217
  this.selectionGenerationInFlight = false;
@@ -1221,6 +1287,11 @@ export default class StableSignerPlugin extends ControlWavePlugin {
1221
  if (response.video_url) {
1222
  await this.updateVideo(response.video_url, response.video_path);
1223
  await this.refreshRecentVideos();
 
 
 
 
 
1224
  }
1225
  if (this.selectionStatus && response.status === 'success') {
1226
  this.selectionStatus.textContent = `Gloss: ${(response.gloss || this.glossInput.value || '').trim()} · completed`;
 
676
  <div class="stable-advanced-grid">
677
  <div class="form-group">
678
  <label>FPS</label>
679
+ <input id="stable-fps" type="number" min="5" max="60" value="25">
680
  </div>
681
  <div class="form-group">
682
  <label>Width</label>
 
836
  this.selectionGenerationInFlight = false;
837
  this.selectionStreamPollingTimer = null;
838
  this.selectionStreamCursor = 0;
839
+ this.selectionStreamFrameQueue = [];
840
+ this.selectionStreamPlaybackTimer = null;
841
+ this.selectionStreamPlaybackFps = 25;
842
+ this.selectionPendingFinalVideoUrl = null;
843
  this.lastGeneratedSelection = '';
844
  this.generateBtn = container.querySelector('#stable-generate');
845
  this.statusChip = container.querySelector('#stable-status');
 
914
  text: promptText,
915
  gloss: glossValue,
916
  existingVideo: this.existingInput.value,
917
+ fps: toInt(this.fpsInput.value, 25),
918
  width: toInt(this.widthInput.value, 512),
919
  height: toInt(this.heightInput.value, 512),
920
  smoothing: this.smoothingSelect.value,
 
1108
  clearTimeout(this.selectionGenerationTimer);
1109
  this.selectionGenerationTimer = null;
1110
  }
1111
+ this.stopSelectionStreamPlayback();
1112
+ this.selectionPendingFinalVideoUrl = null;
1113
  if (this.selectionPopover) {
1114
  this.selectionPopover.style.display = 'none';
1115
  }
 
1123
  this.lastGeneratedSelection = text;
1124
  this.promptTextInput.value = text;
1125
  this.glossInput.value = '';
1126
+ this.stopSelectionStreamPlayback();
1127
+ this.selectionStreamFrameQueue = [];
1128
+ this.selectionStreamCursor = 0;
1129
+ this.selectionPendingFinalVideoUrl = null;
1130
  this.logsPre.textContent = 'Selected text:\n' + text + '\n\nStreaming pose preview...';
1131
  if (this.selectionStatus) {
1132
  this.selectionStatus.textContent = 'Preparing pose preview...';
 
1167
  this.glossInput.value = response.gloss;
1168
  }
1169
  this.selectionStreamCursor = 0;
1170
+ this.selectionStreamFrameQueue = [];
1171
+ this.selectionPendingFinalVideoUrl = null;
1172
+ this.selectionStreamPlaybackFps = toInt(response.fps, toInt(this.fpsInput.value, 25));
1173
+ this.startSelectionStreamPlayback();
1174
  if (this.selectionStreamPollingTimer) {
1175
  clearTimeout(this.selectionStreamPollingTimer);
1176
  }
1177
  this.pollPoseStream(response.job_id);
1178
  }
1179
 
1180
+ startSelectionStreamPlayback() {
1181
+ this.stopSelectionStreamPlayback();
1182
+ const fps = Math.max(5, Math.min(60, this.selectionStreamPlaybackFps || 30));
1183
+ const intervalMs = Math.max(16, Math.round(1000 / fps));
1184
+ this.selectionStreamPlaybackTimer = setInterval(() => {
1185
+ if (this.selectionStreamFrameQueue && this.selectionStreamFrameQueue.length > 0) {
1186
+ const next = this.selectionStreamFrameQueue.shift();
1187
+ if (next && next.image) {
1188
+ this.drawStreamFrameToCanvas(next.image);
1189
+ }
1190
+ return;
1191
+ }
1192
+ if (this.selectionPendingFinalVideoUrl) {
1193
+ const finalUrl = this.selectionPendingFinalVideoUrl;
1194
+ this.selectionPendingFinalVideoUrl = null;
1195
+ this.showSelectionFinalVideo(finalUrl);
1196
+ }
1197
+ }, intervalMs);
1198
+ }
1199
+
1200
+ stopSelectionStreamPlayback() {
1201
+ if (this.selectionStreamPlaybackTimer) {
1202
+ clearInterval(this.selectionStreamPlaybackTimer);
1203
+ this.selectionStreamPlaybackTimer = null;
1204
+ }
1205
+ }
1206
+
1207
+ async showSelectionFinalVideo(url) {
1208
+ if (!url || !this.selectionVideoEl) return;
1209
+ const absoluteUrl = url.startsWith('http') ? url : `${window.location.origin}${url}`;
1210
+ const hasQuery = absoluteUrl.includes('?');
1211
+ const fetchUrl = `${absoluteUrl}${hasQuery ? '&' : '?'}t=${Date.now()}`;
1212
+ this.stopSelectionStreamPlayback();
1213
+ this.selectionStreamFrameQueue = [];
1214
+ this.selectionPendingFinalVideoUrl = null;
1215
+ this.selectionVideoEl.pause();
1216
+ this.selectionVideoEl.src = fetchUrl;
1217
+ this.selectionVideoEl.style.display = 'block';
1218
+ this.selectionVideoEl.load();
1219
+ try {
1220
+ await this.selectionVideoEl.play();
1221
+ } catch (error) {
1222
+ // Keep controls available even if autoplay is blocked.
1223
+ }
1224
+ if (this.selectionCanvas) {
1225
+ this.selectionCanvas.style.display = 'none';
1226
+ }
1227
+ if (this.selectionPlaceholder) {
1228
+ this.selectionPlaceholder.style.display = 'none';
1229
+ }
1230
+ }
1231
+
1232
  drawStreamFrameToCanvas(dataUrl) {
1233
  const image = new Image();
1234
  image.onload = () => {
 
1241
  }
1242
  this.selectionCanvasCtx.drawImage(image, 0, 0, this.selectionCanvas.width, this.selectionCanvas.height);
1243
  this.selectionCanvas.style.display = 'block';
1244
+ if (this.selectionVideoEl) {
1245
+ this.selectionVideoEl.style.display = 'none';
1246
+ }
1247
  this.selectionHasFrame = true;
1248
  if (this.selectionPlaceholder) {
1249
  this.selectionPlaceholder.style.display = 'none';
 
1266
  }
1267
  const frames = response.frames || [];
1268
  if (frames.length > 0) {
1269
+ this.selectionStreamFrameQueue.push(...frames.filter(frame => frame && frame.image));
 
 
 
1270
  if (this.selectionPlaceholder) {
1271
  this.selectionPlaceholder.style.display = 'none';
1272
  }
 
1277
  this.selectionStatus.textContent = `Gloss: ${(response.gloss || this.glossInput.value || '').trim()} · ${response.frame_count || this.selectionStreamCursor}${total} frames`;
1278
  }
1279
  if (response.status === 'running') {
1280
+ this.selectionStreamPollingTimer = setTimeout(() => this.pollPoseStream(jobId), 120);
1281
  return;
1282
  }
1283
  this.selectionGenerationInFlight = false;
 
1287
  if (response.video_url) {
1288
  await this.updateVideo(response.video_url, response.video_path);
1289
  await this.refreshRecentVideos();
1290
+ if (this.selectionStreamFrameQueue.length > 0) {
1291
+ this.selectionPendingFinalVideoUrl = response.video_url;
1292
+ } else {
1293
+ await this.showSelectionFinalVideo(response.video_url);
1294
+ }
1295
  }
1296
  if (this.selectionStatus && response.status === 'success') {
1297
  this.selectionStatus.textContent = `Gloss: ${(response.gloss || this.glossInput.value || '').trim()} · completed`;
pipeline02_gloss2pose.py CHANGED
@@ -1361,7 +1361,7 @@ class SignLanguageQA:
1361
 
1362
  return None
1363
 
1364
- def generate_video_from_glosses(self, gloss_list, output_path, fps=30, width=480, height=480,
1365
  smoothing_frames=5, smoothing_method='none', npz_interpolation_frames=0,
1366
  scale_x=1.0, scale_y=1.0, hide_torso_lines=False, ref_image_path=None,
1367
  draw_style='controlnext', normalize_pose=True, draw_conf_threshold=0.6,
@@ -1391,6 +1391,7 @@ class SignLanguageQA:
1391
  video_info = []
1392
  first_signer_template = None
1393
  streamed_frame_count = 0
 
1394
 
1395
  def emit_stream_frame(frame, total_frames=None):
1396
  nonlocal streamed_frame_count
@@ -1402,7 +1403,43 @@ class SignLanguageQA:
1402
  except Exception as cb_err:
1403
  print(f"⚠️ Frame callback failed at {streamed_frame_count}: {cb_err}")
1404
 
1405
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1406
  for gloss in gloss_list:
1407
  matched_videos = self.find_gloss_videos(gloss)
1408
  total_matches = len(matched_videos)
@@ -1507,7 +1544,6 @@ class SignLanguageQA:
1507
  )
1508
  if pose_frame is not None:
1509
  gloss_frames.append(pose_frame)
1510
- emit_stream_frame(pose_frame)
1511
 
1512
  if gloss_frames:
1513
  all_pose_frames.append(gloss_frames)
@@ -1520,6 +1556,15 @@ class SignLanguageQA:
1520
  'end_frame': end_frame
1521
  })
1522
  print(f" ✅ Generated {len(gloss_frames)} pose frames")
 
 
 
 
 
 
 
 
 
1523
 
1524
  if not all_pose_frames:
1525
  print("❌ No frames generated")
@@ -1529,58 +1574,15 @@ class SignLanguageQA:
1529
  if npz_interpolation_frames > 0 and len(all_pose_frames) > 1:
1530
  print(f"🔄 Applying NPZ interpolation with {npz_interpolation_frames} frames ({npz_interpolation_method})...")
1531
  interpolated_pose_frames = []
1532
-
1533
  for i in range(len(all_pose_frames)):
1534
- # Add original frames
1535
  interpolated_pose_frames.extend(all_pose_frames[i])
1536
-
1537
- # Add interpolated frames between glosses
1538
  if i < len(all_pose_frames) - 1:
1539
- # Get NPZ data for interpolation
1540
- npz1 = video_info[i]['npz_data']
1541
- npz2 = video_info[i + 1]['npz_data']
1542
-
1543
- # Get valid frame ranges for interpolation
1544
- end_frame1 = video_info[i].get('end_frame', self.get_total_frames(npz1))
1545
- start_frame2 = video_info[i + 1].get('start_frame', 1)
1546
-
1547
- # Interpolate between the two NPZ files
1548
- interpolated_npz_frames = interpolate_pose_npz(
1549
- npz1, npz2,
1550
- num_frames=npz_interpolation_frames,
1551
- method=npz_interpolation_method,
1552
- frame1_num=end_frame1,
1553
- frame2_num=start_frame2
1554
- )
1555
-
1556
- # Convert interpolated NPZ frames to visual frames
1557
- for interp_data in interpolated_npz_frames:
1558
- # Extract frame data from interpolated NPZ
1559
- frame_keys = [k for k in interp_data.keys() if k.endswith('_bodies')]
1560
- if frame_keys:
1561
- frame_key = frame_keys[0]
1562
- frame_num = int(frame_key.split('_')[1])
1563
-
1564
- # Build frame data dict
1565
- frame_data = {}
1566
- for suffix in ['bodies', 'body_scores', 'hands', 'hands_scores', 'faces', 'faces_scores']:
1567
- key = f"frame_{frame_num:08d}_{suffix}"
1568
- if key in interp_data:
1569
- frame_data[suffix] = interp_data[key]
1570
-
1571
- # Create visual frame
1572
- if frame_data:
1573
- pose_frame = self.create_pose_frame(
1574
- frame_data, width, height, scale_x, scale_y,
1575
- hide_torso_lines, y_offset, draw_style,
1576
- conf_threshold=draw_conf_threshold
1577
- )
1578
- if pose_frame is not None:
1579
- interpolated_pose_frames.append(pose_frame)
1580
- emit_stream_frame(pose_frame)
1581
-
1582
- print(f" ✅ Added {npz_interpolation_frames} interpolated frames between '{video_info[i]['gloss']}' and '{video_info[i+1]['gloss']}'")
1583
-
1584
  all_pose_frames = [interpolated_pose_frames] # Treat as single sequence
1585
 
1586
  # Apply smoothing if needed
@@ -1592,8 +1594,8 @@ class SignLanguageQA:
1592
  for group in all_pose_frames:
1593
  final_frames.extend(group)
1594
 
1595
- # Push preview frames before final video encoding, so the browser can play immediately.
1596
- if frame_callback is not None and streamed_frame_count == 0:
1597
  print("📡 Streaming preview frames...")
1598
  total_preview_frames = len(final_frames)
1599
  for stream_idx, stream_frame in enumerate(final_frames):
@@ -1938,8 +1940,8 @@ def main():
1938
  parser = argparse.ArgumentParser(description='Sign Language Gloss Q&A System - Individual NPZ')
1939
  parser.add_argument('--gloss', '-g',
1940
  help='Directly input gloss to generate video, separated by spaces')
1941
- parser.add_argument('--fps', type=int, default=30,
1942
- help='Video frame rate (default: 30)')
1943
  parser.add_argument('--width', type=int, default=480,
1944
  help='Video width (default: 480)')
1945
  parser.add_argument('--height', type=int, default=480,
 
1361
 
1362
  return None
1363
 
1364
+ def generate_video_from_glosses(self, gloss_list, output_path, fps=25, width=480, height=480,
1365
  smoothing_frames=5, smoothing_method='none', npz_interpolation_frames=0,
1366
  scale_x=1.0, scale_y=1.0, hide_torso_lines=False, ref_image_path=None,
1367
  draw_style='controlnext', normalize_pose=True, draw_conf_threshold=0.6,
 
1391
  video_info = []
1392
  first_signer_template = None
1393
  streamed_frame_count = 0
1394
+ incremental_stream = frame_callback is not None and smoothing_method == 'none'
1395
 
1396
  def emit_stream_frame(frame, total_frames=None):
1397
  nonlocal streamed_frame_count
 
1403
  except Exception as cb_err:
1404
  print(f"⚠️ Frame callback failed at {streamed_frame_count}: {cb_err}")
1405
 
1406
+ def build_interpolated_visual_frames(prev_info, curr_info):
1407
+ if npz_interpolation_frames <= 0:
1408
+ return []
1409
+ npz1 = prev_info['npz_data']
1410
+ npz2 = curr_info['npz_data']
1411
+ end_frame1 = prev_info.get('end_frame', self.get_total_frames(npz1))
1412
+ start_frame2 = curr_info.get('start_frame', 1)
1413
+ interpolated_npz_frames = interpolate_pose_npz(
1414
+ npz1, npz2,
1415
+ num_frames=npz_interpolation_frames,
1416
+ method=npz_interpolation_method,
1417
+ frame1_num=end_frame1,
1418
+ frame2_num=start_frame2
1419
+ )
1420
+ interpolated_frames = []
1421
+ for interp_data in interpolated_npz_frames:
1422
+ frame_keys = [k for k in interp_data.keys() if k.endswith('_bodies')]
1423
+ if not frame_keys:
1424
+ continue
1425
+ frame_key = frame_keys[0]
1426
+ frame_num = int(frame_key.split('_')[1])
1427
+ frame_data = {}
1428
+ for suffix in ['bodies', 'body_scores', 'hands', 'hands_scores', 'faces', 'faces_scores']:
1429
+ key = f"frame_{frame_num:08d}_{suffix}"
1430
+ if key in interp_data:
1431
+ frame_data[suffix] = interp_data[key]
1432
+ if not frame_data:
1433
+ continue
1434
+ pose_frame = self.create_pose_frame(
1435
+ frame_data, width, height, scale_x, scale_y,
1436
+ hide_torso_lines, y_offset, draw_style,
1437
+ conf_threshold=draw_conf_threshold
1438
+ )
1439
+ if pose_frame is not None:
1440
+ interpolated_frames.append(pose_frame)
1441
+ return interpolated_frames
1442
+
1443
  for gloss in gloss_list:
1444
  matched_videos = self.find_gloss_videos(gloss)
1445
  total_matches = len(matched_videos)
 
1544
  )
1545
  if pose_frame is not None:
1546
  gloss_frames.append(pose_frame)
 
1547
 
1548
  if gloss_frames:
1549
  all_pose_frames.append(gloss_frames)
 
1556
  'end_frame': end_frame
1557
  })
1558
  print(f" ✅ Generated {len(gloss_frames)} pose frames")
1559
+
1560
+ if incremental_stream:
1561
+ if len(video_info) > 1 and npz_interpolation_frames > 0:
1562
+ prev_info = video_info[-2]
1563
+ interp_frames = build_interpolated_visual_frames(prev_info, video_info[-1])
1564
+ for pose_frame in interp_frames:
1565
+ emit_stream_frame(pose_frame)
1566
+ for pose_frame in gloss_frames:
1567
+ emit_stream_frame(pose_frame)
1568
 
1569
  if not all_pose_frames:
1570
  print("❌ No frames generated")
 
1574
  if npz_interpolation_frames > 0 and len(all_pose_frames) > 1:
1575
  print(f"🔄 Applying NPZ interpolation with {npz_interpolation_frames} frames ({npz_interpolation_method})...")
1576
  interpolated_pose_frames = []
1577
+
1578
  for i in range(len(all_pose_frames)):
 
1579
  interpolated_pose_frames.extend(all_pose_frames[i])
1580
+
 
1581
  if i < len(all_pose_frames) - 1:
1582
+ interp_frames = build_interpolated_visual_frames(video_info[i], video_info[i + 1])
1583
+ interpolated_pose_frames.extend(interp_frames)
1584
+ print(f" ✅ Added {len(interp_frames)} interpolated frames between '{video_info[i]['gloss']}' and '{video_info[i+1]['gloss']}'")
1585
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1586
  all_pose_frames = [interpolated_pose_frames] # Treat as single sequence
1587
 
1588
  # Apply smoothing if needed
 
1594
  for group in all_pose_frames:
1595
  final_frames.extend(group)
1596
 
1597
+ # For smoothed outputs, stream after final assembly because playback order changes.
1598
+ if frame_callback is not None and not incremental_stream:
1599
  print("📡 Streaming preview frames...")
1600
  total_preview_frames = len(final_frames)
1601
  for stream_idx, stream_frame in enumerate(final_frames):
 
1940
  parser = argparse.ArgumentParser(description='Sign Language Gloss Q&A System - Individual NPZ')
1941
  parser.add_argument('--gloss', '-g',
1942
  help='Directly input gloss to generate video, separated by spaces')
1943
+ parser.add_argument('--fps', type=int, default=25,
1944
+ help='Video frame rate (default: 25)')
1945
  parser.add_argument('--width', type=int, default=480,
1946
  help='Video width (default: 480)')
1947
  parser.add_argument('--height', type=int, default=480,
viser_backend.py CHANGED
@@ -519,7 +519,7 @@ class StableSignerBackend(PluginBackendBase):
519
  return {"status": "error", "message": "Gloss string is empty after normalization."}
520
 
521
  settings = {
522
- "fps": _safe_int(data.get("fps"), 30),
523
  "width": _safe_int(data.get("width"), 512),
524
  "height": _safe_int(data.get("height"), 512),
525
  "smoothing_method": data.get("smoothing", "none") or "none",
@@ -613,7 +613,7 @@ class StableSignerBackend(PluginBackendBase):
613
  if not gloss_tokens:
614
  return {"status": "error", "message": "Gloss string is empty after normalization."}
615
 
616
- fps = _safe_int(data.get("fps"), 30)
617
  width = _safe_int(data.get("width"), 512)
618
  height = _safe_int(data.get("height"), 512)
619
  smoothing_method = data.get("smoothing", "none") or "none"
 
519
  return {"status": "error", "message": "Gloss string is empty after normalization."}
520
 
521
  settings = {
522
+ "fps": _safe_int(data.get("fps"), 25),
523
  "width": _safe_int(data.get("width"), 512),
524
  "height": _safe_int(data.get("height"), 512),
525
  "smoothing_method": data.get("smoothing", "none") or "none",
 
613
  if not gloss_tokens:
614
  return {"status": "error", "message": "Gloss string is empty after normalization."}
615
 
616
+ fps = _safe_int(data.get("fps"), 25)
617
  width = _safe_int(data.get("width"), 512)
618
  height = _safe_int(data.get("height"), 512)
619
  smoothing_method = data.get("smoothing", "none") or "none"