Spaces:
Running
Running
never fall through to HEVC origin when H264 FLV exists (2x transcode saturated cpu-basic)
Browse files- youtube_manager.py +7 -3
youtube_manager.py
CHANGED
|
@@ -150,9 +150,13 @@ class ManagedYouTube:
|
|
| 150 |
supported=[c for c in sources if any(k in _cod(c) for k in ('h264','avc','h265','hevc'))] or list(sources)
|
| 151 |
prefer=str(os.getenv('YOUTUBE_PREFER_H264','1')).strip().lower() in ('1','on','true','yes')
|
| 152 |
if prefer and os.getenv('YOUTUBE_SEND_MODE','auto').strip().lower() in ('auto','copy'):
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
out=supported
|
| 157 |
else:
|
| 158 |
raise RuntimeError('YOUTUBE_VIDEO_MODE يجب أن يكون original أو h264')
|
|
|
|
| 150 |
supported=[c for c in sources if any(k in _cod(c) for k in ('h264','avc','h265','hevc'))] or list(sources)
|
| 151 |
prefer=str(os.getenv('YOUTUBE_PREFER_H264','1')).strip().lower() in ('1','on','true','yes')
|
| 152 |
if prefer and os.getenv('YOUTUBE_SEND_MODE','auto').strip().lower() in ('auto','copy'):
|
| 153 |
+
h264=[c for c in supported if any(k in _cod(c) for k in ('h264','avc'))]
|
| 154 |
+
# Measured: falling through to origin HEVC then fixed720 pegged 2-core
|
| 155 |
+
# quota at 99–101% (a3dam_111). H264 hd copy of the same room was ~few % CPU.
|
| 156 |
+
if h264:
|
| 157 |
+
supported=sorted(h264, key=lambda c: 0 if str(c.get('media') or '')=='flv' else 1)
|
| 158 |
+
else:
|
| 159 |
+
supported=sorted(supported, key=lambda c: 0 if str(c.get('media') or '')=='flv' else 1)
|
| 160 |
out=supported
|
| 161 |
else:
|
| 162 |
raise RuntimeError('YOUTUBE_VIDEO_MODE يجب أن يكون original أو h264')
|