Introduction

Introduction to ew-npvr

Overview

The service ew-npvr is a Network Personal Video Recorder (NPVR) solution that enables the management and streaming of recorded content. It provides a complete system for handling personal video recordings with reduced storage usage by reusing duplicated segments.

ew-npvr is designed to integrate with AgileTV Origin’s live ingest channels and provides capabilities for recording, storing, and streaming content to repackager.

Key Features

  • Content Management: RESTful API for managing NPVR recordings with CRUD operations
  • Streaming Service: Provides media streaming capabilities for recorded content
  • Channel Integration: Integrates with live ingest channels (ESB3003) for recording management
  • Thumbnail Generation: Automatic thumbnail generation for recorded content using OpenCV
  • Flexible Storage: Configurable storage locations with support for copy or hard-link behavior
  • Optional Database: PostgreSQL-backed metadata storage (optional - media streaming works without database)
  • Cursor-based Pagination: Efficient pagination for listing large numbers of recordings
  • Swagger Documentation: Interactive API documentation available at /swagger/
  • Rate Limiting: Configurable write rate limiting for file copy operations
  • Graceful Degradation: Media API continues to function even if database is unavailable

Architecture

ew-npvr consists of several key components:

  1. Management API: RESTful administrative interface for managing recordings (default port: 8099)
    • CRUD operations for NPVR entries
    • Health check endpoint
    • Swagger UI for API documentation
  2. Media API: Streaming interface for delivering recorded content (default: Unix socket)
    • Segment delivery
    • Content information retrieval
    • Segment timing information
  3. Job Controller: Manages recording jobs and channel synchronization
  4. Content Info Cache: High-performance in-memory caching layer for content metadata
  5. Database Layer: Optional PostgreSQL storage for recording metadata and state
  6. Channel Manager: Handles communication with live ingest channels via Unix socket

Recording States

NPVR entries progress through various states:

  • pending: Recording request created, waiting to start
  • ongoing: Recording is actively in progress
  • done: Recording completed successfully
  • error: Recording encountered an error
  • deleting: Entry is being deleted
  • updating: Entry metadata is being updated
  • update-ongoing: Update is in progress

Use Cases

  • Recording live channels for time-shifted viewing
  • Personal video library management
  • Catch-up TV services
  • Content archival and replay
  • Cloud DVR services