tcasdsss 当前离线
上等兵
@echo off set %mW%=0 set %mH%=0 for /f "delims=" %%a in ('dir /b /s /a-d *.jpg *.png *.bmp') do ( for /f "tokens=1,3" %%i in ('nconvert.exe -info "%%a" ^| findstr "Width Height"') do ( set %W%=Width set %H%=Height if %W% gtr %mW% set %mW%=Width if %H% gtr %mH% set %mH%=Height ) ) pause复制代码
TOP
neorobin (neorobin)当前离线
技术组成员
@echo off :start echo 目录及子目录下所有:分辨率至偶数(1)图片改名(2) 解压图片(3) echo 解压音频(4) 解压视频流(5) 强制分辨率为最大(6) echo 压缩图片(7) 压缩音频(8) 压缩为视频流(9) echo 删除hevc (q) 删除图片(e) 删除opus(r) echo 删除音频(t) echo 相同或不同分辨率图片转为视频流 并删除图片(z) echo 分辨率至偶数再单张压缩图片 并删除图片 (x) set choice= set /p choice= if /i "%choice%"=="1" goto 1 if /i "%choice%"=="2" goto 2 if /i "%choice%"=="3" goto 3 if /i "%choice%"=="4" goto 4 if /i "%choice%"=="5" goto 5 if /i "%choice%"=="6" goto 6 if /i "%choice%"=="7" goto 7 if /i "%choice%"=="8" goto 8 if /i "%choice%"=="9" goto 9 if /i "%choice%"=="q" goto q if /i "%choice%"=="e" goto e if /i "%choice%"=="r" goto r if /i "%choice%"=="t" goto t if /i "%choice%"=="z" goto z if /i "%choice%"=="x" goto x goto start :1 setlocal enabledelayedexpansion for /f "delims=" %%a in ('dir /b /s /a-d *.jpg *.png *.bmp') do ( for /f "tokens=1,3" %%i in ('nconvert.exe -info "%%a" ^| findstr "Width Height"') do ( set "%%i=%%j" ) set /a modW=Width%%2 set /a modH=Height%%2 set "change=0" if !modW! neq 0 ( set /a newW=Width-1 set "change=1" ) else ( set newW=!Width! ) if !modH! neq 0 ( set /a newH=Height-1 set "change=1" ) else ( set newH=!Height! ) if !change! equ 1 ( nconvert -overwrite -crop 0 0 !newW! !newH! "%%a" ) ) goto start :2 setlocal enabledelayedexpansion set n=0 set "folder=%cd%" for /f "delims=" %%i in ('dir /s /a-d /b "%folder%" ^| findstr /i "jpg$ png$ bmp$"') do ( set /a n+=1 set "%%i=!n!" set mod=0000!n! ren "%%~fi" !mod:~-5!%%~xi ) goto start :3 set "PATH=%PATH%;%cd%\bin" set "folder=%cd%" for /f "delims=" %%i in ('dir /s /a-d /b "%folder%" ^| findstr /i "hevc$"') do ( cd /d "%%~dpi" ffmpeg.exe -i "%%~nxi" "%%~ni.png" ) goto start :4 set "PATH=%PATH%;%cd%\bin" set "folder=%cd%" for /f "delims=" %%i in ('dir /s /a-d /b "%folder%" ^| findstr /i "opus$"') do ( cd /d "%%~dpi" ffmpeg.exe -i "%%~nxi" "%%~ni.flac" ) goto start :5 set "PATH=%PATH%;%cd%\bin" set "folder=%cd%" for /f "delims=" %%i in ('dir /s /a-d /b "%folder%" ^| findstr /i "hevc$"') do ( cd /d "%%~dpi" ffmpeg.exe -i "%%~nxi" "%%05d.png" ) goto start :6 set /a Width=0, Height=0 for /f "delims=" %%a in ('dir /s /a-d /b "%cd%" ^| findstr /i "jpg$ png$ bmp$"') do ( for /f "tokens=1,3" %%i in ('nconvert.exe -info "%%a" ^| findstr "Width Height"') do ( if %%j gtr !%%i! set "%%i=%%j" ) ) set Width set Height setlocal enabledelayedexpansion for /f "delims=" %%a in ('dir /b /s /a-d *.jpg *.png *.bmp') do ( for /f "tokens=1,3" %%i in ('nconvert.exe -info "%%a" ^| findstr "Width Height"') do ( set "%%i=%%j" ) nconvert -overwrite -canvas %Width% %Height% center "%%a" ) ) goto start :7 set "PATH=%PATH%;%cd%\bin" set "folder=%cd%" for /f "delims=" %%i in ('dir /s /a-d /b "%folder%" ^| findstr /i "jpg$ png$ bmp$"') do ( cd /d "%%~dpi" ffmpeg.exe -i "%%~nxi" -pix_fmt yuv420p -vcodec libx265 -preset placebo -x265-params qp=30 "%%~ni.hevc" ) goto start :8 set "PATH=%PATH%;%cd%\bin" set "folder=%cd%" for /f "delims=" %%i in ('dir /s /a-d /b "%folder%" ^| findstr /i "wav$ ogg$ mp3$ flac$"') do ( cd /d "%%~dpi" ffmpeg.exe -i "%%~nxi" -vcodec libopus -ab 64k "%%~ni.opus" ) goto start :9 set "PATH=%PATH%;%cd%\bin" set "folder=%cd%" for /f "delims=" %%i in ('dir /s /a-d /b "%folder%" ^| findstr /i "png$ jpg$"') do ( cd /d "%%~dpi" ffmpeg.exe -i "%%~nxi" "%%~ni.bmp" ) set "PATH=%PATH%;%cd%\bin" set "folder=%cd%" for /f "delims=" %%i in ('dir /s /a-d /b "%folder%" ^| findstr /i "bmp$"') do ( cd /d "%%~dpi" ffmpeg.exe -f image2 -i "%%05d.bmp" -pix_fmt yuv420p -vcodec libx265 -preset placebo -x265-params qp=25 "%folder%\1.hevc" goto start ) :q del /f /s *.hevc >nul goto start :e del /f /s *.jpg *.bmp *.png >nul goto start :r del /f /s *.opus >nul goto start :t del /f /s *.wav *.ogg *.mp3 *.flac >nul goto start :z setlocal enabledelayedexpansion set n=0 set "folder=%cd%" for /f "delims=" %%i in ('dir /s /a-d /b "%folder%" ^| findstr /i "jpg$ png$ bmp$"') do ( set /a n+=1 set "%%i=!n!" set mod=0000!n! ren "%%~fi" !mod:~-5!%%~xi ) setlocal enabledelayedexpansion for /f "delims=" %%a in ('dir /b /s /a-d *.jpg *.png *.bmp') do ( for /f "tokens=1,3" %%i in ('nconvert.exe -info "%%a" ^| findstr "Width Height"') do ( set "%%i=%%j" ) set /a modW=Width%%2 set /a modH=Height%%2 set "change=0" if !modW! neq 0 ( set /a newW=Width-1 set "change=1" ) else ( set newW=!Width! ) if !modH! neq 0 ( set /a newH=Height-1 set "change=1" ) else ( set newH=!Height! ) if !change! equ 1 ( nconvert -overwrite -crop 0 0 !newW! !newH! "%%a" ) ) set /a Width=0, Height=0 for /f "delims=" %%a in ('dir /s /a-d /b "%cd%" ^| findstr /i "jpg$ png$ bmp$"') do ( for /f "tokens=1,3" %%i in ('nconvert.exe -info "%%a" ^| findstr "Width Height"') do ( if %%j gtr !%%i! set "%%i=%%j" ) ) set Width set Height setlocal enabledelayedexpansion for /f "delims=" %%a in ('dir /b /s /a-d *.jpg *.png *.bmp') do ( for /f "tokens=1,3" %%i in ('nconvert.exe -info "%%a" ^| findstr "Width Height"') do ( set "%%i=%%j" ) nconvert -overwrite -canvas %Width% %Height% center "%%a" ) ) set "PATH=%PATH%;%cd%\bin" set "folder=%cd%" for /f "delims=" %%i in ('dir /s /a-d /b "%folder%" ^| findstr /i "png$ jpg$"') do ( cd /d "%%~dpi" ffmpeg.exe -i "%%~nxi" "%%~ni.bmp" ) set "PATH=%PATH%;%cd%\bin" set "folder=%cd%" for /f "delims=" %%i in ('dir /s /a-d /b "%folder%" ^| findstr /i "bmp$"') do ( cd /d "%%~dpi" ffmpeg.exe -f image2 -i "%%05d.bmp" -pix_fmt yuv420p -vcodec libx265 -preset placebo -x265-params qp=25 "%folder%\1.hevc" goto e ) :x setlocal enabledelayedexpansion set n=0 set "folder=%cd%" for /f "delims=" %%i in ('dir /s /a-d /b "%folder%" ^| findstr /i "jpg$ png$ bmp$"') do ( set /a n+=1 set "%%i=!n!" set mod=0000!n! ren "%%~fi" !mod:~-5!%%~xi ) setlocal enabledelayedexpansion for /f "delims=" %%a in ('dir /b /s /a-d *.jpg *.png *.bmp') do ( for /f "tokens=1,3" %%i in ('nconvert.exe -info "%%a" ^| findstr "Width Height"') do ( set "%%i=%%j" ) set /a modW=Width%%2 set /a modH=Height%%2 set "change=0" if !modW! neq 0 ( set /a newW=Width-1 set "change=1" ) else ( set newW=!Width! ) if !modH! neq 0 ( set /a newH=Height-1 set "change=1" ) else ( set newH=!Height! ) if !change! equ 1 ( nconvert -overwrite -crop 0 0 !newW! !newH! "%%a" ) ) set "PATH=%PATH%;%cd%\bin" set "folder=%cd%" for /f "delims=" %%i in ('dir /s /a-d /b "%folder%" ^| findstr /i "jpg$ png$ bmp$"') do ( cd /d "%%~dpi" ffmpeg.exe -i "%%~nxi" -pix_fmt yuv420p -vcodec libx265 -preset placebo -x265-params qp=30 "%%~ni.hevc" ) del /f /s *.jpg *.bmp *.png >nul goto start复制代码
评分人数
@echo off & setlocal enabledelayedexpansion set /a Width=0, Height=0 for /f "delims=" %%i in ('dir /s /a-d /b "%folder%" ^| findstr /i "jpg$ png$ bmp$"') do ( for /f "tokens=1,3" %%i in ('nconvert.exe -info "%%a" ^| findstr "Width Height"') do ( if %%j gtr !%%i! set "%%i=%%j" ) ) set Width set Height call 1.bat pause复制代码
CrLf 当前离线
论坛巡查