PAL or NTSC Checker – Using PowerShell, MediaInfo CLI and XML

PowerShell script to test if the given video file is PAL (25fps) or NTSC (29.97fps). Please download the MediaInfo CLI that could be found here, add mediainfo.exe (CLI version) to your system variables, copy the code below and save it as PAL_or_NTSC_Pro+.ps1 and RUN with it!

This script can also be used to check the frame rate of any video file!

# PAL_or_NTSC_Pro+ v1
# justCurious @2020

Write-Host "PAL or NTSC checker by justCurious `n"

# resize the console as per you need, I find the config below suitable

$size = (Get-Host).UI.RawUI.WindowSize
$size.Width = 80
$size.Height = 30
(Get-Host).UI.RawUI.WindowSize = $size

# this while loop runs the script endelessly 

while ($true)

{

write-host ""

$video = Read-Host -Prompt 'Drag & Drop the video file'

# mediainfo CLI should be installed and added to system varibales for this script to work 
# Download Mediainfo CLI here: https://mediaarea.net/en/MediaInfo/Download/Windows

mediainfo $video --Output=XML > test2.xml

$xmlPath = ".\test2.xml"
 
[xml]$xmlDocument = Get-Content -Path $xmlPath
 
# simply traverse the nodes and select the information you want

$frameRate = $xmlDocument.MediaInfo.media.track[1].FrameRate

remove-item ./test2.xml

# PAL = 25fps

if ($frameRate -eq "25.000") {

write-host ""

write-host "Result: PAL video file `n" -ForeGroundColor Green -NoNewLine

write-host Framerate: $frameRate

# NTSC = 29.970fps

} elseIf ($frameRate -eq "29.970") {

write-host ""

write-host "Result: NTSC video file `n" -ForeGroundColor Green -NoNewLine

write-host Framerate: $frameRate

} else {

write-host ""

write-host "Result: This file is neither PAL nor NTSC!" -ForeGroundColor Red

write-host Framerate: $frameRate

}

}
pause