test-rtechs commited on
Commit
f209a53
·
verified ·
1 Parent(s): 7240c78

Update app_rvc.py

Browse files
Files changed (1) hide show
  1. app_rvc.py +11 -4
app_rvc.py CHANGED
@@ -311,12 +311,19 @@ def download_and_adjust_youtube_video(url, speed_factor, start_time=None, end_ti
311
 
312
  # Get the original fps, or use a default value if it's None
313
  fps = video.fps
314
- if fps is None:
315
- fps = 30 # Default to 30 fps if the original fps is not available
316
- logger.warning(f"Original video FPS not detected. Using default value of {fps}")
 
 
 
317
 
318
  # Write the adjusted video
319
- adjusted_video.write_videofile(output_filename, fps=fps)
 
 
 
 
320
 
321
  # Close the video objects
322
  video.close()
 
311
 
312
  # Get the original fps, or use a default value if it's None
313
  fps = video.fps
314
+ if fps is None or fps <= 0:
315
+ fps = 30 # Default to 30 fps if the original fps is not available or invalid
316
+ logger.warning(f"Original video FPS not detected or invalid. Using default value of {fps}")
317
+
318
+ # Ensure fps is a float
319
+ fps = float(fps)
320
 
321
  # Write the adjusted video
322
+ try:
323
+ adjusted_video.write_videofile(output_filename, fps=fps)
324
+ except Exception as e:
325
+ logger.error(f"Error writing video file: {str(e)}")
326
+ raise
327
 
328
  # Close the video objects
329
  video.close()