Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[CmdletBinding()]
Param(
[Parameter(Mandatory=$True,Position=1)]
[string]$filePath,
[switch]$ignoreFps
)
$framesDir = Split-Path $filePath -leaf
$framesDir = 'frames/' + $framesDir
New-Item -ItemType Directory -Force -Path $framesDir
# Determine the average framerate of our input if necessary
$fpsCmd = ' '
if(!$ignoreFps) {
$videoFps = ffprobe -v error -select_streams v:0 -show_entries stream=avg_frame_rate -of default=noprint_wrappers=1:nokey=1 "$filePath"
ffmpeg.exe -i "$filePath" -r $videoFps -f image2 "$framesDir/%06d.png"
} else {
ffmpeg.exe -i "$filePath" -f image2 "$framesDir/%06d.png"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment