- 帖子
- 3
- 积分
- 14
- 技术
- 0
- 捐助
- 0
- 注册时间
- 2024-3-21
|
后来看到本帖子的哥们,我根据大佬的代码改了下,可以正常使用了,需要下载ffmpeg中的ffprobe
@echo off
REM 1、下载命令行工具 FFmpeg 例如:ffmpeg-n6.0-latest-win64-gpl-6.0.zip
REM https://github.com/BtbN/FFmpeg-Builds/releases
REM 2、解压缩之后把 ffprobe.exe 和此脚本放在同一个文件夹下
cd /d "%~dp0"
set "FolderW=heng"
set "FolderH=shu"
if not exist "%FolderW%" (
md "%FolderW%"
)
if not exist "%FolderH%" (
md "%FolderH%"
)
for /f "delims=" %%i in ('dir /b /s /a-d *.mp4') do (
set "ThisFile=%%i"
setlocal enabledelayedexpansion
for /f "tokens=1-2 delims=," %%a in ('ffprobe.exe -v error -select_streams v:0 -show_entries stream^="width,height" -of csv^="p=0" "!ThisFile!"') do (
set "ThisWidth=%%a"
set "ThisHeight=%%b"
if !ThisWidth! geq !ThisHeight! (
move "%%i" "%FolderW%"
) else (
move "%%i" "%FolderH%"
)
)
endlocal
)
pause |
|