Reoo88 commited on
Commit
625cc7b
·
1 Parent(s): 29402be

Latest curl_cffi 0.16+; matchgop fallback instead of default 720; health poll 60s.

Browse files
Files changed (3) hide show
  1. Dockerfile +4 -4
  2. relay.py +2 -2
  3. requirements.txt +1 -1
Dockerfile CHANGED
@@ -4,7 +4,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends ffmpeg ca-certi
4
  RUN ffmpeg -hide_banner -h protocol=rtmps 2>&1 | grep -q rtmp_enhanced_codecs
5
  WORKDIR /app
6
  COPY requirements.txt .
7
- RUN pip install --no-cache-dir -r requirements.txt
8
  COPY app.py relay.py youtube_api.py youtube_manager.py flv_bridge.py tiktok_auth.py ingest.py index.html ./
9
  COPY verify.sh verify_tokens.py probe_live.py test_watchdog.py test_lifecycle.py test_relay.py test_concurrency.py ./
10
 
@@ -24,17 +24,17 @@ ENV TZ=Asia/Baghdad \
24
  YOUTUBE_GOP=60 \
25
  YOUTUBE_INPUT_RECOVERY=1 \
26
  YOUTUBE_PREFER_H264=1 \
27
- YOUTUBE_CODEC_FALLBACK_MODE=fixed720 \
28
  YOUTUBE_RETRY_MIN=1 \
29
  YOUTUBE_RETRY_MAX=60 \
30
  YOUTUBE_SOURCE_LIMIT=6 \
31
  YOUTUBE_FORMAT_GUARD=on \
32
  YOUTUBE_FLAP_LIMIT=4 \
33
- YOUTUBE_FLAP_FALLBACK_MODE=fixed720 \
34
  YOUTUBE_X264_PRESET=veryfast \
35
  YOUTUBE_CRF=22 \
36
  YOUTUBE_FIFO_TIMESHIFT=0 \
37
- YOUTUBE_HEALTH_INTERVAL=180 \
38
  YOUTUBE_OBS_HOLD_SECONDS=900 \
39
  YOUTUBE_SOURCE_RETRY=15 \
40
  YOUTUBE_FORCE_GAP=5 \
 
4
  RUN ffmpeg -hide_banner -h protocol=rtmps 2>&1 | grep -q rtmp_enhanced_codecs
5
  WORKDIR /app
6
  COPY requirements.txt .
7
+ RUN pip install --no-cache-dir -U -r requirements.txt
8
  COPY app.py relay.py youtube_api.py youtube_manager.py flv_bridge.py tiktok_auth.py ingest.py index.html ./
9
  COPY verify.sh verify_tokens.py probe_live.py test_watchdog.py test_lifecycle.py test_relay.py test_concurrency.py ./
10
 
 
24
  YOUTUBE_GOP=60 \
25
  YOUTUBE_INPUT_RECOVERY=1 \
26
  YOUTUBE_PREFER_H264=1 \
27
+ YOUTUBE_CODEC_FALLBACK_MODE=matchgop \
28
  YOUTUBE_RETRY_MIN=1 \
29
  YOUTUBE_RETRY_MAX=60 \
30
  YOUTUBE_SOURCE_LIMIT=6 \
31
  YOUTUBE_FORMAT_GUARD=on \
32
  YOUTUBE_FLAP_LIMIT=4 \
33
+ YOUTUBE_FLAP_FALLBACK_MODE=matchgop \
34
  YOUTUBE_X264_PRESET=veryfast \
35
  YOUTUBE_CRF=22 \
36
  YOUTUBE_FIFO_TIMESHIFT=0 \
37
+ YOUTUBE_HEALTH_INTERVAL=60 \
38
  YOUTUBE_OBS_HOLD_SECONDS=900 \
39
  YOUTUBE_SOURCE_RETRY=15 \
40
  YOUTUBE_FORCE_GAP=5 \
relay.py CHANGED
@@ -191,7 +191,7 @@ class Sender:
191
  now=time.monotonic()
192
  while flap and now-flap[0]>600:flap.popleft()
193
  if len(flap)>=int(os.getenv('YOUTUBE_FLAP_LIMIT','4')):
194
- mode=os.getenv('YOUTUBE_FLAP_FALLBACK_MODE','fixed720').strip().lower()
195
  if mode not in ('fixed1080','fixed720'):mode='fixed720'
196
  self.sticky_mode=mode
197
  self.sticky_since=time.monotonic()
@@ -236,7 +236,7 @@ class Sender:
236
  def note_format_change(self):
237
  self.flap.append(time.monotonic())
238
  if len(self.flap)>=int(os.getenv('YOUTUBE_FLAP_LIMIT','4')):
239
- self.log('system','تغيّرت أبعاد المصدر عدة مرات خلال 10 دقائق؛ التحول تلقائيًا إلى كانفس ثابت (%s) لمنع تكرار الانقطاع'%os.getenv('YOUTUBE_FLAP_FALLBACK_MODE','fixed720'))
240
  @staticmethod
241
  def copy_is_safe(declared,probed):
242
  """Stream copy is allowed only on positive proof of H.264, never on absence of evidence.
 
191
  now=time.monotonic()
192
  while flap and now-flap[0]>600:flap.popleft()
193
  if len(flap)>=int(os.getenv('YOUTUBE_FLAP_LIMIT','4')):
194
+ mode=os.getenv('YOUTUBE_FLAP_FALLBACK_MODE','matchgop').strip().lower()
195
  if mode not in ('fixed1080','fixed720'):mode='fixed720'
196
  self.sticky_mode=mode
197
  self.sticky_since=time.monotonic()
 
236
  def note_format_change(self):
237
  self.flap.append(time.monotonic())
238
  if len(self.flap)>=int(os.getenv('YOUTUBE_FLAP_LIMIT','4')):
239
+ self.log('system','تغيّرت أبعاد المصدر عدة مرات خلال 10 دقائق؛ التحول تلقائيًا إلى كانفس ثابت (%s) لمنع تكرار الانقطاع'%os.getenv('YOUTUBE_FLAP_FALLBACK_MODE','matchgop'))
240
  @staticmethod
241
  def copy_is_safe(declared,probed):
242
  """Stream copy is allowed only on positive proof of H.264, never on absence of evidence.
requirements.txt CHANGED
@@ -1,3 +1,3 @@
1
  fastapi>=0.115,<1
2
  uvicorn>=0.30,<1
3
- curl_cffi>=0.13,<1
 
1
  fastapi>=0.115,<1
2
  uvicorn>=0.30,<1
3
+ curl_cffi>=0.16.3,<1