chore: remove one-shot avci patch scripts
This commit is contained in:
parent
ec58556c36
commit
2a43deb0be
3 changed files with 0 additions and 233 deletions
|
|
@ -1,52 +0,0 @@
|
|||
import sys
|
||||
|
||||
# ── capture-manager.js: pass growingCodecName at the call site ──────────────
|
||||
path = '/opt/wild-dragon/services/capture/src/capture-manager.js'
|
||||
src = open(path).read()
|
||||
|
||||
old_call = """ hlsDir: (sourceType === 'sdi' || sourceType === 'deltacast') ? sdiHlsDir : null,
|
||||
videoCodec,
|
||||
audioMap,
|
||||
interlaced: isInterlacedSource,
|
||||
});"""
|
||||
new_call = """ hlsDir: (sourceType === 'sdi' || sourceType === 'deltacast') ? sdiHlsDir : null,
|
||||
videoCodec,
|
||||
growingCodecName: gCodec,
|
||||
audioMap,
|
||||
interlaced: isInterlacedSource,
|
||||
});"""
|
||||
|
||||
if old_call in src:
|
||||
src = src.replace(old_call, new_call, 1)
|
||||
open(path, 'w').write(src)
|
||||
print('OK capture-manager.js call site patched')
|
||||
else:
|
||||
print('FAIL capture-manager.js call site not found')
|
||||
sys.exit(1)
|
||||
|
||||
# ── recorders.js: expand binary growing_codec guard ─────────────────────────
|
||||
path2 = '/opt/wild-dragon/services/mam-api/src/routes/recorders.js'
|
||||
src2 = open(path2).read()
|
||||
|
||||
# Sidecar env GROWING_CODEC=
|
||||
old_env = "`GROWING_CODEC=${recorder.growing_codec === 'hevc_nvenc' ? 'hevc_nvenc' : 'avci100'}`,"
|
||||
new_env = "`GROWING_CODEC=${['avci50','avci100','avci200','hevc_nvenc'].includes(recorder.growing_codec) ? recorder.growing_codec : 'avci100'}`,"
|
||||
|
||||
# startBody growing_codec
|
||||
old_body = " growing_codec: recorder.growing_codec === 'hevc_nvenc' ? 'hevc_nvenc' : 'avci100',"
|
||||
new_body = " growing_codec: ['avci50','avci100','avci200','hevc_nvenc'].includes(recorder.growing_codec) ? recorder.growing_codec : 'avci100',"
|
||||
|
||||
ok = True
|
||||
for old, new, label in [(old_env, new_env, 'GROWING_CODEC env'), (old_body, new_body, 'startBody growing_codec')]:
|
||||
if old in src2:
|
||||
src2 = src2.replace(old, new, 1)
|
||||
print(f'OK recorders.js {label}')
|
||||
else:
|
||||
print(f'FAIL recorders.js {label}')
|
||||
ok = False
|
||||
|
||||
if ok:
|
||||
open(path2, 'w').write(src2)
|
||||
print('recorders.js written OK')
|
||||
else:
|
||||
sys.exit(1)
|
||||
|
|
@ -1,113 +0,0 @@
|
|||
import sys
|
||||
|
||||
path = '/opt/wild-dragon/services/capture/src/capture-manager.js'
|
||||
src = open(path).read()
|
||||
|
||||
patches = [
|
||||
# 1. Replace static GROWING_VIDEO_ELEMENTARY_ARGS with a function
|
||||
(
|
||||
"""const GROWING_VIDEO_ELEMENTARY_ARGS = [
|
||||
'-c:v', 'libx264', '-profile:v', 'high422', '-level', '4.2',
|
||||
'-preset', 'ultrafast', '-tune', 'zerolatency',
|
||||
'-pix_fmt', 'yuv422p10le',
|
||||
'-x264-params', 'avcintra-class=100:bframes=0:keyint=1:scenecut=0',
|
||||
'-aud', '1',
|
||||
];
|
||||
const GROWING_DEFAULT_BITRATE = '25M';""",
|
||||
"""// AVC-Intra elementary encode args per class (50 / 100 / 200).
|
||||
const GROWING_AVCI_CLASS = { avci50: 50, avci100: 100, avci200: 200 };
|
||||
function growingVideoElementaryArgs(codec) {
|
||||
const cls = GROWING_AVCI_CLASS[codec] || 100;
|
||||
return [
|
||||
'-c:v', 'libx264', '-profile:v', 'high422', '-level', '4.2',
|
||||
'-preset', 'ultrafast', '-tune', 'zerolatency',
|
||||
'-pix_fmt', 'yuv422p10le',
|
||||
'-x264-params', `avcintra-class=${cls}:bframes=0:keyint=1:scenecut=0`,
|
||||
'-aud', '1',
|
||||
];
|
||||
}
|
||||
const GROWING_DEFAULT_BITRATE = '25M';""",
|
||||
'GROWING_VIDEO_ELEMENTARY_ARGS -> growingVideoElementaryArgs()',
|
||||
),
|
||||
# 2. growingCodec() / growingExtFor() — 4-way
|
||||
(
|
||||
"""const growingCodec = () => (process.env.GROWING_CODEC === 'hevc_nvenc' ? 'hevc_nvenc' : 'avci100');
|
||||
// File extension per growing codec.
|
||||
const growingExtFor = (codec) => (codec === 'hevc_nvenc' ? 'mov' : 'mxf');""",
|
||||
"""// Valid growing codec values: 'avci50' | 'avci100' | 'avci200' | 'hevc_nvenc'
|
||||
const GROWING_AVC_CODECS = new Set(['avci50', 'avci100', 'avci200']);
|
||||
const growingCodec = () => {
|
||||
const v = process.env.GROWING_CODEC;
|
||||
if (v === 'hevc_nvenc') return 'hevc_nvenc';
|
||||
if (v === 'avci50') return 'avci50';
|
||||
if (v === 'avci200') return 'avci200';
|
||||
return 'avci100'; // default
|
||||
};
|
||||
// File extension per growing codec.
|
||||
const growingExtFor = (codec) => (codec === 'hevc_nvenc' ? 'mov' : 'mxf');""",
|
||||
'growingCodec() 4-way',
|
||||
),
|
||||
# 3. deriveGrowingRaster signature — add codec param
|
||||
(
|
||||
'function deriveGrowingRaster(resolution, framerate, scanHint = null) {',
|
||||
"function deriveGrowingRaster(resolution, framerate, scanHint = null, codec = 'avci100') {",
|
||||
'deriveGrowingRaster signature',
|
||||
),
|
||||
# 4. rawFlag block — class-switch
|
||||
(
|
||||
""" // AVC-Intra 100 raster flags. --avci100_1080p accepts true 1080p59.94 (verified).
|
||||
let rawFlag;
|
||||
if (height >= 1080) {
|
||||
rawFlag = (scan === 'i') ? '--avci100_1080i' : '--avci100_1080p';
|
||||
} else if (height >= 720) {
|
||||
rawFlag = '--avci100_720p';
|
||||
if (fpsNum == null) { r.ff = '60000/1001'; r.raw = '60000/1001'; }
|
||||
} else {
|
||||
rawFlag = '--mpeg2lg_422p_ml_576i';
|
||||
r.ff = '25'; r.raw = '25';
|
||||
}""",
|
||||
""" // AVC-Intra raster flags — class from codec name ('avci50'/'avci100'/'avci200').
|
||||
const avciClass = GROWING_AVCI_CLASS[codec] || 100;
|
||||
let rawFlag;
|
||||
if (height >= 1080) {
|
||||
rawFlag = (scan === 'i') ? `--avci${avciClass}_1080i` : `--avci${avciClass}_1080p`;
|
||||
} else if (height >= 720) {
|
||||
rawFlag = `--avci${avciClass}_720p`;
|
||||
if (fpsNum == null) { r.ff = '60000/1001'; r.raw = '60000/1001'; }
|
||||
} else {
|
||||
rawFlag = '--mpeg2lg_422p_ml_576i';
|
||||
r.ff = '25'; r.raw = '25';
|
||||
}""",
|
||||
'rawFlag class-switch',
|
||||
),
|
||||
# 5. _buildGrowingOrchestrator signature + deriveGrowingRaster call
|
||||
(
|
||||
""" _buildGrowingOrchestrator({ inputArgs, videoBitrate, resolution, framerate, audioChannels, outPath, hlsDir, videoCodec, audioMap = '0:a:0?', interlaced = false }) {
|
||||
const { rawFlag, frameRate, ffRate } = deriveGrowingRaster(resolution, framerate, interlaced ? 'i' : 'p');""",
|
||||
""" _buildGrowingOrchestrator({ inputArgs, videoBitrate, resolution, framerate, audioChannels, outPath, hlsDir, videoCodec, growingCodecName = 'avci100', audioMap = '0:a:0?', interlaced = false }) {
|
||||
const { rawFlag, frameRate, ffRate } = deriveGrowingRaster(resolution, framerate, interlaced ? 'i' : 'p', growingCodecName);""",
|
||||
'_buildGrowingOrchestrator signature',
|
||||
),
|
||||
# 6. Spread GROWING_VIDEO_ELEMENTARY_ARGS -> function call
|
||||
(
|
||||
' ...GROWING_VIDEO_ELEMENTARY_ARGS,',
|
||||
' ...growingVideoElementaryArgs(growingCodecName),',
|
||||
'spread -> growingVideoElementaryArgs(growingCodecName)',
|
||||
),
|
||||
]
|
||||
|
||||
ok = True
|
||||
for old, new, label in patches:
|
||||
if old in src:
|
||||
src = src.replace(old, new, 1)
|
||||
print(f' OK {label}')
|
||||
else:
|
||||
print(f' FAIL {label}')
|
||||
ok = False
|
||||
|
||||
if ok:
|
||||
open(path, 'w').write(src)
|
||||
print('capture-manager.js written OK')
|
||||
else:
|
||||
print('ABORTED — not writing (some patches failed)')
|
||||
sys.exit(1)
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
import sys
|
||||
|
||||
path = '/opt/wild-dragon/services/web-ui/public/screens-ingest.jsx'
|
||||
src = open(path).read()
|
||||
|
||||
patches = [
|
||||
# 1. growingCodec state initialiser — seed all 4 values
|
||||
(
|
||||
""" const [growingCodec, setGrowingCodec] = React.useState(recorder.growing_codec === 'hevc_nvenc' ? 'hevc_nvenc' : 'avci100');""",
|
||||
""" const _validGC = new Set(['avci50','avci100','avci200','hevc_nvenc']);
|
||||
const [growingCodec, setGrowingCodec] = React.useState(_validGC.has(recorder.growing_codec) ? recorder.growing_codec : 'avci100');""",
|
||||
'growingCodec state seed',
|
||||
),
|
||||
# 2. <select> options — add avci50 and avci200
|
||||
(
|
||||
""" <option value="avci100">AVC-Intra 100 (CPU, MXF · Premiere-native)</option>
|
||||
<option value="hevc_nvenc">HEVC all-intra (GPU/NVENC, frag-MOV)</option>""",
|
||||
""" <option value="avci50">AVC-Intra 50 (CPU, MXF · ~100 Mbps @ 59.94)</option>
|
||||
<option value="avci100">AVC-Intra 100 (CPU, MXF · ~200 Mbps @ 59.94)</option>
|
||||
<option value="avci200">AVC-Intra 200 (CPU, MXF · ~400 Mbps @ 59.94)</option>
|
||||
<option value="hevc_nvenc">HEVC all-intra (GPU/NVENC, frag-MOV · experimental)</option>""",
|
||||
'<select> options',
|
||||
),
|
||||
# 3. Hint text below the select
|
||||
(
|
||||
""" {growingCodec === 'hevc_nvenc'
|
||||
? 'GPU-offloaded HEVC 10-bit 4:2:0 in fragmented MOV. Frees CPU. NOTE: not all editors import frag-MOV growing files.'
|
||||
: 'CPU AVC-Intra 100, 4:2:2 10-bit, true 1080p59.94 in MXF OP1a. Premiere-native growing.'}""",
|
||||
""" {growingCodec === 'hevc_nvenc'
|
||||
? 'GPU-offloaded HEVC 10-bit 4:2:0 in fragmented MOV. NOTE: Premiere does not import frag-MOV growing files.'
|
||||
: growingCodec === 'avci50'
|
||||
? 'AVC-Intra Class 50 — ~100 Mbps @ 1080p59.94. Lowest storage, broadcast-grade 4:2:2 10-bit. Premiere-native.'
|
||||
: growingCodec === 'avci200'
|
||||
? 'AVC-Intra Class 200 — ~400 Mbps @ 1080p59.94. Highest quality, 4:2:2 10-bit. Premiere-native.'
|
||||
: 'AVC-Intra Class 100 — ~200 Mbps @ 1080p59.94. Balanced quality and storage. Premiere-native.'}""",
|
||||
'hint text',
|
||||
),
|
||||
# 4. _normRecorder growingCodec — expand to 4-way
|
||||
(
|
||||
" growingCodec: r.growing_codec === 'hevc_nvenc' ? 'hevc_nvenc' : 'avci100',",
|
||||
""" growingCodec: (['avci50','avci100','avci200','hevc_nvenc'].includes(r.growing_codec) ? r.growing_codec : 'avci100'),""",
|
||||
'_normRecorder growingCodec',
|
||||
),
|
||||
# 5. GROWING badge label — show avci class
|
||||
(
|
||||
""" GROWING · {recorder.growingCodec === 'hevc_nvenc' ? 'GPU/HEVC' : 'CPU/AVCI'}""",
|
||||
""" GROWING · {recorder.growingCodec === 'hevc_nvenc' ? 'GPU/HEVC'
|
||||
: recorder.growingCodec === 'avci50' ? 'CPU/AVCI-50'
|
||||
: recorder.growingCodec === 'avci200' ? 'CPU/AVCI-200'
|
||||
: 'CPU/AVCI-100'}""",
|
||||
'GROWING badge label',
|
||||
),
|
||||
]
|
||||
|
||||
ok = True
|
||||
for old, new, label in patches:
|
||||
if old in src:
|
||||
src = src.replace(old, new, 1)
|
||||
print(f'OK {label}')
|
||||
else:
|
||||
print(f'FAIL {label}')
|
||||
ok = False
|
||||
|
||||
if ok:
|
||||
open(path, 'w').write(src)
|
||||
print('screens-ingest.jsx written OK')
|
||||
else:
|
||||
sys.exit(1)
|
||||
Loading…
Reference in a new issue