pyav

How to listen to and decode an RTMP video stream with Python

How to listen to and decode an RTMP video stream with Python Question: How can I listen to and decode an RTMP video stream with Python? Such as with the ffmpeg command ffmpeg -listen 1 -i rtmp://localhost:1935/live/app I tried this: import av container = av.open(‘rtmp://localhost:1935/live/app’,listen=True) for frame in container.decode(video=0): frame = frame.to_ndarray(format=’bgr24′) …do some thing …

Total answers: 1

Creating video from images using PyAV

Creating video from images using PyAV Question: I am trying to write a function that creates a new MP4 video from a set of frames taken from another video. The frames will be given in PIL.Image format and is often cropped to include only a part of the input video, but all images will have …

Total answers: 1

Can't show image with opencv when importing av

Can't show image with opencv when importing av Question: When importing the PyAv module, I am unable to show an image with opencv using imshow() Code without the PyAv module (works as expected) import cv2 img = cv2.imread("test_image.jpeg") cv2.imshow(‘image’, img) cv2.waitKey(0) Code with the import (doesn’t work, just hangs) import cv2 import av img = …

Total answers: 2

Reading a video directly into Numpy with PyAV (no iterations)

Reading a video directly into Numpy with PyAV (no iterations) Question: Is it possible to read a video directly into a 3D Numpy with PyAV? Currently, I am looping through each frame: i = 0 container = av.open(‘myvideo.avi’) for frame in container.decode(video=0): if i == 0: V = np.array(frame.to_ndarray(format=’gray’)) else: V = np.dstack((V, np.array(frame.to_ndarray(format=’gray’)))) i …

Total answers: 1