Spaces:
Build error
Build error
Commit
·
2d916c0
1
Parent(s):
d2e0e4c
fix
Browse files
video.py
CHANGED
|
@@ -25,7 +25,7 @@ def ffmpeg_stream(file_url, token, output_dir="tmp/cache/stream"):
|
|
| 25 |
output_path: f'-c:v libx264 -crf 23 -preset medium -c:a aac -b:a 192k -f hls '
|
| 26 |
f'-hls_time 10 -hls_list_size 0 -hls_segment_filename {segment_filename}'
|
| 27 |
},
|
| 28 |
-
global_options=f'-headers \"Authorization: Bearer {token}\"'
|
| 29 |
)
|
| 30 |
|
| 31 |
try:
|
|
@@ -48,11 +48,11 @@ def ffmpeg_stream(file_url, token, output_dir="tmp/cache/stream"):
|
|
| 48 |
return None, None
|
| 49 |
|
| 50 |
# Uncomment and modify the following lines if you want to test the script
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
|
|
|
| 25 |
output_path: f'-c:v libx264 -crf 23 -preset medium -c:a aac -b:a 192k -f hls '
|
| 26 |
f'-hls_time 10 -hls_list_size 0 -hls_segment_filename {segment_filename}'
|
| 27 |
},
|
| 28 |
+
global_options=f'-headers \"Authorization: Bearer {token}\r\n"'
|
| 29 |
)
|
| 30 |
|
| 31 |
try:
|
|
|
|
| 48 |
return None, None
|
| 49 |
|
| 50 |
# Uncomment and modify the following lines if you want to test the script
|
| 51 |
+
if __name__ == "__main__":
|
| 52 |
+
url = "https://huggingface.co/Unicone-Studio/jellyfin_media/resolve/main/films/Funky%20Monkey%202004/Funky%20Monkey%20(2004)%20Web-dl%201080p.mp4"
|
| 53 |
+
token = os.getenv("TOKEN")
|
| 54 |
+
stream_id, output_path = ffmpeg_stream(url, token)
|
| 55 |
+
if stream_id:
|
| 56 |
+
logging.info(f"HLS playlist created with stream ID: {stream_id}")
|
| 57 |
+
else:
|
| 58 |
+
logging.error("Failed to create HLS playlist.")
|