:input_folder set /p folder_path="변환할 webp 파일이 들어있는 폴더 경로를 입력하세요 (종료하려면 'exit' 입력): " if "%folder_path%"=="exit" exit
REM 파일 개수 계산 set count=0 for %%F in ("%folder_path%\*.webp") do ( set /a count+=1 )
REM 파일 개수가 0인 경우 처리 if %count%==0 ( echo 해당 폴더에 WebP 파일이 없습니다. 다시 입력해주세요. goto :input_folder )
REM 날짜순으로 정렬된 파일 목록 가져오기 set index=0 for /f "tokens=*" %%F in ('dir /b /o:d "%folder_path%\*.webp"') do ( REM 파일명 추출 set "file_path=%folder_path%\%%F" set "file_name=%%~nF"
REM 현재 진행도 표시 set /a index+=1 echo 진행도: [!index!/!count!]
REM WebP 파일의 타입 확인 (동적인 경우에만 처리) set "is_animated=false" for /f "tokens=*" %%T in ('webpmux -info "!file_path!" ^| findstr /i "animation"') do ( set "is_animated=true" )
if "!is_animated!"=="true" ( REM anim_dump로 png 생성 anim_dump "!file_path!" >nul 2>&1
REM WebP 파일의 정보를 가져오고, 각 프레임의 duration을 더함 set "total_duration=0" set "frame_count=0" for /f "tokens=7" %%A in ('webpmux -info "!file_path!" ^| findstr /c:" " ') do ( set "duration=%%A" set /a "total_duration+=duration" set /a "frame_count+=1" )
REM 모든 duration을 더한 후 FPS 계산 if !frame_count! gtr 0 ( set /a "average_duration=total_duration / frame_count" set /a "fps=1000 / average_duration" ) else ( echo 프레임을 찾을 수 없거나 오류가 발생했습니다. )