Check for the newest version here: https://github.com/Rocketcandy/VideoFileResizer
Powershell Script to automate conversion of video files a specified size or larger to smaller mkv or mp4 files.
- Must have HandBreakCLI (64-bit) installed. You can get it here: https://handbrake.fr/downloads2.php
- Must have powershell setup to allow this script. See Powershell Setup
- Powershell is a requirement to run the script. I have only tested it on Windows, but if you can get it to work on MacOS or Linux more power to you!
- Edit the script and change the first section of the script to match your needs
A couple notes about editing the script
- All paths can be either a network path. Example: "\\my.server\share\files"
- Or a local path. Example: "C:\Users\Public\Videos"
- Just make sure that whatever path you use it stays inside the quotes.
- By default it will look for all files in defined $MovieDir over 2GB and all files in defined $TvShowdir over 1GB (it will look for all files recursivly inside of the defined $MovieDir or $TvShowdir so just specify the base directory that includes all files you want to convert.)
- Once it has found them all it will start converting them from largest to smallest
- It will create a brand new file named: OriginalFileName-New
- Once the conversion is completed it will delete the OriginalFileName and rename the newly converted file to match the OriginalFileName
- When a conversion is completed it will add the file name and path to the csv spreadsheet and not try to convert it again.
- If a conversion fails it does not delete the original file
- If you do have a failed conversion you might have to delete the OriginalFileName-New file that was created before it failed.
- You should only have to delete the OriginalFileName-New file if you kill powershell to stop converting.
-
After you have modified the variables and changed the execution policy right click on the script
-
Select Run with Powershell
-
You should see a Powershell window apear and you should see this apear at the top of the window:
Finding Movie Files over xGB in \\Path\To\Movies and Episodes ove xGB in \\Path\To\Shows be patient...
-
If you see that message the script is running and conversions should start
The easiest way to do this is to allow this script to run by using this command in powershell running as admin:
Set-ExecutionPolicy Unrestricted
Select Yes to all when prompted
for more information on Execution Policy view this page: https://technet.microsoft.com/library/hh847748.aspx
- This takes a LONG time to run it all depends on how fast your computer is and how the original file was encoded
- On average a 2GB file will take 2-3 hours to complete on an 8 core CPU clocked around 3.9GHz (Might be faster or slower depending on how new the CPU is)
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.