Skip to content

Instantly share code, notes, and snippets.

@acastaner
Last active August 4, 2016 07:06
Show Gist options
  • Save acastaner/4d5cd3329350004a674a21126000cebf to your computer and use it in GitHub Desktop.
Save acastaner/4d5cd3329350004a674a21126000cebf to your computer and use it in GitHub Desktop.
PowerShell script to transcode all mp4 videos from current directory to Youtube favored format
# Download binaries from https://ffmpeg.zeranoe.com/builds/ and add to user's PATH
# The script looks for all the MP4 files in the "todo" subdirectory,
# then transcodes them for Youtube, puts the resulting file in the "transcoded"
# subdirectory and the source file into the "done" subdirectory
$Files = Get-ChildItem . -Filter todo\*.mp4
$Files | Foreach-Object {
echo "filename = $_"
ffmpeg -i $_.FullName -codec:v libx264 -crf 21 -bf 2 -flags +cgop -pix_fmt yuv420p -codec:a aac -strict -2 -b:a 384k -b:v 8M -r:a 48000 -movflags faststart transcoded\$_
Move-Item $_.FullName done\
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment