Skip to content

serrss/hls-ai-analyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HLS Analyzer via ChatGPT API 🚀

License Java Maven OpenAI

📌 Overview

HLS Analyzer is an open-source tool that fetches .m3u8 files (HLS playlists), sends them to ChatGPT, and receives analysis on stream integrity.
It follows RFC-8216 (HLS standard) to detect errors and anomalies in the playlist structure.

✨ Features

  • 📡 Downloads .m3u8 files dynamically from a given URL.
  • 🔍 Validates stream integrity using ChatGPT (GPT-3.5 Turbo).
  • 🛠️ Runs ffprobe on the .ts segment to verify stream properties.
  • Fast & Lightweight, built with Java + Maven.
  • 🔐 API Key Management via config.properties or environment variables.
  • 📖 Open Source under Apache License 2.0.

🏗️ Installation & Setup

1️⃣ Clone the Repository

git clone https://github.com/serrss/hls-ai-analyzer.git
cd hls-ai-analyzer

2️⃣ Ensure Java 17+ & Maven Installed

Check Java:

java -version

Check Maven:

mvn -version

⚠️ Java 17+ is required!

3️⃣ Set Up API Key

You must provide an OpenAI API key.

Option 1️⃣: Use config.properties

Create a file src/main/resources/config.properties:

openai.api.key=sk-your-api-key-here

⚠️ DO NOT commit this file! Add it to .gitignore.

Option 2️⃣: Use Environment Variable

export OPENAI_API_KEY="sk-your-api-key-here"

(For Windows: use set OPENAI_API_KEY="sk-your-api-key-here" in CMD.)

4️⃣ Install FFmpeg (Required for ffprobe)

The tool requires ffprobe to analyze .ts media files.

Install on macOS (via Homebrew):

brew install ffmpeg

Install on Ubuntu:

sudo apt update && sudo apt install ffmpeg

Install on Windows: Download from FFmpeg official site and add it to your system PATH.


🚀 Build & Run

1️⃣ Build the Project

mvn clean package

2️⃣ Run the Analyzer

java -jar target/hls-analyzer-1.0-SNAPSHOT.jar

🔍 Example Response from ChatGPT

✅ If the manifest is valid:

{"status": "OK", "message": "Manifest is correct"}

❌ If errors are found:

{"status": "FAIL", "message": "Segment duration mismatch at #EXTINF:10.5 (should be 10.0)"}

📜 License

This project is licensed under Apache License 2.0.
See LICENSE for details.


👨‍💻 Contributing

Contributions are welcome! 🎉 If you find a bug or have a feature request:

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

📬 Contact

👤 Author: Serhii Romanov
📧 Email: [email protected]
🌍 GitHub: serrss