- @echo off
- cd /d "%~dp0"
- for %%a in (wav mp4) do (
- for %%i in (*.%%a) do (
- for /f "delims=" %%j in ('ffprobe -v error -show_entries format^=duration -of default^=noprint_wrappers^=1:nokey^=1 "%%i"') do (
- if not defined target_duration (
- for /f "delims=" %%k in ('powershell -c "%%j+5"') do (
- set target_duration=%%k
- )
- ) else (
- set video_duration=%%j
- )
- )
- )
- )
- for /f "tokens=1 delims=." %%a in ('powershell -c "%target_duration% / %video_duration% + 1"') do (
- for %%b in (*.mp4) do (
- (for /l %%l in (1,1,%%a) do (
- echo file '%%~fb'
- ))>x.txt
- )
- )
- ffmpeg -f concat -safe 0 -i x.txt -t %target_duration% -c copy output1.mp4
- del x.txt
- pause
复制代码
|