Created
August 9, 2018 14:22
-
-
Save aleksandergurin/71b8db332c89efb4aa84d3ef313af44c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import av | |
def extract_first_frame(): | |
it = iter(av.open('../video.mp4').decode(video=0)) | |
video_frame = next(it).reformat(width=640, height=480, format='rgb24') # av.video.frame.VideoFrame instance | |
# From VideoFrame you can obtain PIL.Image, numpy array etc. | |
rgb24_image = video_frame.to_image() # PIL.Image instance | |
rgb24_image.show() # show image |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment