-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathminimal.py
More file actions
36 lines (28 loc) · 1.17 KB
/
minimal.py
File metadata and controls
36 lines (28 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python3
"""
GhostStream Minimal Example - Transcode in 10 Lines
====================================================
Copy this into your project to get started instantly.
Prerequisites:
1. GhostStream running: python -m ghoststream
2. Install SDK: pip install ghoststream
Usage:
python examples/minimal.py
"""
from ghoststream import GhostStreamClient, TranscodeStatus
# Any video URL works - HTTP, RTSP, S3, etc.
VIDEO_URL = "https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/720/Big_Buck_Bunny_720_10s_1MB.mp4"
# Create client with manual server (or use mDNS discovery)
client = GhostStreamClient(manual_server="localhost:8765")
# Start transcode - returns immediately with stream URL
job = client.transcode(source=VIDEO_URL, resolution="720p")
if job.status == TranscodeStatus.ERROR:
print(f"❌ Error: {job.error_message}")
else:
print(f"🎬 Job ID: {job.job_id}")
print(f"📺 Stream URL: {job.stream_url}")
print(f"\n▶ Play with VLC:")
print(f" vlc {job.stream_url}")
print(f"\n▶ Or check status:")
status = client.get_job_status(job.job_id)
print(f" Status: {status.status.value}, Progress: {status.progress}%")