Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- date >> time.txt
- $inputDir = "D:\Downloads\Marraige Video\video"
- $outputDir = Join-Path $inputDir "resize"
- # Create output folder if missing
- New-Item -ItemType Directory -Force -Path $outputDir | Out-Null
- # ==========================
- # Output profiles (keep only what you want; comment others)
- # ==========================
- $profiles = @(
- # @{ Name="480p"; Height=480; Fps=30; Crf=23; Preset="medium"; Abitrate="128k" }
- # @{ Name="720p"; Height=720; Fps=30; Crf=23; Preset="medium"; Abitrate="128k" }
- @{ Name="1080p"; Height=1080; Fps=30; Crf=23; Preset="medium"; Abitrate="128k" }
- # @{ Name="2k"; Height=1440; Fps=30; Crf=23; Preset="medium"; Abitrate="160k" }
- # @{ Name="4k"; Height=2160; Fps=30; Crf=23; Preset="slow"; Abitrate="192k" }
- )
- if (-not $profiles -or $profiles.Count -eq 0) {
- Write-Host "No profiles enabled. Uncomment at least one profile in `$profiles."
- exit 1
- }
- Get-ChildItem -Path $inputDir -Filter *.mp4 -File | ForEach-Object {
- $inFile = $_.FullName
- $base = $_.BaseName
- foreach ($p in $profiles) {
- # Output file suffix is profile name (e.g., _1080p)
- $outFile = Join-Path $outputDir ("{0}_{1}.mp4" -f $base, $p.Name)
- Write-Host "Converting ($($p.Name)): $inFile -> $outFile"
- & ffmpeg -hide_banner -y -i $inFile `
- -vf "scale=-2:$($p.Height),fps=$($p.Fps)" `
- -c:v libx264 -preset $($p.Preset) -crf $($p.Crf) -pix_fmt yuv420p `
- -c:a aac -b:a $($p.Abitrate) `
- $outFile
- }
- }
- Write-Host "Done. Output in: $outputDir"
- date >> time.txt
Advertisement
Add Comment
Please, Sign In to add comment