Commit 56e3e01 1 parent 43ae42b commit 56e3e01 Copy full SHA for 56e3e01
File tree 1 file changed +19
-0
lines changed
1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,9 @@ if [[ -f "$CONFIG_FILE" ]]; then
70
70
71
71
TABLE_VIDEO=$( get_ini_value " CustomMedia" " TableVideo" )
72
72
echo -e " ${YELLOW} TABLE_VIDEO: $TABLE_VIDEO ${NC} "
73
+
74
+ TABLE_IMAGE=$( get_ini_value " CustomMedia" " TableImage" ) # ref for images folder
75
+ echo -e " ${YELLOW} TABLE_IMAGE: $TABLE_IMAGE ${NC} "
73
76
else
74
77
echo -e " ${RED} ERROR: config.ini not found. Exiting...${NC} "
75
78
exit 1
@@ -143,6 +146,22 @@ capture_window_to_mp4() {
143
146
# Capture a screenshot of the window
144
147
import -window " $WINDOW_ID " " $FRAME_FILE "
145
148
sleep " $FRAME_INTERVAL "
149
+
150
+ # Save the middle frame with the same base name as OUTPUT_FILE
151
+
152
+ if [[ $i -eq $(( FRAME_COUNT / 2 )) ]]; then
153
+ local BASE_NAME
154
+ local BASE_NAME=$( basename " $OUTPUT_FILE " .mp4)
155
+ local IMAGE_DIR
156
+ local IMAGE_DIR=$( dirname " $TABLE_IMAGE " )
157
+ mkdir -p " $IMAGE_DIR " # Ensure the directory exists
158
+ cp " $FRAME_FILE " " ${TABLE_DIR} /${IMAGE_DIR} /${BASE_NAME} .png"
159
+ if [[ $? -ne 0 ]]; then
160
+ echo " ${RED} Error: Failed to copy frame to ${TABLE_DIR} /${IMAGE_DIR} /${BASE_NAME} .png${NC} " >&2
161
+ else
162
+ echo -e " Frame saved to ${GREEN}${TABLE_DIR} /${IMAGE_DIR} /${BASE_NAME} .png${NC} "
163
+ fi
164
+ fi
146
165
done
147
166
148
167
# Assemble the screenshots into an MP4 video using ffmpeg
You can’t perform that action at this time.
0 commit comments