Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crash during encoding when using with cv2 [macOS] #89

Open
zhou13 opened this issue Mar 28, 2023 · 3 comments
Open

crash during encoding when using with cv2 [macOS] #89

zhou13 opened this issue Mar 28, 2023 · 3 comments
Labels
bug Something isn't working help wanted Extra attention is needed
Milestone

Comments

@zhou13
Copy link

zhou13 commented Mar 28, 2023

Describe the bug

This program will crash on my iMac:

Steps/Code to Reproduce

from PIL import Image
import cv2
from pillow_heif import register_heif_opener


register_heif_opener()

with Image.open("10003860486.jpg") as img:
    img.load()
img.save("2.heic")

Expected Results

No crash

Actual Results

    10739 segmentation fault 

I am on Mac. Note that if I remove the line import cv2, or if I move it after from pillow_heif import register_heif_opener, then the program runs normally.

Versions

{'version': {'libheif': '1.14.2', 'x265': 'x265 HEVC encoder (3.4+31-6722fce1f)', 'aom': 'AOMedia Project AV1 Encoder 3.5.0'}, 'decoders': {'HEVC': 1, 'AV1': 1, 'AVC': 0}, 'encoders': {'HEVC': 1, 'AV1': 1, 'AVC': 0}}
@bigcat88 bigcat88 added bug Something isn't working good issue That's an interesting thing... labels Mar 28, 2023
@bigcat88
Copy link
Owner

bigcat88 commented Mar 28, 2023

WOW o_0... Thanks for the issue.

@bigcat88 bigcat88 changed the title pillow-heif crashes when using with cv2 crash during encoding when using with cv2 Mar 29, 2023
@bigcat88
Copy link
Owner

bigcat88 commented Apr 1, 2023

Exception occurs in x265 library, somewhere near x265::Search::codeIntraLumaQT. Looks like the only way to understand is to build all libraries in debug mode and trace with Xcode - will try to do that when will have time for this.

Affected only arm64 build for Apple and affected all versions(tested down to 0.8.0).
Linux, Windows, macOS Intel - works fine.

@bigcat88 bigcat88 added this to the 1.0.0 milestone Apr 3, 2023
@bigcat88 bigcat88 added help wanted Extra attention is needed and removed good issue That's an interesting thing... labels Apr 27, 2023
@bigcat88 bigcat88 changed the title crash during encoding when using with cv2 crash during encoding when using with cv2 [macOS] Jul 3, 2023
bigcat88 added a commit that referenced this issue Jul 16, 2023
Signed-off-by: Alexander Piskun <[email protected]>
@wmcnally
Copy link

Same issue! Any progress?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants