Clarification on H264 support of included ffmpeg · Issue #682 · opencv/opencv-python · GitHub
Skip to content

Clarification on H264 support of included ffmpeg #682

Closed

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.

Activity

  1. changed the title [-]Clarification on H264 support of included ffmpeg build[/-] [+]Clarification on H264 support of included ffmpeg[/+] on Jun 23, 2022
  2. alalek commented on Jun 23, 2022

    @alalek
    Member

    FFmpeg has LGPL H264 builtin decoder. No problem is here.

    FFmpeg doesn't have builtin LGPL H264 encoder. But it can use external encoders, like x264 (GPL), OpenH264 (BSD), etc.
    On Windows OpenH264 is used (if available - downloaded by user from OpenH264 site).
    On Linux status @asenyaev could clarify.

  3. mdsmarte commented on Jun 28, 2022

    @mdsmarte
    Author

    Thank you for the clarification!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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