Last active
December 21, 2020 05:50
-
-
Save infinity-plus/b793c436a4917468bed75a00a634100a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
::========================================================================+ | |
:: Author: Harsh Navdhare | | |
:: Description: This script takes a video file as an arguement and | | |
:: compresses it by encoding it in H265. | | |
:: See https://unix.stackexchange.com/a/38380 | | |
:: Prerequisites : The script assumes you have ffmpeg installed on your | | |
:: computer and added to your path. | | |
:: If not, see | | |
:: https://spadebee.com/2020/06/02/how-to-install-ffmpeg/ | | |
:: | | |
:: How to use: Just drag and drop the file to be compressed to | | |
:: compress-file.bat | | |
::========================================================================+ | |
@echo off | |
SET file=%1 | |
:: Obtain file path, filename from the whole path | |
:: See https://stackoverflow.com/a/47487854/9664447 | |
FOR /F "delims=" %%i IN ("%file%") DO ( | |
SET filepath=%%~pi | |
SET filename=%%~ni | |
SET fileextension=%%~xi | |
) | |
@echo on | |
:: The main command to compress the file. | |
:: File will be stored in the same directory as of input file | |
:: With "- compressed" appended to its name | |
ffmpeg -i %file% -c:v libx265 -c:a copy -crf 28 "%filepath%\%filename% - compressed.mp4" | |
pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment