Skip to main content

ffmpeg stream to numpy arrays

Project description

ffmpeg stream to numpy arrays

# ffmpeg must be installed! 

$pip install ffmpeg-stream-to-numpy
from ffmpeg_stream_to_numpy import NumpyVideo
import cv2 
vi = NumpyVideo(
    videofile=r"C:\Users\Gamer\Videos\dfbs4.mp4",
    ffmpeg_param=(
        "-re", # real speed
        "-hwaccel",
        "cuda",
        "-c:v",
        "h264_cuvid",
    ),
)

for ini, i in enumerate(vi.play_video_ffmpeg()):
    # do something here 
    cv2.imshow("test", i)
    if cv2.waitKey(1) & 0xFF == ord("q"):
        break
    if ini == 100:
        vi.playvideo = False # stops the stream
cv2.destroyAllWindows()

    

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ffmpeg_stream_to_numpy-0.10.tar.gz (3.8 kB view hashes)

Uploaded Source

Built Distribution

ffmpeg_stream_to_numpy-0.10-py3-none-any.whl (5.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page