Skip to content

Commit

Permalink
add ivf postprocessing
Browse files Browse the repository at this point in the history
  • Loading branch information
vpalmisano committed Apr 16, 2024
1 parent efde42f commit e176b4f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
stopRandomActivateAudio,
stopUpdateSystemStats,
} from './utils'
import { calculateVmafScore } from './vmaf'
import { calculateVmafScore, fixIvfFiles } from './vmaf'

const log = logger('app')

Expand Down Expand Up @@ -182,6 +182,11 @@ async function main(): Promise<void> {
console.log('Exiting...')

await stopApplication()

if (config.postProcessVideoRecordings && config.serverData) {
await fixIvfFiles(config.serverData, config.vmafKeepSourceFiles)
}

process.exit(0)
}
registerExitHandler(() => stop())
Expand Down
7 changes: 7 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,13 @@ alert will be successful only when at least 95% of the checks pass.`,
env: 'SERVER_DATA',
arg: 'server-data',
},
postProcessVideoRecordings: {
doc: `When true, it post-processes the video recordings stored into the \`serverData\` directory.`,
format: 'Boolean',
default: false,
env: 'POST_PROCESS_VIDEO_RECORDINGS',
arg: 'post-process-video-recordings',
},
vmafPath: {
doc: `When set, it runs the VMAF calculator for the videos saved under the provided directory path.`,
format: String,
Expand Down
3 changes: 2 additions & 1 deletion src/vmaf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ export async function fixIvfFiles(
vmafKeepSourceFiles = true,
) {
const files = await await getFiles(vmafPath, '.ivf.raw')
log.debug(`fixIvfFiles files=${files}`)
log.info(`fixIvfFiles files=${files}`)

const reference = new Map<string, string>()
const degraded = new Map<string, string[]>()
Expand All @@ -346,6 +346,7 @@ export async function fixIvfFiles(
log.error(`fixIvfFrames error: ${(err as Error).message}`)
}
}
log.info(`fixIvfFiles done`)

return { reference, degraded }
}
Expand Down

0 comments on commit e176b4f

Please sign in to comment.