@@ -111,13 +111,13 @@ export async function recognizeFrames(fpath: string, recover = false, debug = fa
111
111
fpath ,
112
112
'video' ,
113
113
'frame=pts,frame_tags=lavfi.ocr.text,lavfi.ocr.confidence' ,
114
- `crop=w=min(iw\\,ih):h=max((ih/15)\\,32):x=(iw-ow)/2:y=0:exact=1,ocr=whitelist=0123456789-` ,
114
+ `scale=w=1280:h=-1:flags=bicubic, crop=w=min(iw\\,ih):h=max((ih/15)\\,32):x=(iw-ow)/2:y=0:exact=1,ocr=whitelist=0123456789-` ,
115
115
frame => {
116
116
const pts = parseInt ( frame . pts )
117
117
if ( ( ! frames . has ( pts ) || ! frames . get ( pts ) ) && frameRate ) {
118
118
const confidence = parseFloat ( frame . tag_lavfi_ocr_confidence ?. trim ( ) || '0' )
119
119
const textMatch = regExp . exec ( frame . tag_lavfi_ocr_text ?. trim ( ) || '' )
120
- if ( confidence > 50 && textMatch ) {
120
+ if ( confidence > 0 && textMatch ) {
121
121
const { name, time } = textMatch . groups as { name : string ; time : string }
122
122
participantDisplayName = `Participant-${ name . padStart ( 6 , '0' ) } `
123
123
const recognizedTime = parseInt ( time )
@@ -165,6 +165,7 @@ ts: ${firstTimestamp.toFixed(2)}-${lastTimestamp.toFixed(2)} (${(lastTimestamp -
165
165
}
166
166
167
167
async function parseIvf ( fpath : string , runRecognizer = false ) {
168
+ const { width, height } = await parseVideo ( fpath )
168
169
const fname = path . basename ( fpath )
169
170
const fd = await fs . promises . open ( fpath , 'r' )
170
171
const headerData = new ArrayBuffer ( 32 )
@@ -174,8 +175,6 @@ async function parseIvf(fpath: string, runRecognizer = false) {
174
175
await fd . close ( )
175
176
throw new Error ( 'Invalid IVF file' )
176
177
}
177
- const width = headerView . getUint16 ( 12 , true )
178
- const height = headerView . getUint16 ( 14 , true )
179
178
const den = headerView . getUint32 ( 16 , true )
180
179
const num = headerView . getUint32 ( 20 , true )
181
180
const frameRate = den / num
@@ -291,6 +290,8 @@ export async function fixIvfFrames(filePath: string, keepSourceFile = true) {
291
290
writtenFrames ++
292
291
}
293
292
293
+ headerView . setUint16 ( 12 , width , true )
294
+ headerView . setUint16 ( 14 , height , true )
294
295
headerView . setUint32 ( 24 , writtenFrames , true )
295
296
await fixedFd . write ( new Uint8Array ( headerView . buffer ) , 0 , headerView . byteLength , 0 )
296
297
@@ -461,6 +462,7 @@ export async function runVmaf(
461
462
462
463
const filter = `\
463
464
[0:v]\
465
+ scale=w=-1:h=${ degHeight } :flags=bicubic,\
464
466
${ cropFilter ( crop . deg , 0 , ',' ) } \
465
467
${ splitFilter ( [ 'deg_vmaf' , 'deg_psnr' , preview ? 'deg_preview' : '' ] ) } ;\
466
468
[1:v]\
0 commit comments