c++/c/python wrapper for
- FFmpeg library
- Galaxy driver used in Daheng cameras
- pylon driver used in Basler cameras
- iDatum driver used in contrastech and visiondatum cameras
apt install libavcodec-dev libavdevice-dev libavformat-dev libswscale-dev.
Set FFMPEG_DIR environment variable when setting custom ffmpeg directory. See Findffmpeg.cmake
uri = 'test/big_buck_bunny_480p_1mb.mp4'
uri = 'https://example.com/hls/stream.m3u8'See all supported protocols by running
ffmpeg -protocolsDownload galaxy SDK. Then set GALAXY_DIR environment variable to the SDK directory.
See Findgalaxy.cmake for exact logic of finding galaxy SDK.
uri = 'galaxy://192.168.0.13'Download pylon SDK. Then set PYLON_DIR environment variable to the SDK directory. See Findpylon.cmake for exact logic of finding pylon SDK.
uri = 'pylon://'Download iDatum SDK. Then set IDATUM_DIR environment variable to the SDK directory. See Findidatum.cmake for exact logic of finding iDatum SDK.
uri = 'idatum://192.168.0.13'
uri = 'idatum://usb_name'pip install -v git+https://github.com/Visillect/videoreader
When the SDKs aren't in default locations, the user can specify directories explicitly:
FFMPEG_DIR=... GALAXY_DIR=... PYLON_DIR=... IDATUM_DIR=... pip install git+https://github.com/Visillect/videoreader
from videoreader.numpy import VideoReaderNumpy as VideoReader
uri = 'test/big_buck_bunny_480p_1mb.mp4'
reader = VideoReader(uri, extras=["pkt_dts", "pts"])
for image, number, timestamp, extras in reader:
print(f"{image.shape} {image.dtype} {number}, {timestamp:g}, {extras}")from videoreader.numpy import VideoWriterNumpy as VideoWriter
writer = VideoWriter(
'out.mkv', 640, 480, arguments=[], log_callback=print, realtime=True
)
for image, number, timestamp, extras in reader:
ret = writer.push(image, timestamp)
if not ret:
print(f"skipping frame {number}!")