Skip to content

Instantly share code, notes, and snippets.

@jennings
Last active January 13, 2021 20:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jennings/97df20fe561a13aa03d3de6e65fb003e to your computer and use it in GitHub Desktop.
Save jennings/97df20fe561a13aa03d3de6e65fb003e to your computer and use it in GitHub Desktop.
<#
Burns a timecode into a video using ffmpeg.
#>
param(
$Path,
$OutFile,
$Rate
)
if ($null -eq $Rate) {
"No Rate provided, defaulting to NTSC (30000/1001)"
$Rate = "30000/1001"
}
$dropFrameRates = "30000/1001", "60000/1001", "29.97", "59.94", "ntsc"
$timecodePattern = if ($Rate -in $dropFrameRates) { "00\:00\:00;00" } else { "00\:00\:00\:00" }
$filter = @"
drawtext="timecode='${timecodePattern}':rate=${Rate}:fontsize=72:fontcolor='white':boxcolor=0x000000AA:box=1:x=10:y=10"
"@
ffmpeg -y -i $Path -vf $filter $OutFile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment