Skip to main content

Capture video stream, save as screenshots.

Project description

Capture video stream, save as screenshots.

Installation

You can install from pypi

pip install -U capture_stream

Usage

As a Module

>>> import capture_stream
>>> help(capture_stream)

Help on package capture_stream:

NAME
    capture_stream - # encoding: utf-8

PACKAGE CONTENTS
    __main__

FUNCTIONS
    cv_capture(url: str, start: int = 0, stop: None | int = None, step: int = 1, prefix: str = 'frame_', dir_to_save: str = '')
         url 读取视频流保存图片到本地jpg 图片格式
        
        :param url: 视频链接
        :param start: 开始索引 0 开始编号
        :param stop:  结束索引不含此帧),如果 stop  None 则到视频结束
        :param step:  索引递增步长
        :param prefix: 文件名会被保存为 f"{prefix}{frame_number}.jpg"frame_number 是帧的索引序号
        :param dir_to_save: 把生成的 jpg 保存到此目录默认是当前工作目录
        
        从第 start 帧开始到第 stop 帧结束 step 帧递增
            - 如果 step <= 0只截取 start 那一帧
            - 如果 stop  None则从 start 到视频结束
            - 否则跳过此视频
    
    cv_capture_iter(url: str, start: int = 0, stop: None | int = None, step: int = 1) -> collections.abc.Iterator[tuple[int, numpy.ndarray]]
         url 读取视频流返回帧的迭代器
        
        :param url: 视频链接
        :param start: 开始索引 0 开始编号
        :param stop:  结束索引不含此帧),如果 stop  None 则到视频结束
        :param step:  索引递增步长
        
        :return: (帧索引序号, 图片数据) 的元组的迭代器
        
        从第 start 帧开始到第 stop 帧结束 step 帧递增
            - 如果 step <= 0只截取 start 那一帧
            - 如果 stop  None则从 start 到视频结束
            - 否则跳过此视频

DATA
    __all__ = ['cv_capture_iter', 'cv_capture']

VERSION
    (0, 0, 1)

AUTHOR
    ChenyangGao <https://chenyanggao.github.io>

FILE
    /path/to/capture_stream/__init__.py

As a Command Line

You can use this module to capture screenshots for video steam.

$ capture_stream -h
usage: capture_stream [-h] [-s START] [-t STOP] [-st STEP] [-p PREFIX] [-d DIR_TO_SAVE] [-v] url

从 url 读取视频流,为某些帧截图

positional arguments:
  url                   视频的 url

options:
  -h, --help            show this help message and exit
  -s START, --start START
                        开始帧的索引,从 0 开始编号,默认值:0
  -t STOP, --stop STOP  结束帧的索引(不含),默认为到视频结束
  -st STEP, --step STEP
                        帧的索引递增步长,如果小于等于 0 则只截取 start 那一帧,默认值:1
  -p PREFIX, --prefix PREFIX
                        生成图片的名称的前缀,文件名会被保存为 f'{prefix}{frame_number}.jpg',frame_number 是帧的索引序号,默认无前缀
  -d DIR_TO_SAVE, --dir-to-save DIR_TO_SAVE
                        把生成的 jpg 保存到此目录,默认值:当前工作目录
  -v, --version         输出版本号

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

capture_stream-0.0.1.3.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

capture_stream-0.0.1.3-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file capture_stream-0.0.1.3.tar.gz.

File metadata

  • Download URL: capture_stream-0.0.1.3.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.0 CPython/3.11.8 Darwin/23.5.0

File hashes

Hashes for capture_stream-0.0.1.3.tar.gz
Algorithm Hash digest
SHA256 7ab639553dd90fc836ff44d003ab46529b5ded29b90139d14e4c156d26f35b36
MD5 68d2a573901cc14b4480d638a8a325c2
BLAKE2b-256 5fa7bad3eb0629d87df55c7cad593f5a0a80b9a1142c270aa2fe8f22328ca8fa

See more details on using hashes here.

File details

Details for the file capture_stream-0.0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for capture_stream-0.0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 937e1f43abf5411e8e1dc50a032c42e3982897cad4bdd1ba1476533a695b5c76
MD5 a2b4ab1ab8f372e8fafaa5b57f1a5daf
BLAKE2b-256 97d41a176ae48eef057cbbf6ae19afb8c8757ab6b4249ceb4e3b6c7773f8af45

See more details on using hashes here.

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