Skip to content

A professional web-based solution for creating SCTE-35 cues and injecting them into live video streams. Built with modern web technologies for broadcast and streaming professionals.

License

Notifications You must be signed in to change notification settings

shihan84/SCTE-35-Encoder-Stream-Injector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎬 SCTE-35 Stream Injector

A professional-grade SCTE-35 stream injection system with real-time monitoring, pre-roll support, and enterprise features for broadcast and streaming applications.

✨ Features

  • 🎯 SCTE-35 Injection: Real-time SCTE-35 message injection into live streams
  • πŸ“‘ HLS to SRT: Convert HLS input streams to SRT output with SCTE-35 support
  • 🎬 Pre-Roll Support: Seamless pre-roll advertisement integration
  • ⏰ Time Synchronization: NTP-based time sync for precise injection timing
  • πŸ“Š Visual Timeline: Real-time event monitoring and timeline visualization
  • πŸ–₯️ Professional Dashboard: Modern web interface for stream management
  • πŸ”§ FFmpeg Integration: Advanced FFmpeg command builder and execution
  • πŸ“± Responsive Design: Works on desktop, tablet, and mobile devices

πŸš€ Quick Start

Prerequisites

  • Node.js 18+
  • FFmpeg with SCTE-35 support
  • Windows 10/11, macOS 10.15+, or Linux Ubuntu 20.04+

Installation

# Clone the repository
git clone https://github.com/shihan84/scte-final.git
cd scte-final

# Install dependencies
npm install

# Start the development server
npm run dev

Visit http://localhost:3000 to access the dashboard.

Quick Test

# Linux/macOS
./examples/quick-start.sh check

# Windows PowerShell
.\examples\quick-start.ps1 check

πŸ“– Usage

Basic HLS to SRT Streaming

ffmpeg -i "https://cdn.itassist.one/BREAKING/NEWS/index.m3u8" \
  -f mpegts \
  -metadata service_name="News Channel" \
  -c:v copy -c:a copy \
  "srt://itassist.one:8888?streamid=#!::r=live/live,m=publish"

Pre-Roll Advertisement

ffmpeg -i "preroll.mp4" -i "main-stream.m3u8" \
  -filter_complex "[0:v][0:a][1:v][1:a]concat=n=2:v=1:a=1[v][a]" \
  -map "[v]" -map "[a]" -f mpegts -metadata scte35_out=30 \
  -c:v libx264 -preset fast -crf 23 -c:a aac -b:a 128k \
  "srt://server.com:8888?streamid=live/preroll,m=publish"

SCTE-35 Injection

ffmpeg -i "input.m3u8" \
  -f mpegts \
  -metadata scte35_splice_insert="0xFC301100000000000000FFFFFFFF0000004F1A2EFA" \
  -c:v copy -c:a copy \
  "srt://output.com:8888?streamid=live/splice,m=publish"

πŸŽ›οΈ Dashboard Features

Stream Setup

  • Input Configuration: HLS stream URL setup
  • Output Configuration: SRT destination configuration
  • Quality Settings: Resolution and bitrate selection
  • Audio Settings: Audio encoding configuration

SCTE-35 Tools

  • Message Builder: Create custom SCTE-35 messages
  • Cue Types: Splice insert, time signal, and more
  • Timing Control: Precise injection timing
  • Validation: Message format verification

Injection Points

  • Time-based Injection: Schedule injection points
  • Pre-Roll Setup: Configure pre-roll content
  • Duration Control: Set ad break duration
  • Real-time Monitoring: Live injection status

Live Monitor

  • Stream Status: Real-time stream health
  • Performance Metrics: Latency, bitrate, quality
  • Error Tracking: Connection and encoding errors
  • Timeline Visualization: Event timeline with zoom controls

Advanced Features

  • FFmpeg Command Builder: Visual command construction
  • Time Synchronization: NTP-based time sync
  • Hardware Acceleration: GPU acceleration support
  • Multi-Quality Output: Adaptive bitrate streaming

πŸ”§ API Usage

Start Stream

curl -X POST http://localhost:3000/api/stream/start \
  -H "Content-Type: application/json" \
  -d '{
    "input": "https://cdn.itassist.one/BREAKING/NEWS/index.m3u8",
    "output": "srt://itassist.one:8888?streamid=#!::r=live/live,m=publish",
    "preRoll": {
      "enabled": true,
      "url": "https://cdn.example.com/ad.mp4",
      "duration": 30
    }
  }'

Inject SCTE-35

curl -X POST http://localhost:3000/api/stream/inject \
  -H "Content-Type: application/json" \
  -d '{
    "message": "0xFC301100000000000000FFFFFFFF0000004F1A2EFA",
    "timestamp": "2024-09-10T12:00:00Z",
    "duration": 30
  }'

Get Stream Status

curl http://localhost:3000/api/stream/status

πŸ“š Configuration Examples

See examples/hls-to-srt-preroll.json for comprehensive configuration examples including:

  • Basic HLS to SRT streaming
  • Pre-roll advertisement setup
  • Live news with ad insertion
  • Sports with highlights
  • Educational content with chapters
  • Multi-quality adaptive streaming

πŸ› οΈ Development

Project Structure

src/
β”œβ”€β”€ app/                    # Next.js app directory
β”‚   β”œβ”€β”€ api/               # API routes
β”‚   β”œβ”€β”€ stream-injection/  # Main dashboard
β”‚   β”œβ”€β”€ scte35-tools/     # SCTE-35 tools
β”‚   └── monitor/          # Stream monitoring
β”œβ”€β”€ components/            # React components
β”‚   β”œβ”€β”€ time-sync-clock.tsx
β”‚   β”œβ”€β”€ timeline-monitor.tsx
β”‚   └── ffmpeg-command-builder.tsx
└── lib/                  # Utility functions

Available Scripts

npm run dev          # Start development server
npm run build        # Build for production
npm run start        # Start production server
npm run lint         # Run ESLint
npm run type-check   # Run TypeScript checks

πŸ”’ Security

  • Input Validation: All inputs are validated and sanitized
  • Command Injection Protection: FFmpeg commands are safely constructed
  • Rate Limiting: API endpoints have rate limiting
  • CORS Configuration: Proper CORS headers for cross-origin requests

πŸ“Š Performance

  • Hardware Acceleration: NVIDIA CUDA, Intel Quick Sync support
  • Low Latency: Optimized for real-time streaming
  • Memory Efficient: Stream processing with minimal memory usage
  • Scalable: Supports multiple concurrent streams

πŸ› Troubleshooting

Common Issues

  1. Stream not starting: Check FFmpeg installation and stream URL accessibility
  2. SCTE-35 not injecting: Verify message format and stream compatibility
  3. Pre-roll not playing: Ensure media file is accessible and properly formatted
  4. SRT connection failed: Check network connectivity and firewall settings

Debug Commands

# Test HLS input
ffprobe "https://cdn.itassist.one/BREAKING/NEWS/index.m3u8"

# Test SRT output
ffmpeg -f lavfi -i testsrc=size=1280x720:rate=25 -t 10 \
  -c:v libx264 -f mpegts "srt://server.com:8888?streamid=test,m=publish"

# Validate SCTE-35 message
echo "0xFC301100000000000000FFFFFFFF0000004F1A2EFA" | xxd -r -p | hexdump -C

πŸ“„ License

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

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“ž Support

πŸ™ Acknowledgments

  • FFmpeg for multimedia processing capabilities
  • Next.js for the React framework
  • Tailwind CSS for styling
  • Lucide React for icons
  • SuperKabuki for SCTE-35 FFmpeg patches

Made with ❀️ for the broadcast and streaming community

About

A professional web-based solution for creating SCTE-35 cues and injecting them into live video streams. Built with modern web technologies for broadcast and streaming professionals.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors