本帖最后由 zaqmlp 于 2022-3-29 18:38 编辑
bat存为ANSI/GB2312编码- /*&cls&echo off&cd /d "%~dp0"&mode con lines=5000
- set "minsec=60"
- set "oldfolder=E:\父文件夹"
- set "newfolder=%oldfolder%_循环"
- if not exist "%oldfolder%" (echo;"%oldfolder%" 未找到&goto end)
- for /f "delims=" %%a in ('dir /a-d-h/b/s "%oldfolder%\*.mp4"') do (
- for /f "tokens=1,2,3,4 delims=|" %%a in ('ffmpeg -i "%%a" 2^>^&1^|cscript -nologo -e:jscript "%~f0" "%minsec%" "%%a" "%oldfolder%" "%newfolder%"') do (
- if not exist "%%~dpd" md "%%~dpd"
- echo;duration=%%a
- echo;concat=%%b
- echo;filelist=%%c
- echo;output="%%d"
- echo;---------------------
- ffmpeg -hide_banner -y %%c -filter_complex "[0:0][0:1][1:0][1:1]concat=n=%%b:v=1:a=1" "%%d"
- echo;=================================
- echo;
- echo;
- )
- )
- :end
- pause
- exit
- */
- var fso=new ActiveXObject('Scripting.FileSystemObject');
- var minsec=Number(WSH.Arguments(0));
- var s=0;
- while(!WSH.StdIn.AtEndOfStream){
- var line=WSH.StdIn.ReadLine();
- var m=line.match(/ Duration *: *(\d+):(\d+):(\d+)/);
- if(m){
- s=3600*Number(m[1])+60*Number(m[2])+1*Number(m[3]);
- break;
- }
- }
- if(s>0){
- var arr=[];
- t=Math.ceil(minsec/s);
- for(var i=1;i<=t;i++){
- var f='-i "'+WSH.Arguments(1)+'"';
- arr.push(f);
- }
- var filelist=arr.join(' ');
- var newfile=WSH.Arguments(3)+WSH.Arguments(1).substring(WSH.Arguments(2).length);
- WSH.echo(s.toString()+'|'+arr.length.toString()+'|'+filelist+'|'+newfile)
- }
复制代码
|