File: camera.py

package info (click to toggle)
ha-ffmpeg 3.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 184 kB
  • sloc: python: 625; makefile: 2
file content (24 lines) | stat: -rw-r--r-- 608 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
"""For HA camera components."""
from typing import Coroutine, Optional

from .core import HAFFmpeg


class CameraMjpeg(HAFFmpeg):
    """Implement a camera they convert video stream to MJPEG."""

    def open_camera(
        self, input_source: str, extra_cmd: Optional[str] = None
    ) -> Coroutine:
        """Open FFmpeg process as mjpeg video stream.

        Return A coroutine.
        """
        command = ["-an", "-c:v", "mjpeg"]

        return self.open(
            cmd=command,
            input_source=input_source,
            output="-f mpjpeg -",
            extra_cmd=extra_cmd,
        )