import cv2

print("OpenCV版本:", cv2.__version__)
print("可用的视频编码器:")

# 打印常见编码器是否可用
try:
    fourcc = cv2.VideoWriter_fourcc(*"MP4V")
    print("MP4V (MPEG-4 Part 2)", "可用")
except Exception as e:
    print("MP4V (MPEG-4 Part 2)", "不可用:", e)

try:
    fourcc = cv2.VideoWriter_fourcc(*"avc1")
    print("avc1 (H.264)", "可用")
except Exception as e:
    print("avc1 (H.264)", "不可用:", e)

try:
    fourcc = cv2.VideoWriter_fourcc(*"DIVX")
    print("DIVX (DivX)", "可用")
except Exception as e:
    print("DIVX (DivX)", "不可用:", e)

try:
    fourcc = cv2.VideoWriter_fourcc(*"XVID")
    print("XVID (Xvid)", "可用")
except Exception as e:
    print("XVID (Xvid)", "不可用:", e)

try:
    fourcc = cv2.VideoWriter_fourcc(*"MJPG")
    print("MJPG (Motion JPEG)", "可用")
except Exception as e:
    print("MJPG (Motion JPEG)", "不可用:", e)
