platypush.plugins.camera.ffmpeg

class platypush.plugins.camera.ffmpeg.CameraFfmpegPlugin(device: Optional[str] = '/dev/video0', input_format: str = 'v4l2', ffmpeg_args: Tuple[str] = (), **opts)[source]

Plugin to interact with a camera over FFmpeg.

Requires:

  • ffmpeg package installed on the system.

__init__(device: Optional[str] = '/dev/video0', input_format: str = 'v4l2', ffmpeg_args: Tuple[str] = (), **opts)[source]
Parameters
  • device – Path to the camera device (default: /dev/video0).

  • input_format – FFmpeg input format for the the camera device (default: v4l2).

  • ffmpeg_args – Extra options to be passed to the FFmpeg executable.

  • opts – Camera options - see constructor of platypush.plugins.camera.CameraPlugin.

capture_frame(camera: platypush.plugins.camera.ffmpeg.model.FFmpegCamera, *args, **kwargs)Optional[PIL.Image.Image][source]

Capture a frame from a device using the plugin-specific logic - to be implemented by the derived classes.

Parameters

device – An initialized platypush.plugins.camera.Camera object.

prepare_device(camera: platypush.plugins.camera.ffmpeg.model.FFmpegCamera)subprocess.Popen[source]

Prepare a device using the plugin-specific logic - to be implemented by the derived classes.

Parameters

device – An initialized platypush.plugins.camera.Camera object.

release_device(camera: platypush.plugins.camera.ffmpeg.model.FFmpegCamera)[source]

Release a device using the plugin-specific logic - to be implemented by the derived classes.

Parameters

device – An initialized platypush.plugins.camera.Camera object.

start_camera(camera: platypush.plugins.camera.ffmpeg.model.FFmpegCamera, preview: bool = False, *args, **kwargs)[source]

Start a camera capture session.

Parameters
wait_capture(camera: platypush.plugins.camera.ffmpeg.model.FFmpegCamera)None[source]

Wait until a capture session terminates.

Parameters

camera – Camera object. camera.info.capture_timeout is used as a capture thread termination timeout if set.