Metadata-Version: 2.4
Name: cv-stream-recorder
Version: 0.1.1
Summary: Record video stream and save it to consecutive chunks
Author-email: DX FutureTech VN <hung.ly@dxfuturetech.com.vn>
License: MIT License
        
        Copyright (c) 2026 DX FutureTech VN
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://gitlab.aurora-tech.com/automation/cv-stream-recorder
Project-URL: Bug Tracker, https://gitlab.aurora-tech.com/automation/cv-stream-recorder/-/issues
Keywords: video,stream,recorder
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.13
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: ffmpeg-python>=0.2.0
Requires-Dist: pydantic-settings>=2.12.0
Dynamic: license-file

# 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**:
    ```bash
    pip install cv-stream-recorder
    ```

## Usage

Import the module and use it in your code:

```python
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](LICENSE) file for details.
