Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @ECHO on &SETLOCAL
- REM Change the working directory to your .mp4 files root folder.
- CD %OneDrive%\Desktop\Vids
- REM This scripts will recursively grab all mp4 files using a batch process and convert them into x265 using FFmpeg's command line (program used is ffmpeg.exe). If you don't have that you must obtain it. A good place to download and build ffmpeg.exe is with media autobuild suite on GitHub: https://github.com/jb-alvarado/media-autobuild_suite
- REM Make sure to set ffmpeg.exe's folder path as an environmental variable in windows before running this script.
- REM Set the below line to your root folder to recursively search for mp4 files.
- SET "mp4PATH=%OneDrive%\Desktop\Vids\"
- REM Create empty convert file.
- COPY NUL "convert_movies.bat" >NUL 2>&1
- REM Add ECHO off.
- ECHO @ECHO off >>"convert_movies.bat"
- REM Set counter.
- SET /A COUNT=1
- FOR /R "%mp4PATH%" %%G IN (*.mp4) DO (
- SET "fpath=%%~fG"
- SET "fname=%%~nG"
- SETLOCAL enabledelayedexpansion
- IF "!fname!"=="!fname:*(x265)=!" (
- CALL :DOFFmpegCLI "!fpath!"
- REM Add line break space.
- ECHO( >>"convert_movies.bat"
- ) ELSE ENDLOCAL
- )
- GOTO:EOF
- :DOFFmpegCLI
- REM Skip if the parameter is empty.
- IF "%~1"=="" GOTO:EOF
- FOR %%A IN ("%~1") DO (
- SET "Folder=%%~dpA"
- SET "Name=%%~nxA"
- )
- REM Run FFmpeg.exe in the cmd.exe window.
- ECHO ffmpeg -ss 00:10:00 -t 1 -y -i "%~1" -c:v libx265 -preset slow -crf 18 -c:a aac "%Folder%%~n1(x265).mp4">>"convert_movies.bat" && ffmpeg | ffmpeg -ss 00:10:00 -t 1 -y -i "%~1" -c:v libx265 -preset slow -crf 18 -c:a aac "%Folder%%~n1(x265).mp4"
- EXIT /B
- PAUSE
Add Comment
Please, Sign In to add comment