Files
vizionStreamer/scripts/README.md
2025-12-19 09:56:03 +01:00

155 lines
3.4 KiB
Markdown

# VizionStreamer Control Scripts
Diese Scripts ermöglichen die schnelle Steuerung von VizionStreamer über die Unix Domain Socket API.
**Copyright (c) 2025 Maik Jurischka**
Lizenziert unter CC BY-NC-SA 4.0 - https://creativecommons.org/licenses/by-nc-sa/4.0/
## Voraussetzung
VizionStreamer muss laufen:
```bash
cd /home/maik/CLionProjects/vizionStreamer
./build/vizionStreamer
```
## Schnellstart (Standard-Pipeline)
Die Standard-Pipeline `videoconvert ! autovideosink` ist bereits gesetzt. Einfach starten:
```bash
./scripts/start_stream.sh
```
Das Video wird lokal angezeigt. Zum Stoppen:
```bash
./scripts/stop_stream.sh
```
## Pipeline ändern
### Lokale Anzeige (Standard)
```bash
./scripts/set_pipeline_display.sh
./scripts/start_stream.sh
```
### UDP-Streaming (H.264)
```bash
# Standard: 192.168.1.100:5000
./scripts/set_pipeline_udp.sh
# Eigene IP/Port
./scripts/set_pipeline_udp.sh 192.168.1.50 5001
# Dann starten
./scripts/start_stream.sh
```
**Stream empfangen:**
```bash
gst-launch-1.0 udpsrc port=5000 ! application/x-rtp,encoding-name=H264 ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! autovideosink
```
### Aufnahme in Datei
```bash
# Standard: /tmp/vizion_recording.mp4
./scripts/set_pipeline_file.sh
# Eigene Datei
./scripts/set_pipeline_file.sh /home/user/videos/recording.mp4
# Dann starten
./scripts/start_stream.sh
```
### MJPEG HTTP-Stream
```bash
# Standard: Port 8080
./scripts/set_pipeline_mjpeg.sh
# Eigener Port
./scripts/set_pipeline_mjpeg.sh 8090
# Dann starten
./scripts/start_stream.sh
```
**Stream ansehen:**
```bash
# Im Browser
firefox http://localhost:8080
# Mit FFplay
ffplay http://localhost:8080
```
## Status & Information
### Status abfragen
```bash
./scripts/get_status.sh
```
Zeigt:
- Streaming-Status (läuft/gestoppt)
- Aktuelle Pipeline
### Verfügbare Formate
```bash
./scripts/get_formats.sh
```
Zeigt alle verfügbaren Kamera-Auflösungen und Formate.
## Typischer Workflow
```bash
# 1. VizionStreamer starten (Terminal 1)
./build/vizionStreamer
# 2. Status prüfen (Terminal 2)
./scripts/get_status.sh
# 3. Pipeline für UDP-Streaming setzen
./scripts/set_pipeline_udp.sh 192.168.1.100 5000
# 4. Streaming starten
./scripts/start_stream.sh
# 5. Stream empfangen (auf Zielrechner)
gst-launch-1.0 udpsrc port=5000 ! application/x-rtp,encoding-name=H264 ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! autovideosink
# 6. Bei Bedarf stoppen
./scripts/stop_stream.sh
# 7. Pipeline ändern
./scripts/set_pipeline_display.sh
# 8. Erneut starten
./scripts/start_stream.sh
```
## Wichtige Hinweise
- Pipeline kann nur geändert werden, wenn Streaming gestoppt ist
- Standard-Pipeline ist bereits gesetzt - kein `set_pipeline` vor dem ersten Start nötig
- Mit `start_stream.sh` sofort loslegen!
- Alle Scripts benötigen `socat` (installieren mit: `sudo apt install socat`)
- Status-Scripts benötigen optional `python3` für formatierte JSON-Ausgabe
## Eigene Pipelines
Sie können jede beliebige GStreamer-Pipeline verwenden:
```bash
SOCKET="/tmp/vizion_control.sock"
echo '{"command":"set_pipeline","params":{"pipeline":"IHRE_PIPELINE"}}' | socat - UNIX-CONNECT:$SOCKET
```
Beispiele:
- `videoconvert ! xvimagesink` - Einfache lokale Anzeige
- `videoconvert ! x264enc ! flvmux ! rtmpsink location=rtmp://server/live/stream` - RTMP-Streaming
- `tee name=t ! queue ! videoconvert ! autovideosink t. ! queue ! x264enc ! filesink location=out.mp4` - Gleichzeitig anzeigen und aufnehmen