bug, macOS, Apple Silicon
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- macos, python
- Lĩnh vực
- build-system, devops
Hướng nghiên cứu
Bắt đầu bằng việc xem xét cấu hình CI/CD để build wheel và các issue liên quan #429, #550 và #576, sau đó tái hiện lỗi của VideoWriter.write() bằng ví dụ Python được cung cấp và kiểm tra cv2.getBuildInformation(). Công việc được xem là hoàn tất khi các wheel macOS arm64 có FFmpeg tương thích được phát hành, để việc tái hiện thành công trên Apple Silicon.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Bug Report: VideoWriter.write() Fails Silently on macOS Apple Silicon
Target: https://github.com/opencv/opencv-python/issues
Environment
- Hardware: Apple M4 (reproducible on M1/M2/M3)
- OS: macOS 14.x Sonoma / 15.x Sequoia
- Architecture: arm64
- Python: 3.11.x
- opencv-python: 4.12.0 (installed via uv/pip from PyPI)
- Installation:
uv add opencv-pythonorpip install opencv-python
Description
cv2.VideoWriter.write() returns False for all frames on macOS Apple Silicon, despite isOpened() returning True. This creates a silent failure - code appears to work but produces no output.
Minimal Reproducible Example
import cv2
import numpy as np
# Create VideoWriter
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
writer = cv2.VideoWriter('test.mp4', fourcc, 30.0, (1920, 1080))
print(f"isOpened: {writer.isOpened()}") # True ✓
# Write single frame
frame = np.zeros((1080, 1920, 3), dtype=np.uint8)
success = writer.write(frame)
print(f"write() success: {success}") # False ✗
writer.release()
Output:
isOpened: True
write() success: False
Result: No video file created (or 0 bytes).
Codecs Tested (All Failed)
for codec in ['mp4v', 'avc1', 'XVID']:
fourcc = cv2.VideoWriter_fourcc(*codec)
writer = cv2.VideoWriter('test.mp4', fourcc, 30.0, (1920, 1080))
frame = np.zeros((1080, 1920, 3), dtype=np.uint8)
result = writer.write(frame) if writer.isOpened() else False
print(f"{codec}: isOpened={writer.isOpened()}, write={result}")
writer.release()
Output:
mp4v: isOpened=True, write=False
avc1: isOpened=True, write=False
XVID: isOpened=True, write=False
Root Cause
opencv-python wheels from PyPI contain FFmpeg binaries compiled for x86_64 (amd64) instead of arm64. On Apple Silicon:
- FFmpeg runs via Rosetta 2 translation
- Encoding operations fail silently
isOpened()succeeds butwrite()fails
Evidence:
- Roboflow blog confirms PyPI wheels install amd64 FFmpeg on M1: https://blog.roboflow.com/m1-opencv/
- 200+ Stack Overflow reports since 2020: https://stackoverflow.com/questions/10605163/opencv-videowriter-under-osx-producing-no-output
- Reproducible with both
pip installanduv add(both use PyPI wheels)
Expected Behavior
write() should return True and encode frames successfully, just like on x86_64 Macs or when using conda-forge opencv (which ships arm64 binaries).
Actual Behavior
write() returns False for every frame, producing no output.
Current Workaround
Using conda-forge instead of PyPI:
conda install -c conda-forge opencv
This works because conda-forge ships arm64-native opencv with compatible FFmpeg.
However:
- Breaks PyPI-based workflows (pip, uv, poetry)
- Adds conda dependency (conflicts with uv/pip lock files)
- Not viable for projects using uv or other modern Python package managers
Proposed Solution
Build and distribute arm64-native wheels for macOS Apple Silicon:
- Add macOS arm64 builder to CI/CD (GitHub Actions supports M1 runners)
- Compile FFmpeg with
--arch=arm64 - Publish platform-specific wheel:
opencv_python-X.X.X-cp311-cp311-macosx_12_0_arm64.whl
Precedent: numpy, pillow, and tensorflow already ship separate arm64 wheels for macOS.
Impact
Severity: High
Affected users:
- All macOS Apple Silicon users (M1/M2/M3/M4) installing from PyPI (pip, uv, poetry, etc.)
- Any application using VideoWriter (video export, CV pipelines, ML)
- Production systems relying on opencv-python for video processing
Why high severity:
- Silent failure (no error messages, difficult to debug)
- Blocks video processing on modern Macs (>50% of new Mac sales)
- Wastes compute (processing with no output)
- Affects all PyPI-based package managers (pip, uv, poetry, pipenv)
Related Issues
- #429 - General arm64 wheel support
- #550 - M1 native installation
- #576 - Architecture compatibility errors
This issue is VideoWriter-specific and warrants separate tracking.
System Information
# Verify architecture
$ uname -m
arm64
$ python -c "import platform; print(platform.machine())"
arm64
# OpenCV build info
$ python -c "import cv2; print(cv2.getBuildInformation())" | grep -A 10 "Video I/O"
Willingness to Contribute
I can:
- Test arm64 wheels when available
- Provide M4 hardware access for testing
- Document migration guide for users
Happy to help if maintainers need arm64 CI setup assistance.
Thank you for maintaining opencv-python! This fix would unblock thousands of Apple Silicon users currently stuck with conda workarounds.
- Ngôn ngữ chính
- Python
- Star
- 5.4k
- Fork
- 1k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của opencv/opencv-python
-
[DOC] README fileCó thể làm lại được @jadhavroshani713-sys đã nhận 75 ngày trước và không có pull request nào đang mở. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
opencv/opencv-python#1217 · 3 bình luận ·
-
Dependency specification missing for python3.14Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
opencv/opencv-python#1165 · 2 bình luận · 1 reaction ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
opencv/opencv-python#1276 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
opencv/opencv-python#1273 · 1 bình luận ·
-
FFMPEG v8.1.1 vulnerabilitiesĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
opencv/opencv-python#1272 · 2 bình luận ·
Tất cả issue của opencv/opencv-python
Issue tương tự
-
enhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Update Python support to 3.15Đang mởpython-version
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug javascript P2-medium python release:v3.1
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
adrirubio/claude-deck#546 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area: desktop area: website priority: P2 type: feature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
appandflow/stim#3411 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày