Spanicin commited on
Commit
3de7ae7
·
verified ·
1 Parent(s): c93c8fd

Update stream_server.py

Browse files
Files changed (1) hide show
  1. stream_server.py +3 -3
stream_server.py CHANGED
@@ -53,7 +53,7 @@ def convert_to_hls(input_path, output_dir, video_name, start_number):
53
  '-b:v','1500k',
54
  '-c:a','aac',
55
  '-b:a','128k',
56
- '-hls_time', '1', # Segment duration in seconds
57
  '-hls_playlist_type', 'vod', # Video on Demand playlist type
58
  '-start_number', str(start_number), # Starting segment number
59
  '-hls_segment_filename', os.path.join(output_dir, 'video_stream%d.ts'), # Segment file naming
@@ -113,7 +113,7 @@ async def concatenate_playlists(video_names, base_dir):
113
  request (Request): FastAPI request object to extract base URL.
114
  """
115
  concatenated_playlist_path = os.path.join(base_dir, 'master.m3u8')
116
- max_segment_duration = 1 # Since we set hls_time to 3
117
  segment_lines = [] # To store segment lines
118
 
119
  # Construct base URL from the incoming request
@@ -158,7 +158,7 @@ async def concatenate_playlists(video_names, base_dir):
158
  outfile.write(f'{line}\n')
159
  outfile.write('#EXT-X-ENDLIST\n')
160
 
161
- def generate_m3u8(video_duration, output_path,segment_duration=1):
162
  # Initialize playlist content
163
  m3u8_content = "#EXTM3U\n"
164
  m3u8_content += "#EXT-X-PLAYLIST-TYPE:VOD\n"
 
53
  '-b:v','1500k',
54
  '-c:a','aac',
55
  '-b:a','128k',
56
+ '-hls_time', '3', # Segment duration in seconds
57
  '-hls_playlist_type', 'vod', # Video on Demand playlist type
58
  '-start_number', str(start_number), # Starting segment number
59
  '-hls_segment_filename', os.path.join(output_dir, 'video_stream%d.ts'), # Segment file naming
 
113
  request (Request): FastAPI request object to extract base URL.
114
  """
115
  concatenated_playlist_path = os.path.join(base_dir, 'master.m3u8')
116
+ max_segment_duration = 3 # Since we set hls_time to 3
117
  segment_lines = [] # To store segment lines
118
 
119
  # Construct base URL from the incoming request
 
158
  outfile.write(f'{line}\n')
159
  outfile.write('#EXT-X-ENDLIST\n')
160
 
161
+ def generate_m3u8(video_duration, output_path,segment_duration=3):
162
  # Initialize playlist content
163
  m3u8_content = "#EXTM3U\n"
164
  m3u8_content += "#EXT-X-PLAYLIST-TYPE:VOD\n"