Skip to content

Instantly share code, notes, and snippets.

View mrcodetastic's full-sized avatar

mrcodetastic

View GitHub Profile
@mrcodetastic
mrcodetastic / FindAndTranscodeTox256.ps1
Last active March 2, 2019 20:06
Windows Powershell to recurse through all directories and transcode into HEVC x265 with FFMPEG
# Search through directories for videos and compress t x265 Codec (append x265 to the original file name and possibly rename old file with .orig) also convert sound to aac as well
# Create a new file, exclude any existing x265 filename appended files and don't convert WhatsApp videos already compressed or copied from phone (VID*)
# Change 'D:\Temp\ffmpeg' to the path where your FFMPEG executable is
Get-ChildItem -Recurse -File -Exclude VID-*,*x265* -Include *.mp4,*.mov,*.avi | Foreach {
$newname = $_.fullname.subString(0, $_.fullname.Length-4) + "_x265.mp4";
#$oldname = "$($_.basename).orig$($_.extension)";
D:\Temp\ffmpeg -i $_.fullname -c:v libx265 -preset slow -crf 23 -c:a aac -b:a 128k -y $newname;
echo "Saving as: $($newname)";
#echo "Renaming original file: $($_.fullname) as $($oldname)";
#rename-item -path $_.fullname -newname "$($_.basename).orig$($_.extension)"
041d4aac86c4629f7392f7ce123ac459432406f143eb343cf1993150aa452b8e0b87a03d7e5d3fab1cc49a37e41964cbc7e62cc20f26b539832e2818077bedaf3d