Jitendrayoutubelive commited on
Commit
59eab44
·
verified ·
1 Parent(s): cbb3183

Update bot.py

Browse files
Files changed (1) hide show
  1. bot.py +15 -5
bot.py CHANGED
@@ -1157,14 +1157,21 @@ async def handle_video(client, message, stream_config=None):
1157
  is_image_only = config.get('is_image_only', False)
1158
 
1159
  # --- FFMPEG Command Setup ---
1160
- command = ["ffmpeg", "-re"]
 
 
 
 
 
 
 
 
1161
 
1162
  if is_concat:
1163
- # [FIX] बिना डाउनलोड किए ऑनलाइन लिंक्स (HTTP/HTTPS) सीधे चलाने की परमिशन
1164
  command.extend(["-f", "concat", "-safe", "0", "-protocol_whitelist", "file,http,https,tcp,tls"])
1165
 
1166
- # [FIX] Prevent Buffer lag on servers (Prevents Poor Health)
1167
- command.extend(["-thread_queue_size", "1024"])
1168
 
1169
  if is_image_only:
1170
  # Image Only Streaming Logic (YouTube Standard 30 FPS)
@@ -1255,7 +1262,10 @@ async def handle_video(client, message, stream_config=None):
1255
  seconds_str = str(int(actual_stream_seconds)) # असली रैंडम सेकंड्स
1256
  command.extend(["-t", seconds_str])
1257
 
1258
- command.extend(["-f", "flv", rtmp_url])
 
 
 
1259
 
1260
  st_type = "🖼 Image" if is_image_only else "🎥 Video"
1261
  live_msg = await msg.edit_text(f"🟢 **Live Started on {platform}!**\n📋 **Type:** `{st_type}`\n📐 **Mode:** `{orientation.capitalize()}`\n⏳ **Time Left:** `Calculating...`\n\n🔹 To stop, send /stop")
 
1157
  is_image_only = config.get('is_image_only', False)
1158
 
1159
  # --- FFMPEG Command Setup ---
1160
+ command = [
1161
+ "ffmpeg", "-re",
1162
+ # [FIX] इंटरनेट/Archive.org से कनेक्शन कटने पर अपने आप दोबारा जोड़ने के लिए
1163
+ "-reconnect", "1",
1164
+ "-reconnect_at_eof", "1",
1165
+ "-reconnect_streamed", "1",
1166
+ "-reconnect_delay_max", "5",
1167
+ "-timeout", "10000000"
1168
+ ]
1169
 
1170
  if is_concat:
 
1171
  command.extend(["-f", "concat", "-safe", "0", "-protocol_whitelist", "file,http,https,tcp,tls"])
1172
 
1173
+ # [FIX] बफ़र लैग और कनेक्शन ड्रॉप रोकने के लिए
1174
+ command.extend(["-thread_queue_size", "2048"])
1175
 
1176
  if is_image_only:
1177
  # Image Only Streaming Logic (YouTube Standard 30 FPS)
 
1262
  seconds_str = str(int(actual_stream_seconds)) # असली रैंडम सेकंड्स
1263
  command.extend(["-t", seconds_str])
1264
 
1265
+ command.extend([
1266
+ "-flvflags", "no_duration_filesize",
1267
+ "-f", "flv", rtmp_url
1268
+ ])
1269
 
1270
  st_type = "🖼 Image" if is_image_only else "🎥 Video"
1271
  live_msg = await msg.edit_text(f"🟢 **Live Started on {platform}!**\n📋 **Type:** `{st_type}`\n📐 **Mode:** `{orientation.capitalize()}`\n⏳ **Time Left:** `Calculating...`\n\n🔹 To stop, send /stop")