@echo off
setlocal enabledelayedexpansion
cd /d "%~dp0"
set "TmpFile=Video.txt"
set "LogFile=%~dp0Log.txt"
set "OutputVideoName=修改此文字为合成视频名称.mp4" ;; 自定义输出文件名
echo 正在执行视频合并操作。 > "%LogFile%"
echo 日志开始:%date% %time% >> "%LogFile%"
:: 遍历当前目录下的直接子目录
for /d %%d in (*) do (
set "Folder=%%d"
echo 正在处理文件夹:!Folder! >> "%LogFile%"
pushd "!Folder!"
if exist "!TmpFile!" del /f /q "!TmpFile!"
:: 查找当前子目录下的所有视频文件并写入TmpFile
for %%f in (*.mp4 *.avi *.mov *.wmv *.mkv *.ts) do (
echo file '%%f' >> "!TmpFile!"
)