Newer
Older
RARP / extract_frames.ps1
@delAguila delAguila on 19 Dec 696 bytes Update 2025-12-19
# Set base directory and FPS
$BASE_DIR = "Dataset_RARP_video"
$FPS = 1   # change as needed

# Get all subfolders
Get-ChildItem -Path $BASE_DIR -Directory | ForEach-Object {
    $folder = $_.FullName

    # Get all .mp4 files in each folder
    Get-ChildItem -Path $folder -Filter *.mp4 | ForEach-Object {
        $video = $_.FullName
        Write-Host "Extracting frames from $video"

        # Build the ffmpeg command
        $outputPattern = Join-Path $folder "frame_%04d.webp"
        ffmpeg -hide_banner -i "$video" -vf "fps=$FPS,scale=640:360" -vcodec libwebp -lossless 1 -compression_level 6 "$outputPattern"

        Write-Host "Frames saved to: $folder"
    }
}

Write-Host "✅ Done."