我自已研究了一下,按着上面第二种思路,解决了中文文件名的问题,已测试成功。
附上最终版本,给有需要的有缘人。- @echo off
- setlocal enabledelayedexpansion
- cd /d "%~dp0"
- for /f "delims=" %%i in ('dir /b /s /a-d "*.mp4" "*.mkv"') do (
- for /f "tokens=2,3,4 delims=:. " %%a in ('ffmpeg -i "%%i" 2^>^&1 ^| find "Duration:"') do (
- set hh=%%a
- set mm=%%b
- set ss=%%c
- )
- if "!hh:~0,1!"=="0" (set /a hh=!hh:~-1!*3600) else (set /a hh=!hh!*3600)
- if "!mm:~0,1!"=="0" (set /a mm=!mm:~-1!*60) else (set /a mm=!mm!*60)
- set /a str=!hh!+!mm!+!ss!
- set /a BianLiang=!str!/10
- set str=!BianLiang!
- for /l %%d in (1,1,9) do (
- ffmpeg -ss !BianLiang! -i "%%i" -frames:v 1 "TempABC0%%d.jpg"
- set /a BianLiang=!str!+!BianLiang!
- )
- (for /l %%x in (1,1,9) do (
- echo "TempABC0%%x.jpg"
- ))>"filelist.txt"
- "%~dp0MagickFull\magick.exe" montage @filelist.txt -geometry +0+0 -background #00000000 "Temp999-Full.jpg"
- move /y "Temp999-Full.jpg" "%%~dpni-YuLan.jpg"
- del /q /f filelist.txt "TempABC0*.jpg"
- )
复制代码
|