-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrecord.bat
More file actions
122 lines (104 loc) · 2.78 KB
/
record.bat
File metadata and controls
122 lines (104 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
@echo off
REM Batch recording script for Advanced Sorting Algorithm Visualizer (Windows)
echo 🎬 Advanced Sorting Algorithm Visualizer - Recording Script
echo ===========================================================
echo.
REM Check if Python is available
python --version >nul 2>&1
if %errorlevel% neq 0 (
echo ❌ Python is not installed or not in PATH
pause
exit /b 1
)
REM Check if demo.py exists
if not exist "demo.py" (
echo ❌ demo.py not found. Please run this script from the project directory.
pause
exit /b 1
)
:menu
echo Please choose an option:
echo 1. Run demo without recording
echo 2. Record frames only
echo 3. Record frames and create GIFs
echo 4. Show recording help
echo 5. Create videos from existing recordings (requires ffmpeg)
echo 6. Clean up recordings folder
echo 7. Exit
echo.
set /p choice="Enter your choice (1-7): "
echo.
if "%choice%"=="1" goto run_demo
if "%choice%"=="2" goto record_frames
if "%choice%"=="3" goto record_gifs
if "%choice%"=="4" goto show_help
if "%choice%"=="5" goto create_videos
if "%choice%"=="6" goto cleanup
if "%choice%"=="7" goto exit
echo ❌ Invalid choice. Please enter 1-7.
echo.
pause
goto menu
:run_demo
echo 🎯 Running demo without recording...
python demo.py
goto continue
:record_frames
echo 🎬 Recording frames during demo...
python demo.py --record
goto continue
:record_gifs
echo 🎬 Recording frames and creating GIFs...
python demo.py --record --gif
goto continue
:show_help
echo 📖 Showing recording help...
python demo.py --help-recording
goto continue
:create_videos
ffmpeg -version >nul 2>&1
if %errorlevel% neq 0 (
echo ❌ ffmpeg is not installed. Please install it first:
echo Download from https://ffmpeg.org/
echo Or use chocolatey: choco install ffmpeg
goto continue
)
if not exist "recordings" (
echo ❌ No recordings folder found. Please record demos first.
goto continue
)
echo 🎥 Creating videos from recordings...
for /d %%d in (recordings\*) do (
echo Creating video for %%~nxd...
ffmpeg -y -framerate 30 -i "%%d\frame_%%06d.png" -c:v libx264 -pix_fmt yuv420p -crf 23 "%%~nxd.mp4" 2>nul
if %errorlevel% equ 0 (
echo ✅ %%~nxd.mp4 created successfully
) else (
echo ❌ Failed to create %%~nxd.mp4
)
)
echo 🎉 Video creation completed!
goto continue
:cleanup
echo 🧹 Cleaning up recordings...
if exist "recordings" (
set /p confirm="Are you sure you want to delete all recordings? (y/N): "
if /i "%confirm%"=="y" (
rmdir /s /q "recordings"
echo ✅ Recordings folder deleted
) else (
echo ❌ Cleanup cancelled
)
) else (
echo ℹ️ No recordings folder found
)
goto continue
:continue
echo.
echo Press any key to continue...
pause >nul
echo.
goto menu
:exit
echo 👋 Goodbye!
pause