Skip to main content

Record video stream and save it to consecutive chunks

Project description

CV Stream Recorder

A Python tool to record video streams and save them into consecutive chunks using FFmpeg.

Description

cv-stream-recorder connects to a video stream URL (e.g., HLS .m3u8) and records the content into segmented MP4 files. This is useful for capturing live streams for later processing or analysis.

Features

  • Records live video streams.
  • Segments output into consecutive files (e.g., chunk_000.mp4, chunk_001.mp4).
  • Stream copy mode (no transcoding) for minimal CPU usage.
  • Configurable segment time and total duration.

Requirements

  • Python >= 3.13
  • FFmpeg installed on your system
  • ffmpeg-python library

Installation

  1. Install FFmpeg: Ensure ffmpeg is installed and available in your system's PATH.

  2. Install the package:

    pip install cv-stream-recorder
    

Usage

Import the module and use it in your code:

import asyncio
from cv_stream_recorder import record_stream


def done(path):
    print("Chunk saved to:", path)

async def main():
    url = "http://example.com/stream.m3u8"
    folder_path = "/path/to/output"

    await record_stream(url, folder_path, done)

if __name__ == "__main__":
    asyncio.run(main())

By default, it will:

  1. Connect to the configured stream URL.
  2. Start recording.
  3. Save files as chunk_000.mp4, chunk_001.mp4, etc., in the target directory.
  4. Stop after 180 seconds (can be changed)

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

cv_stream_recorder-0.1.1.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cv_stream_recorder-0.1.1-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file cv_stream_recorder-0.1.1.tar.gz.

File metadata

  • Download URL: cv_stream_recorder-0.1.1.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.2

File hashes

Hashes for cv_stream_recorder-0.1.1.tar.gz
Algorithm Hash digest
SHA256 01f74a42290fccc53af19d02d1835f8ea8ce518115ee73a0fc5b01f34d36d772
MD5 9bdaa86facd05b7ebcb7b3e36c3b6648
BLAKE2b-256 0c8e532b767e21b5c0edc664b84c9da7ebe270cb1796763ebee359b515c5fd41

See more details on using hashes here.

File details

Details for the file cv_stream_recorder-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for cv_stream_recorder-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bcbfa856ef9c38ce8bdbb70b84c127d9870728d434d880fc54b5b18849f82939
MD5 b2d06e900d6db4a6f6db79e25817e2a7
BLAKE2b-256 74aa3b28f87e230f4a000d7d6e2d5c3f8f3c617dfc64412b5e48230d355339c2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page