CosmickVisions commited on
Commit
006d136
·
verified ·
1 Parent(s): 806d7f2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -725,15 +725,15 @@ def process_video_file(video_file, analysis_types):
725
 
726
  # Create video writer with higher quality settings
727
  try:
728
- # First try H.264 codec (most widely compatible)
729
- if cv2.__version__.startswith('4'):
730
- fourcc = cv2.VideoWriter_fourcc(*'avc1') # H.264 codec
731
- else:
732
- # Fallback to older codec naming
733
- fourcc = cv2.VideoWriter_fourcc(*'H264')
734
  except Exception:
735
- # If H.264 isn't available, fall back to MP4V
736
- fourcc = cv2.VideoWriter_fourcc(*'mp4v')
 
 
 
 
737
  out = cv2.VideoWriter(output_path, fourcc, output_fps, (width, height), isColor=True)
738
 
739
  # Process every Nth frame to reduce API calls but increase from 10 to 5 for more detail
 
725
 
726
  # Create video writer with higher quality settings
727
  try:
728
+ # Try XVID first (widely available)
729
+ fourcc = cv2.VideoWriter_fourcc(*'XVID')
 
 
 
 
730
  except Exception:
731
+ # If that fails, try Motion JPEG
732
+ try:
733
+ fourcc = cv2.VideoWriter_fourcc(*'MJPG')
734
+ except Exception:
735
+ # Last resort - use uncompressed
736
+ fourcc = cv2.VideoWriter_fourcc(*'DIB ') # Uncompressed RGB
737
  out = cv2.VideoWriter(output_path, fourcc, output_fps, (width, height), isColor=True)
738
 
739
  # Process every Nth frame to reduce API calls but increase from 10 to 5 for more detail