updated scene_cutter.py

This commit is contained in:
2025-07-20 10:09:11 +02:00
parent a71a07e2d2
commit 58a9c8ce3b

View File

@@ -91,13 +91,18 @@ def detect_crop(video_path, hwaccel=None):
process.wait()
if last_crop_line:
# Extract the crop filter part, e.g., "crop=1920:800:0:140"
crop_filter = last_crop_line.split('] ')[-1]
print(f"Crop detection finished. Recommended filter: {crop_filter}")
return crop_filter
else:
print("Could not determine crop. No black bars detected or an error occurred.")
return None
# Find the 'crop=' part in the line and extract it
crop_part_index = last_crop_line.find('crop=')
if crop_part_index != -1:
# Extract the substring starting from 'crop='
crop_filter = last_crop_line[crop_part_index:]
# In case there's other info on the line, split by space and take the first part
crop_filter = crop_filter.split(' ')[0]
print(f"Crop detection finished. Recommended filter: {crop_filter}")
return crop_filter
print("Could not determine crop. No black bars detected or an error occurred.")
return None
except (FileNotFoundError, Exception) as e:
print(f"\nAn error occurred during crop detection: {e}")