需求:
还是此功能,不处理上边那个功能处理的视频,而是处理深一层(上边功能处理过的视频输出的文件夹)的文件夹内的视频,输出到更深一层的文件夹(P1\P1\P1\哦哦哦.MP4)
@echo off&mode con lines=5000
cd /d "%~dp0"
set "exefile=.\ffmpeg.exe"
set "mp3folder=.\music"
rem if not exist "%exefile%" (echo;"%exefile%" not found&pause&exit)
if not exist "%mp3folder%" (echo;"%mp3folder%" not found&pause&exit)
for /f "delims=" %%a in ('dir /ad-h/b') do (
for /f "delims=" %%b in ('dir /a-d-h/b ".\%%a\*.mp4" 2^>nul') do (
set "newfolder=.\%%a\\%%a"
set "mp4file=.\%%a\%%~nxb"
set "mp4name=%%~nxb"
set n=0
for /f "tokens=1* delims=:" %%c in ('dir /a-d-h/b "%mp3folder%\*.mp3" 2^>nul^|findstr /n .') do (
set "_%%c=%mp3folder%\%%d"
set "n=%%c"`
)
setlocal enabledelayedexpansion
set /a "r=!random! %% n+1"
for /f %%c in ("!r!") do set "mp3file=!_%%c!"
md "!newfolder!" 2>nul
set "outfile=!newfolder!\!mp4name!"
echo;"!newfolder!" + "!mp4file!" --^> !mp4name!"
set "final_mp3=!mp4name:~0,-4!"
set "mp3file=.\music\!final_mp3!.mp3"
echo;"!mp3file!"
echo;"!mp4file!" + "!mp3file!" --^> !outfile!"
"%exefile%" -n -hwaccel cuvid -c:v h264_cuvid -i "!mp4file!" -i "!mp3file!" -c:v h264_nvenc -filter_complex "[0:a]volume=10dB[a0]; [1:a]aloop=loop=-1:size=2e+09[a1]; [a1]volume=7dB[a12]; [a0][a12]amix=inputs=2:duration=first:dropout_transition=2[a]" -map 0:v -map "[a]" -c:v copy -c:a aac -shortest "!outfile!"
endlocal
)
)
pause
exit