@@ -204,14 +204,23 @@ function graceful_exit_force() {
204
204
exit 0
205
205
}
206
206
207
+ if [ " ${SE_RECORD_AUDIO,,} " = " true" ]; then
208
+ echo " $( date -u +" ${ts_format} " ) [${process_name} ] - Audio source arguments: ${SE_AUDIO_SOURCE} "
209
+ else
210
+ SE_AUDIO_SOURCE=" "
211
+ fi
212
+
207
213
if [[ " ${VIDEO_UPLOAD_ENABLED} " != " true" ]] && [[ " ${VIDEO_FILE_NAME} " != " auto" ]] && [[ -n " ${VIDEO_FILE_NAME} " ]]; then
208
214
trap graceful_exit SIGTERM SIGINT EXIT
209
215
wait_for_display
210
216
video_file=" $VIDEO_FOLDER /$VIDEO_FILE_NAME "
211
217
# exec replaces the video.sh process with ffmpeg, this makes easier to pass the process termination signal
212
218
ffmpeg -hide_banner -loglevel warning -flags low_delay -threads 2 -fflags nobuffer+genpts -strict experimental -y -f x11grab \
213
- -video_size ${VIDEO_SIZE} -r ${FRAME_RATE} -i ${DISPLAY} -codec:v ${CODEC} ${PRESET} -pix_fmt yuv420p " $video_file " &
214
- wait $!
219
+ -video_size ${VIDEO_SIZE} -r ${FRAME_RATE} -i ${DISPLAY} ${SE_AUDIO_SOURCE} -codec:v ${CODEC} ${PRESET} -pix_fmt yuv420p " $video_file " &
220
+ FFMPEG_PID=$!
221
+ if ps -p $FFMPEG_PID > /dev/null; then
222
+ wait $FFMPEG_PID
223
+ fi
215
224
wait_for_file_integrity
216
225
217
226
else
@@ -243,8 +252,11 @@ else
243
252
video_file=" ${VIDEO_FOLDER} /$video_file_name "
244
253
echo " $( date -u +" ${ts_format} " ) [${process_name} ] - Starting to record video"
245
254
ffmpeg -hide_banner -loglevel warning -flags low_delay -threads 2 -fflags nobuffer+genpts -strict experimental -y -f x11grab \
246
- -video_size ${VIDEO_SIZE} -r ${FRAME_RATE} -i ${DISPLAY} -codec:v ${CODEC} ${PRESET} -pix_fmt yuv420p " $video_file " &
247
- recording_started=" true"
255
+ -video_size ${VIDEO_SIZE} -r ${FRAME_RATE} -i ${DISPLAY} ${SE_AUDIO_SOURCE} -codec:v ${CODEC} ${PRESET} -pix_fmt yuv420p " $video_file " &
256
+ FFMPEG_PID=$!
257
+ if ps -p $FFMPEG_PID > /dev/null; then
258
+ recording_started=" true"
259
+ fi
248
260
echo " $( date -u +" ${ts_format} " ) [${process_name} ] - Video recording started"
249
261
sleep ${poll_interval}
250
262
elif [[ " $session_id " != " $prev_session_id " && " $recording_started " = " true" ]]; then
0 commit comments