一个示例- @echo off & setlocal enabledelayedexpansion
- set "s1=00:00:45.240"
-
- rem 片头毫秒数
- for /f "tokens=1-4delims=:." %%a in ("%s1%") do (
- set /a "t1=(1%%a %% 100 *3600 + 1%%b %% 100 * 60 + 1%%c %% 100) * 1000 + 1%%d %% 1000"
- )
-
- rem 片头毫秒数 + 延迟毫秒数 = 总延迟毫秒数
- for /f "tokens=2 delims=:" %%i in ('MediaInfo 1.avi ^| find /i "Delay relative to video"') do (
- set "s=%%i+0"
- set "s=!s:h=*3600*1000+!"
- set "s=!s:min=*60*1000+!"
- set "s=!s:ms=!"
- set "s=!s:s=*1000+!"
- if "!s:-=!" NEQ "!s!" set "s=!s:-=-1*(!)"
- set /a "t1 -= !s!"
- )
-
- rem 总延迟毫秒数转回 hh:mm:ss.ms 格式
- set /a ms=t1%%1000+1000, t1/=1000, hh=t1/3600+100, mm=t1%%3600/60+100, ss=t1%%60+100
- set "t=!hh:~1!:!mm:~1!:!ss:~1!.!ms:~1!"
- echo;!t!
- pause
复制代码
|