This question is beyond the scope of an SO question. Nevertheless I will answer it, because today is sunday.
- download and install mediainfo command line version
- add the path to the
mediainfo
binaries to your system or userPATH
environment variable - copy the rename script, replace the path to your video folder, there is a safety
echo
before therename
command, remove it if the output looks good - the script tests for already-exists and already-processed files (suggested by Peter Wright)
rename script:
@echo off & setlocal
cd X:\video\path
for /f "delims=" %%i in ('dir /b /a-d *.mp4') do (
set "fnameo=%%~ni"
set "fnamee=%%~xi"
set "Height="
for /f "delims=" %%j in ('mediainfo "--Inform=Video;%%Height%%" "%%~i"') do set "Height=%%j"
setlocal enabledelayedexpansion
call set "selftest=%%fnameo:[H.264 !Height!p]=%%"
if "!selftest!" equ "!fnameo!" if not exist "!fnameo! [H.264 !Height!p]!fnamee!" (
echo rename "!fnameo!!fnamee!" "!fnameo! [H.264 !Height!p]!fnamee!"
)
endlocal
)
output example:
rename "Handbrake.0.9.8.mp4" "Handbrake.0.9.8 [H.264 800p].mp4" rename "Hybrid.2012.10.21.1.mp4" "Hybrid.2012.10.21.1 [H.264 800p].mp4" rename "Womble.mp4" "Womble [H.264 1080p].mp4"