Skip to content

Instantly share code, notes, and snippets.

@forsythetony
Created August 19, 2014 22:46
Show Gist options
  • Save forsythetony/0c43e8a9305c0a3867ba to your computer and use it in GitHub Desktop.
Save forsythetony/0c43e8a9305c0a3867ba to your computer and use it in GitHub Desktop.
function updateFilesInRange($range)
{
$pathToFiles = $range.folderPath
# Selection all items within the $pathToFiles directory that meet the following conditions...
# 1. It is not a directory
# 2. It was created after the start of the date range
# 3. It was created before the end of the date range
Get-ChildItem -Path $pathToFiles -Recurse | Where-Object {$_.Name -like "*.avi" -and !$_.PSIsDirectory -and $_.CreationTime -ge $range.start -and $_.CreationTime -le $range.end} | Foreach-Object{
# $newName = $_.Basename + ".mp4";
#C:\Users\Bigben\Desktop\ffmpeg-20140519-git-76191c0-win64-static\bin\ffmpeg.exe "$_" -f mp4 -r 25 -s 320*240 -b 768 -ar 44000 -ab 112 $newName;
# Here you would use the file path along with ffmpeg to do the conversion
$newVideo = [io.path]::ChangeExtension($_.FullName, '.mp4')
# Declare the command line arguments for ffmpeg.exe
$ArgumentList = '-i "{0}" -an -b:v 64k -bufsize 64k -vcodec libx264 -pix_fmt yuv420p "{1}"' -f $_.FullName, $newVideo;
# Display message show user the arguments list of the conversion
$convertMessage = ("Converting video with argument list " + $ArgumentList)
Write-Host $convertMessage
#Start-Process -FilePath C:\Users\muengrcerthospkinect\Desktop\Kinect\ffmpeg.exe -ArgumentList $ArgumentList -Wait -NoNewWindow;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment