www

RTAP – Real-Time Annotation Protocol

RTAP

rtsp://localhost:8554/stream

Overview

RTAP is a system for handling and processing live video streams over RTSP/RTMP. The project comprises a server that manages video stream ingestion, conversion, and distribution (via WebSocket) as well as client-side utilities. It integrates FFmpeg for media processing and uses Node.js with Express and WebSocket for stream handling and performance monitoring.

Project Purpose

RTAP is designed to:

Project Components

1. Server (server.js, rtspHandler.js)

2. Client (located in test2/ and webm/)

3. FFmpeg Integration

4. Logging and Monitoring

Installation and Setup

Prerequisites:

Steps to Install:

  1. Clone the Repository:
    git clone https://github.com/rtap/www.git
    
  2. Navigate to the project folder:
    cd www
    
  3. Install dependencies:
    npm install
    
  4. Configure environment (optional):
    • Copy the example .env file and adjust settings as needed:
      cp .env.example .env
      
    • Adjust port and other parameters if necessary

Running the Server:

Usage

Generating Test Streams

The project includes scripts to generate test streams that can be used for development and testing:

  1. RTSP Stream Setup:
    • Quick Start (Automated):
      ./start_rtsp_stream.sh
      

      This script automatically installs the RTSP server if needed, starts it, and generates a test pattern stream at rtsp://localhost:8554/stream.

    • Manual Setup:
      • Install and configure the RTSP server:
        ./install_rtsp_server.sh
        
      • Start the RTSP server:
        mediamtx
        
      • In a separate terminal, generate the RTSP stream:
        ./generate_rtsp_stream.sh
        

        This interactive script allows you to choose between a test pattern, a video file, or a webcam as the stream source.

  2. RTMP/HLS Stream Generation:
    ./generate_stream.sh
    

    This versatile script allows you to:

    • Generate either RTMP or HLS streams
    • Choose between test patterns, video files, or webcam as sources
    • Stream directly to the server for processing

    The script provides interactive prompts to select your preferred stream type and source.

  3. Testing Streams:
    • For RTSP streams:
      ffplay rtsp://localhost:8554/stream
      
    • For RTMP streams:
      ffplay rtmp://localhost:1935/live/stream
      
    • For HLS streams:
      ffplay http://localhost:8080/hls/stream.m3u8
      

    You can also connect to these streams using the RTAP server by configuring the appropriate URL in your client application.

Configuration

Planned Improvements

The project roadmap calls for these enhancements:

1. Code Modularization:

2. Enhanced Error Handling:

3. Code Documentation:

4. Security Enhancements:

5. Testing:

6. Resource and Process Management:

7. Monitoring and Alerting:

Contributing

Contributions are welcome! Please feel free to open issues or submit pull requests for improvements, new features, or bug fixes. Ensure that you follow code documentation standards (using JSDoc where applicable) and adapt tests to cover any code changes.

Security and Dependency Management

To ensure the security of the application:

  1. Regularly update dependencies:
    npm update
    
  2. Check for vulnerabilities:
    npm audit
    
  3. Fix vulnerabilities when found:
    npm audit fix
    
  4. For vulnerabilities that cannot be fixed automatically:
    npm audit fix --force
    

    Note: Use --force with caution as it may introduce breaking changes.

The project is regularly maintained to address security vulnerabilities in dependencies.

License

This project is licensed under the ISC License. See the LICENSE file for details.