Skip to content

Clarification on H264 support of included ffmpeg #682

@mdsmarte

Description

@mdsmarte

The repo README states that the wheels of opencv-python include an ffmpeg licensed under LGPL. This implies that the included ffmpeg will not be able to read H264 videos, since this would require ffmpeg to be distributed under GPL (x264).

However, after installing opencv-python-headless version 4.3.0.38 from pip into a fresh python 3.8 environment, I am able to read video frames from an H264 encoded video:

>>> import cv2
>>> cap = cv2.VideoCapture("video.mp4")  # H264 encoded video
>>> cap.isOpened()
True
>>> cap.getBackendName()
'FFMPEG'
>>> cap.read()
(True, array([[[33, 33, 33],
        [33, 33, 33],
        [33, 33, 33],
        ...

Verified this works on Mac and Linux (have not tried Windows). Note that I do not have the OpenH264 library installed separately.

Any ideas on this discrepancy? I would have expected the above snippet to fail, if the included ffmpeg is LGPL.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions