ChandimaPrabath commited on
Commit
ed8e54b
·
1 Parent(s): fc60743
Files changed (1) hide show
  1. video.py +3 -1
video.py CHANGED
@@ -1,6 +1,7 @@
1
  import os
2
  import logging
3
  import uuid
 
4
  from ffmpy import FFmpeg
5
 
6
  # Set up logging
@@ -19,13 +20,14 @@ def ffmpeg_stream(file_url, token, output_dir="tmp/cache/stream"):
19
  segment_filename = os.path.join(stream_dir, 'segment_%03d.ts')
20
 
21
  # Construct the FFmpeg command using ffmpy
 
22
  ff = FFmpeg(
23
  inputs={file_url: None},
24
  outputs={
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:
 
1
  import os
2
  import logging
3
  import uuid
4
+ import shlex
5
  from ffmpy import FFmpeg
6
 
7
  # Set up logging
 
20
  segment_filename = os.path.join(stream_dir, 'segment_%03d.ts')
21
 
22
  # Construct the FFmpeg command using ffmpy
23
+ headers = f'Authorization: Bearer {token}'
24
  ff = FFmpeg(
25
  inputs={file_url: None},
26
  outputs={
27
  output_path: f'-c:v libx264 -crf 23 -preset medium -c:a aac -b:a 192k -f hls '
28
  f'-hls_time 10 -hls_list_size 0 -hls_segment_filename {segment_filename}'
29
  },
30
+ global_options=shlex.split(f'-headers "{headers}"')
31
  )
32
 
33
  try: