Skip to content

Instantly share code, notes, and snippets.

@ftischhauser
Last active March 29, 2024 05:04
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ftischhauser/8a0642bda85eed1dbcf04a8dd641f444 to your computer and use it in GitHub Desktop.
Save ftischhauser/8a0642bda85eed1dbcf04a8dd641f444 to your computer and use it in GitHub Desktop.
DoVi_Check_Infuse_Compatibility.ps1
$fn = $args[0]
Start-Process -Wait -NoNewWindow 'cmd.exe' -ArgumentList "/C `"ffmpeg.exe -hide_banner -loglevel panic -i `"$fn`" -c:v copy -frames:v 1 -vbsf hevc_mp4toannexb -f hevc - | dovi_tool extract-rpu - -o `"$($fn).RPU.bin`"`""
Start-Process -Wait -NoNewWindow 'cmd.exe' -ArgumentList "/C `"dovi_tool.exe info `"$($fn).RPU.bin`" -f 0 > `"$($fn).RPU.json`"`""
$rpu = (Get-Content "$($fn).RPU.json" | Select-Object -Skip 1) | ConvertFrom-Json
if ($rpu.dovi_profile) {
Write-Output "Profile: $($rpu.dovi_profile)"
if ($rpu.dovi_profile -eq 5) {
Write-Output "Natively supported."
}
elseif ($rpu.dovi_profile -eq 8) {
foreach ($curve in $rpu.rpu_data_mapping.curves) {
if ($curve.num_pivots_minus2) {
Write-Warning "File may contain luma/chroma mapping."
}
}
if ($rpu.vdr_dm_data.cmv29_metadata) {
Write-Output "File contains CMv2.9 metadata."
}
if ($rpu.vdr_dm_data.cmv40_metadata) {
Write-Warning "File contains CMv4.0 metadata."
}
}
else {
Write-Warning "Profile not supported by Infuse."
}
}
else {
Write-Warning "Error extracting RPU details."
}
Remove-Item -Force "$($fn).RPU.bin"
Remove-Item -Force "$($fn).RPU.json"
@nekno
Copy link

nekno commented Dec 24, 2023

Thanks for this! Comes in handy.

Rather than using the ffmpeg -t 1 option to read 1 second, I've found it works to use the -frames:v 1 option on the output side (after the -i option, e.g., -i `"$fn`" -c:v copy -frames:v 1) to only output the first frame, since that's all dovi_tool needs to read.

So it can process a file faster by only processing a single frame.

@ftischhauser
Copy link
Author

Thanks @nekno! I have updated this gist accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment