Skip to main content

VideoSource

Brings data from a video source, decodes the frames and creates the metadata.

This module contains the video source. It is responsible for connecting to video sources, decoding the video, and creating the video frames. Frames are then attached to the metadata which is passed to the first element in the pipeline.

Along with the standard source paramters address, rate and type, there is one additional parameter:

If the source is fails to connect or is disconnected, the source will try to reconnect indefinitely.

There are three different types that the video source supports:

  • video: A video source that is a rtsp or http stream.
  • youtube: A video source that is a YouTube video.
  • file: A video source that is a local file.

Examples:

REST API:

WIP

Configuration File:

YouTube video:

source:
- address: https://youtu.be/jY86pXeTOLw
- type: youtube

RSTP video at 15 fps:

source:
- address: rtsp://camera:554/path
- type: video
- rate: 15

HTTPS video attempt to reconnect for 10 minutes:

source:
- address: https://camera:554/path
- type: video

Local file disable proxy:

source:
- address: /path/to/file.mp4
- type: file

VideoSource Objects

class VideoSource(SourceNode)

Brings data from a video source, decodes the frames and creates the metadata.

Attributes:

  • source_type str - The type of the video source.
  • source_address str - The address of the video source.
  • source_fps float - The frames per second of the video source.
  • source_gst str - The GStreamer pipeline to use.
  • proxy Optional[Tuple[ProxyManager, str]] - The proxy manager and the proxy name.

Examples:

source_url = "rtsp://camera:554/path"
gst_string = (
f"rtspsrc location={source_url} latency=0 buffer-mode=auto ! rtph264depay"
f" ! h264parse ! avdec_h264 ! videoconvert ! videorate "
f"! video/x-raw,framerate=30/1,format=RGB ! appsink sync=true"
)
vs = VideoSource("video", source_url, 30, gst_string, False)